|
From: <at...@us...> - 2007-08-21 08:30:16
|
Revision: 479
http://cadcdev.svn.sourceforge.net/cadcdev/?rev=479&view=rev
Author: atani
Date: 2007-08-21 01:30:14 -0700 (Tue, 21 Aug 2007)
Log Message:
-----------
various cleanups and fixes for TCPServerSocket
Modified Paths:
--------------
tiki/examples/net/basic/src/main.cpp
tiki/include/Tiki/net/buffer.h
tiki/include/Tiki/net/socket.h
tiki/include/Tiki/net/tcpserversocket.h
tiki/include/Tiki/net/tcpsocket.h
tiki/osx/include/Tiki/platnet.h
tiki/osx/src/platnet.cpp
tiki/src/net/address.cpp
tiki/src/net/socket.cpp
tiki/src/net/tcpserversocket.cpp
tiki/src/net/tcpsocket.cpp
tiki/win32/include/Tiki/platnet.h
tiki/win32/src/platnet.cpp
tiki/win32/tiki_vc80.sln
Added Paths:
-----------
tiki/include/Tiki/net.h
Removed Paths:
-------------
tiki/include/Tiki/net/net.h
Modified: tiki/examples/net/basic/src/main.cpp
===================================================================
--- tiki/examples/net/basic/src/main.cpp 2007-08-21 04:55:20 UTC (rev 478)
+++ tiki/examples/net/basic/src/main.cpp 2007-08-21 08:30:14 UTC (rev 479)
@@ -9,7 +9,7 @@
#include <Tiki/tiki.h>
#include <Tiki/refcnt.h>
#include <Tiki/tikitime.h>
-#include <Tiki/net/net.h>
+#include <Tiki/net.h>
using namespace Tiki;
using namespace Tiki::Debug;
Modified: tiki/include/Tiki/net/buffer.h
===================================================================
--- tiki/include/Tiki/net/buffer.h 2007-08-21 04:55:20 UTC (rev 478)
+++ tiki/include/Tiki/net/buffer.h 2007-08-21 08:30:14 UTC (rev 479)
@@ -29,6 +29,11 @@
memcpy(m_data, data, len);
}
+ void reset() {
+ memset(m_data, 0, m_dataLen);
+ m_usedDataLen = 0;
+ }
+
uint8 *getData() const {
return m_data;
}
Deleted: tiki/include/Tiki/net/net.h
===================================================================
--- tiki/include/Tiki/net/net.h 2007-08-21 04:55:20 UTC (rev 478)
+++ tiki/include/Tiki/net/net.h 2007-08-21 08:30:14 UTC (rev 479)
@@ -1,31 +0,0 @@
-/*
- Tiki
-
- net.h
-
- Copyright (C)2007 Atani Software
-*/
-#ifndef __TIKI_NET_H
-#define __TIKI_NET_H
-
-#include "Tiki/platnet.h"
-
-namespace Tiki {
-
-namespace Net {
-
-void init();
-void shutdown();
-
-} // namespace Net
-
-} // namespace Tiki
-
-#endif // __TIKI_NET_H
-
-#include <Tiki/net/address.h>
-#include <Tiki/net/buffer.h>
-#include <Tiki/net/socket.h>
-#include <Tiki/net/tcpsocket.h>
-#include <Tiki/net/tcpserversocket.h>
-#include <Tiki/net/udpsocket.h>
Modified: tiki/include/Tiki/net/socket.h
===================================================================
--- tiki/include/Tiki/net/socket.h 2007-08-21 04:55:20 UTC (rev 478)
+++ tiki/include/Tiki/net/socket.h 2007-08-21 08:30:14 UTC (rev 479)
@@ -37,12 +37,17 @@
return m_localAddress;
}
+ void setLocalAddress(RefPtr<Address> address)
+ {
+ m_localAddress = address;
+ }
+
bool isNonBlocking()
{
return m_blocking;
}
- void setNonBlocking(bool blocking)
+ virtual void setNonBlocking(bool blocking)
{
m_blocking = blocking;
}
@@ -65,6 +70,8 @@
virtual void close() = 0;
+ virtual bool isOpen() = 0;
+
private:
RefPtr<Address> m_peerAddress;
RefPtr<Address> m_localAddress;
Modified: tiki/include/Tiki/net/tcpserversocket.h
===================================================================
--- tiki/include/Tiki/net/tcpserversocket.h 2007-08-21 04:55:20 UTC (rev 478)
+++ tiki/include/Tiki/net/tcpserversocket.h 2007-08-21 08:30:14 UTC (rev 479)
@@ -22,7 +22,7 @@
TCPServerSocket() : TCPSocket() {};
TCPServerSocket(RefPtr<Address> address) : TCPSocket(address) {};
- void bind();
+ void bind(size_t maxwaiting = 10);
RefPtr<TCPSocket> accept();
};
Modified: tiki/include/Tiki/net/tcpsocket.h
===================================================================
--- tiki/include/Tiki/net/tcpsocket.h 2007-08-21 04:55:20 UTC (rev 478)
+++ tiki/include/Tiki/net/tcpsocket.h 2007-08-21 08:30:14 UTC (rev 479)
@@ -30,13 +30,22 @@
SOCKET_ERROR = -1
};
#endif
- TCPSocket() : Socket() {};
- TCPSocket(RefPtr<Address> address) : Socket(address) {};
+ TCPSocket() : Socket(), m_open(false) {};
+ TCPSocket(RefPtr<Address> address) : Socket(address), m_open(false) {};
+#if TIKI_PLAT == TIKI_WIN32
+ TCPSocket(RefPtr<Address> address, SOCKET socket) : Socket(address), m_socket(socket), m_open(true) {setNonBlocking(false);};
+#else
+ TCPSocket(RefPtr<Address> address, int socket) : Socket(address), m_socket(socket) {setNonBlocking(false);};
+#endif
virtual void send(RefPtr<Buffer> data);
virtual void recv(RefPtr<Buffer> data);
+ virtual bool isOpen() {
+ return m_open;
+ }
+
uint32 getPort()
{
return m_port;
@@ -50,11 +59,12 @@
virtual void close();
- private:
+ virtual void setNonBlocking(bool blocking);
+
+ protected:
uint32 m_port;
-#if TIKI_PLAT == TIKI_OSX
- ;
-#elif TIKI_PLAT == TIKI_WIN32
+ bool m_open;
+#if TIKI_PLAT == TIKI_WIN32
SOCKET m_socket;
#else
int m_socket;
Copied: tiki/include/Tiki/net.h (from rev 476, tiki/include/Tiki/net/net.h)
===================================================================
--- tiki/include/Tiki/net.h (rev 0)
+++ tiki/include/Tiki/net.h 2007-08-21 08:30:14 UTC (rev 479)
@@ -0,0 +1,30 @@
+/*
+ Tiki
+
+ net.h
+
+ Copyright (C)2007 Atani Software
+*/
+#ifndef __TIKI_NET_H
+#define __TIKI_NET_H
+
+namespace Tiki {
+
+namespace Net {
+
+void init();
+void shutdown();
+
+} // namespace Net
+
+} // namespace Tiki
+
+#endif // __TIKI_NET_H
+
+#include "Tiki/platnet.h"
+#include "Tiki/net/address.h"
+#include "Tiki/net/buffer.h"
+#include "Tiki/net/socket.h"
+#include "Tiki/net/tcpsocket.h"
+#include "Tiki/net/tcpserversocket.h"
+#include "Tiki/net/udpsocket.h"
Modified: tiki/osx/include/Tiki/platnet.h
===================================================================
--- tiki/osx/include/Tiki/platnet.h 2007-08-21 04:55:20 UTC (rev 478)
+++ tiki/osx/include/Tiki/platnet.h 2007-08-21 08:30:14 UTC (rev 479)
@@ -8,26 +8,16 @@
#ifndef TIKI_PLATFORM_NET_H
#define TIKI_PLATFORM_NET_H
-#include <OpenTransport.h>
-#include <OpenTptInternet.h>
-#include <Events.h>
-namespace Tiki {
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <netinet/in.h>
+#include <netinet/tcp.h>
+#include <netdb.h>
+#include <sys/socket.h>
+#include <sys/time.h>
-namespace Net {
-
-enum DNS_STATUS {
- NOT_READY = 0,
- READY,
- RESOLVED,
- ERROR
-};
-
-extern DNS_STATUS g_tikiDNSStatus;
-extern InetSvcRef g_tikiDNSRef;
-
-}; // namespace Net
-
-}; // namespace Tiki
-
#endif // TIKI_PLATFORM_NET_H
Modified: tiki/osx/src/platnet.cpp
===================================================================
--- tiki/osx/src/platnet.cpp 2007-08-21 04:55:20 UTC (rev 478)
+++ tiki/osx/src/platnet.cpp 2007-08-21 08:30:14 UTC (rev 479)
@@ -13,70 +13,12 @@
namespace Net {
-DNS_STATUS g_tikiDNSStatus;
-InetSvcRef g_tikiDNSRef;
-
-static pascal void dnsNotifier(void *context, OTEventCode code, OTResult result, void *cookie) {
- switch(code) {
- case T_OPENCOMPLETE:
- if(result == kOTNoError) {
- g_tikiDNSStatus = READY;
- g_tikiDNSRef = (InetSvcRef)cookie;
- }
- else {
- g_tikiDNSStatus = ERROR;
- Tiki::Debug::printf("T_DNRSTRINGTOADDRCOMPLETE event returned an error\n");
- }
- break;
- case T_DNRSTRINGTOADDRCOMPLETE:
- g_tikiDNSStatus = RESOLVED;
- break;
- default:
- if(result != kOTNoError) {
- g_tikiDNSStatus = ERROR;
- Tiki::Debug::printf("Error in DNS Resolver\n");
- }
- }
-}
-
-void startDNS() {
- OSStatus status;
-
- status = OTAsyncOpenInternetServices(
- kDefaultInternetServicesPath, 0, dnsNotifier, NULL);
- if(status != noErr) {
- Tiki::Debug::printf("Unable to initialize DNS Handler\n");
- }
-}
-
-void stopDNS() {
- if(g_dnsRef != 0) {
- OTCloseProvider(g_tikiDNSRef);
- g_tikiDNSStatus = NOT_READY;
- g_tikiDNSRef = 0;
- }
-}
-
void init() {
- OSStatus status;
-
- g_tikiDNSStatus = NOT_READY;
- g_tikiDNSRef = 0;
-
- status = InitOpenTransport();
- if(status == noErr) {
- StartDNS();
- }
- else {
- Tiki::Debug::printf("Unable to initialize OpenTransport\n");
- }
}
void shutdown() {
- stopDNS();
}
+}; // namespace Net
-}
-
-};
+}; // namespace Tiki
Modified: tiki/src/net/address.cpp
===================================================================
--- tiki/src/net/address.cpp 2007-08-21 04:55:20 UTC (rev 478)
+++ tiki/src/net/address.cpp 2007-08-21 08:30:14 UTC (rev 479)
@@ -8,7 +8,7 @@
#include "pch.h"
#include "Tiki/tiki.h"
-#include "Tiki/net/net.h"
+#include "Tiki/net.h"
#include <sstream>
@@ -31,28 +31,11 @@
m_ip != AddressAny &&
m_ip != AddressNone )
{
-#if TIKI_PLAT == TIKI_OSX
- InetHost ip;
- InetDomainName domainName;
- OSStatus status;
-
- domainName[0] = '\0';
- ip = m_ip;
- status = OTInetAddressToName(g_tikiDNSRef, ip, domainName);
- if(status == kOTNoError) {
- while(g_tikiDNSStatus != RESOLVED)
- {
- ;
- }
- return domainName;
- }
-#else
struct hostent *hp = gethostbyaddr((char *)&m_ip, 4, AF_INET);
if(hp != NULL)
{
m_hostname = string(hp->h_name);
}
-#endif
}
return m_hostname;
@@ -69,22 +52,11 @@
if(m_ip == AddressUnknown)
{
Tiki::Debug::printf("resolving host: %s\n", m_hostname.c_str());
-#if TIKI_PLAT == TIKI_OSX
- InetHostInfo host;
- if(OTInetStringToAddress(g_tikiDNSRef, m_hostname.c_str(), &info) == noErr) {
- while( g_tikiDNSStatus != RESOLVED)
- {
- WaitNextEvent(everyEvent, 0, 1, NULL);
- }
- return info.addrs[0];
- }
-#else
struct hostent *hp = gethostbyname(m_hostname.c_str());
if(hp != NULL)
{
memcpy(&m_ip, hp->h_addr, hp->h_length);
}
-#endif
}
return m_ip;
}
@@ -102,7 +74,6 @@
uint32 ipnums = getIPAddress();
uint8 *ip = (uint8 *)(&ipnums);
- //Tiki::Debug::printf("host ip: %d.%d.%d.%d\n", ip[0], ip[1], ip[2], ip[3]);
std::ostringstream address;
Modified: tiki/src/net/socket.cpp
===================================================================
--- tiki/src/net/socket.cpp 2007-08-21 04:55:20 UTC (rev 478)
+++ tiki/src/net/socket.cpp 2007-08-21 08:30:14 UTC (rev 479)
@@ -8,7 +8,7 @@
#include "pch.h"
#include "Tiki/tiki.h"
-#include "Tiki/net/net.h"
+#include "Tiki/net.h"
namespace Tiki {
Modified: tiki/src/net/tcpserversocket.cpp
===================================================================
--- tiki/src/net/tcpserversocket.cpp 2007-08-21 04:55:20 UTC (rev 478)
+++ tiki/src/net/tcpserversocket.cpp 2007-08-21 08:30:14 UTC (rev 479)
@@ -1,33 +1,77 @@
-/*
- Tiki
+/*
+ Tiki
+
+ tcpserversocket.cpp
+
+ Copyright (C)2007 Atani Software
+*/
+
+#include "pch.h"
+#include "Tiki/tiki.h"
+#include "Tiki/net.h"
+
+namespace Tiki {
+
+namespace Net {
+
+namespace TCP {
+
+void TCPServerSocket::bind(size_t maxwaiting)
+{
+ struct sockaddr_in sock_addr;
+
+ memset(&sock_addr, 0, sizeof(sock_addr));
+ sock_addr.sin_family = AF_INET;
+ sock_addr.sin_addr.s_addr = INADDR_ANY;
+ sock_addr.sin_port = htons(getPort());
- tcpserversocket.cpp
-
- Copyright (C)2007 Atani Software
-*/
-
-#include "pch.h"
-#include "Tiki/tiki.h"
-#include "Tiki/net/net.h"
-
-namespace Tiki {
-
-namespace Net {
-
-namespace TCP {
-
-void TCPServerSocket::bind()
-{
-
-}
-
-RefPtr<TCPSocket> TCPServerSocket::accept()
-{
- return NULL;
-}
-
-} // namespace TCP
-
-} // namespace Net
-
-} // namespace Tiki
+ if(isNonBlocking()) {
+ Tiki::Debug::printf("setting NO BLOCKING mode\n");
+#if TIKI_PLAT == TIKI_WIN32
+ unsigned long mode = 1;
+ ioctlsocket(m_socket, FIONBIO, &mode);
+#else
+ fcntl(m_socket, F_SETFL, O_NONBLOCK);
+#endif
+ }
+
+
+ /* Bind the socket for listening */
+ if ( ::bind(m_socket, (struct sockaddr *)&sock_addr,
+ sizeof(sock_addr)) == SOCKET_ERROR ) {
+ Tiki::Debug::printf("Couldn't bind to local port\n");
+ close();
+ return;
+ }
+ if ( listen(m_socket, (int)maxwaiting) == SOCKET_ERROR ) {
+ Tiki::Debug::printf("Couldn't listen to local port\n");
+ close();
+ return;
+ }
+}
+
+RefPtr<TCPSocket> TCPServerSocket::accept()
+{
+ struct sockaddr_in sock_addr;
+#if TIKI_PLAT == TIKI_WIN32
+ SOCKET socket;
+#else
+ int socket;
+#endif
+
+ size_t addrlen = sizeof(struct sockaddr_in);
+ socket = ::accept(m_socket, (sockaddr *)&sock_addr, (int *)&addrlen);
+
+ if(socket != INVALID_SOCKET) {
+ RefPtr<Address> remote = new Address();
+ remote->setIPAddress(sock_addr.sin_addr.s_addr);
+ return new TCPSocket(remote, socket);
+ }
+ return NULL;
+}
+
+} // namespace TCP
+
+} // namespace Net
+
+} // namespace Tiki
Modified: tiki/src/net/tcpsocket.cpp
===================================================================
--- tiki/src/net/tcpsocket.cpp 2007-08-21 04:55:20 UTC (rev 478)
+++ tiki/src/net/tcpsocket.cpp 2007-08-21 08:30:14 UTC (rev 479)
@@ -8,7 +8,7 @@
#include "pch.h"
#include "Tiki/tiki.h"
-#include "Tiki/net/net.h"
+#include "Tiki/net.h"
#include <errno.h>
@@ -19,8 +19,6 @@
namespace TCP {
void TCPSocket::send(const RefPtr<Buffer> buffer) {
-#if TIKI_PLAT == TIKI_OSX
-#else
uint8 *data = buffer->getData();
size_t dataLen = buffer->getUsedDataLen();
int len;
@@ -38,39 +36,47 @@
}
} while(dataLen > 0 && (len > 0 || errno == EINTR));
Tiki::Debug::printf("errno: %d [%x]\n", errno, errno);
-#endif
}
void TCPSocket::recv(RefPtr<Buffer> data) {
-#if TIKI_PLAT == TIKI_OSX
-#else
uint8 *tmp = new uint8[data->getDataLen()];
memset(tmp, 0, data->getDataLen());
int recvlen = 0;
errno = 0;
+ Tiki::Debug::printf("receiving %d bytes\n", data->getDataLen());
do {
- Tiki::Debug::printf("receiving %d bytes\n", data->getDataLen());
recvlen = ::recv(m_socket, (char *)tmp, (int)data->getDataLen(), 0);
- } while(errno == EINTR && (recvlen < 0 && !isNonBlocking()));
+#if TIKI_PLAT == TIKI_WIN32
+ } while(recvlen == SOCKET_ERROR && WSAGetLastError() == WSAEWOULDBLOCK);
+#else
+ } while(errno == EINTR);
+#endif
Tiki::Debug::printf("received %d bytes\nerrno %d\n", recvlen, errno);
if(recvlen > 0) {
data->setData(tmp, recvlen);
}
-#endif
+ else
+ {
+ close();
+ }
+
delete [] tmp;
}
void TCPSocket::open() {
-#if TIKI_PLAT == TIKI_OSX
-#else
struct sockaddr_in sock_addr;
m_socket = socket(AF_INET, SOCK_STREAM, 0);
if(m_socket == INVALID_SOCKET) {
Tiki::Debug::printf("Error opening socket\n");
+ m_open = false;
return;
}
+
int yes = 1;
+ Tiki::Debug::printf("setting TCP_NODELAY\n");
+ setsockopt(m_socket, IPPROTO_TCP, TCP_NODELAY, (char *)&yes, sizeof(yes));
+
#if TIKI_PLAT != TIKI_WIN32
if(isReuse()) {
Tiki::Debug::printf("setting reuse flag\n");
@@ -78,9 +84,10 @@
}
#endif
- if(!(getLocalAddress()->getIPAddress() == Address::AddressAny ||
- getLocalAddress()->getIPAddress() == Address::AddressNone ||
- getLocalAddress()->getIPAddress() == Address::AddressBroadcast)) {
+ if(getPeerAddress() != NULL &&
+ !(getPeerAddress()->getIPAddress() == Address::AddressAny ||
+ getPeerAddress()->getIPAddress() == Address::AddressNone ||
+ getPeerAddress()->getIPAddress() == Address::AddressBroadcast)) {
// connecting to remote address
memset(&sock_addr, 0, sizeof(struct sockaddr_in));
sock_addr.sin_family = AF_INET;
@@ -94,36 +101,44 @@
}
Tiki::Debug::printf("Connected..\n");
}
-
- Tiki::Debug::printf("setting TCP_NODELAY\n");
- setsockopt(m_socket, IPPROTO_TCP, TCP_NODELAY, (char *)&yes, sizeof(yes));
-
- if(isNonBlocking()) {
- Tiki::Debug::printf("setting NO BLOCKING mode\n");
-#if TIKI_PLAT == TIKI_WIN32
- unsigned long mode = 1;
- ioctlsocket(m_socket, FIONBIO, &mode);
-#else
- fcntl(m_socket, F_SETFL, O_NONBLOCK);
-#endif
- }
-#endif
+ m_open = true;
}
void TCPSocket::close() {
+ m_open = false;
Tiki::Debug::printf("closing socket\n");
-#if TIKI_PLAT == TIKI_OSX
-#elif TIKI_PLAT == TIKI_WIN32
+#if TIKI_PLAT == TIKI_WIN32
if(m_socket != INVALID_SOCKET) {
closesocket(m_socket);
}
#else
if(m_socket != INVALID_SOCKET) {
::close(m_socket);
- }
+ }
#endif
}
+void TCPSocket::setNonBlocking(bool blocking)
+{
+ Tiki::Debug::printf("%sabling blocking\n", blocking ? "dis" : "en" );
+ Socket::setNonBlocking(blocking);
+#if TIKI_PLAT == TIKI_WIN32
+ unsigned long mode = (!blocking);
+ ioctlsocket(m_socket, FIONBIO, &mode);
+#else
+ int flags = fcntl(m_socket, F_GETFL, 0);
+ if(!blocking)
+ {
+ fcntl(m_socket, F_SETFL, flags & ~O_NONBLOCK);
+ }
+ else
+ {
+ fcntl(m_socket, F_SETFL, flags & ~O_NONBLOCK);
+ }
+#endif
+
+}
+
} // namespace TCP
} // namespace Net
Modified: tiki/win32/include/Tiki/platnet.h
===================================================================
--- tiki/win32/include/Tiki/platnet.h 2007-08-21 04:55:20 UTC (rev 478)
+++ tiki/win32/include/Tiki/platnet.h 2007-08-21 08:30:14 UTC (rev 479)
@@ -1,3 +1,14 @@
+/*
+ Tiki
+
+ platnet.h
+
+ Copyright (C)2007 Atani Software
+*/
+
+#ifndef TIKI_PLATFORM_NET_H
+#define TIKI_PLATFORM_NET_H
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -3,3 +14,5 @@
#include <fcntl.h>
-#include <winsock2.h>
\ No newline at end of file
+#include <winsock2.h>
+
+#endif // TIKI_PLATFORM_NET_H
Modified: tiki/win32/src/platnet.cpp
===================================================================
--- tiki/win32/src/platnet.cpp 2007-08-21 04:55:20 UTC (rev 478)
+++ tiki/win32/src/platnet.cpp 2007-08-21 08:30:14 UTC (rev 479)
@@ -8,7 +8,7 @@
#include "pch.h"
#include "Tiki/tiki.h"
-#include "Tiki/net/net.h"
+#include "Tiki/net.h"
namespace Tiki {
Modified: tiki/win32/tiki_vc80.sln
===================================================================
--- tiki/win32/tiki_vc80.sln 2007-08-21 04:55:20 UTC (rev 478)
+++ tiki/win32/tiki_vc80.sln 2007-08-21 08:30:14 UTC (rev 479)
@@ -18,6 +18,16 @@
{F2816CAC-B560-4ED9-8A73-9635F832943C} = {F2816CAC-B560-4ED9-8A73-9635F832943C}
EndProjectSection
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ChatClient", "..\examples\net\chat\chat.vcproj", "{7B823C96-860C-4578-95DD-1087A45AF1AA}"
+ ProjectSection(ProjectDependencies) = postProject
+ {F2816CAC-B560-4ED9-8A73-9635F832943C} = {F2816CAC-B560-4ED9-8A73-9635F832943C}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ChatServer", "..\examples\net\chatd\chatd.vcproj", "{7B823C96-860C-4578-95EE-1087A45AF1AA}"
+ ProjectSection(ProjectDependencies) = postProject
+ {F2816CAC-B560-4ED9-8A73-9635F832943C} = {F2816CAC-B560-4ED9-8A73-9635F832943C}
+ EndProjectSection
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
@@ -40,6 +50,14 @@
{7B823C96-860C-4578-95CC-1087A45AF1AA}.Debug|Win32.Build.0 = Debug|Win32
{7B823C96-860C-4578-95CC-1087A45AF1AA}.Release|Win32.ActiveCfg = Release|Win32
{7B823C96-860C-4578-95CC-1087A45AF1AA}.Release|Win32.Build.0 = Release|Win32
+ {7B823C96-860C-4578-95DD-1087A45AF1AA}.Debug|Win32.ActiveCfg = Debug|Win32
+ {7B823C96-860C-4578-95DD-1087A45AF1AA}.Debug|Win32.Build.0 = Debug|Win32
+ {7B823C96-860C-4578-95DD-1087A45AF1AA}.Release|Win32.ActiveCfg = Release|Win32
+ {7B823C96-860C-4578-95DD-1087A45AF1AA}.Release|Win32.Build.0 = Release|Win32
+ {7B823C96-860C-4578-95EE-1087A45AF1AA}.Debug|Win32.ActiveCfg = Debug|Win32
+ {7B823C96-860C-4578-95EE-1087A45AF1AA}.Debug|Win32.Build.0 = Debug|Win32
+ {7B823C96-860C-4578-95EE-1087A45AF1AA}.Release|Win32.ActiveCfg = Release|Win32
+ {7B823C96-860C-4578-95EE-1087A45AF1AA}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <at...@us...> - 2007-08-21 16:14:16
|
Revision: 481
http://cadcdev.svn.sourceforge.net/cadcdev/?rev=481&view=rev
Author: atani
Date: 2007-08-21 09:14:06 -0700 (Tue, 21 Aug 2007)
Log Message:
-----------
code cleanup and fixes for chat[d] on linux
Modified Paths:
--------------
tiki/examples/net/chat/Makefile
tiki/examples/net/chat/src/main.cpp
tiki/examples/net/chatd/Makefile
tiki/examples/net/chatd/src/main.cpp
tiki/include/Tiki/net/tcpsocket.h
tiki/sdl/src/platnet.cpp
tiki/src/net/tcpserversocket.cpp
tiki/src/net/tcpsocket.cpp
Modified: tiki/examples/net/chat/Makefile
===================================================================
--- tiki/examples/net/chat/Makefile 2007-08-21 08:33:49 UTC (rev 480)
+++ tiki/examples/net/chat/Makefile 2007-08-21 16:14:06 UTC (rev 481)
@@ -4,10 +4,10 @@
OBJS = $(patsubst %.cpp,%.o,$(wildcard src/*.cpp))
all: $(OBJS)
- $(CXX) $(LDFLAGS) -L$(TIKI_DIR)$(TIKI_PLAT) -L$(TIKI_DIR)$(TIKI_PLAT)/lib $(OBJS) $(TIKI_BASE_LIBS) -o basic
+ $(CXX) $(LDFLAGS) -L$(TIKI_DIR)$(TIKI_PLAT) -L$(TIKI_DIR)$(TIKI_PLAT)/lib $(OBJS) $(TIKI_BASE_LIBS) -o chat
clean:
- -rm -f $(OBJS) basic
+ -rm -f $(OBJS) chat
DEPSDIR=$(CURDIR)
include $(TIKI_DIR)$(TIKI_PLAT)/Makefile.rules
Modified: tiki/examples/net/chat/src/main.cpp
===================================================================
--- tiki/examples/net/chat/src/main.cpp 2007-08-21 08:33:49 UTC (rev 480)
+++ tiki/examples/net/chat/src/main.cpp 2007-08-21 16:14:06 UTC (rev 481)
@@ -8,6 +8,7 @@
#include <Tiki/tiki.h>
#include <Tiki/refcnt.h>
+#include <Tiki/hid.h>
#include <Tiki/tikitime.h>
#include <Tiki/net.h>
@@ -17,11 +18,48 @@
using namespace Tiki::Net::TCP;
using namespace Tiki::Time;
+RefPtr<TCPSocket> g_remoteconn;
+std::string g_tmpbuf;
+
+volatile bool g_quitting = false;
+void tkCallback( const Hid::Event & evt, void * data ) {
+ if ( evt.type == Hid::Event::EvtQuit ) {
+ g_quitting = true;
+ }
+ else if ( evt.type == Hid::Event::EvtKeyDown) {
+ g_tmpbuf.push_back((char)evt.key);
+ if(evt.key == '\n' || evt.key == '\r') {
+ RefPtr<Buffer> buf = new Buffer(g_tmpbuf.size());
+ buf->setData((uint8 *)g_tmpbuf.c_str(), g_tmpbuf.size());
+ g_remoteconn->send(buf);
+ g_tmpbuf = "";
+ }
+ }
+}
+
extern "C" int tiki_main( int argc, char **argv) {
-
Tiki::init(argc, argv);
Tiki::Net::init();
+ Hid::callbackReg( tkCallback, NULL );
+ RefPtr<Address> remote = new Address();
+ remote->setHostName("localhost");
+ remote->setPort(5555);
+ g_remoteconn = new TCPSocket(remote);
+
+ g_remoteconn->open();
+ RefPtr<Buffer> buf = new Buffer(1024);
+ while(g_remoteconn->isOpen() && !g_quitting) {
+ buf->reset();
+ g_remoteconn->recv(buf);
+ if(buf->getUsedDataLen() > 0)
+ {
+ Tiki::Debug::printf("%s", buf->getData());
+ }
+ }
+
+ g_remoteconn->close();
+
Tiki::Net::shutdown();
return 0;
}
Modified: tiki/examples/net/chatd/Makefile
===================================================================
--- tiki/examples/net/chatd/Makefile 2007-08-21 08:33:49 UTC (rev 480)
+++ tiki/examples/net/chatd/Makefile 2007-08-21 16:14:06 UTC (rev 481)
@@ -4,10 +4,10 @@
OBJS = $(patsubst %.cpp,%.o,$(wildcard src/*.cpp))
all: $(OBJS)
- $(CXX) $(LDFLAGS) -L$(TIKI_DIR)$(TIKI_PLAT) -L$(TIKI_DIR)$(TIKI_PLAT)/lib $(OBJS) $(TIKI_BASE_LIBS) -o basic
+ $(CXX) $(LDFLAGS) -L$(TIKI_DIR)$(TIKI_PLAT) -L$(TIKI_DIR)$(TIKI_PLAT)/lib $(OBJS) $(TIKI_BASE_LIBS) -o chatd
clean:
- -rm -f $(OBJS) basic
+ -rm -f $(OBJS) chatd
DEPSDIR=$(CURDIR)
include $(TIKI_DIR)$(TIKI_PLAT)/Makefile.rules
Modified: tiki/examples/net/chatd/src/main.cpp
===================================================================
--- tiki/examples/net/chatd/src/main.cpp 2007-08-21 08:33:49 UTC (rev 480)
+++ tiki/examples/net/chatd/src/main.cpp 2007-08-21 16:14:06 UTC (rev 481)
@@ -72,24 +72,23 @@
{
socket->send(line);
}
- else
+ else if(line->getUsedDataLen() < 0)
{
+ Tiki::Debug::printf("socket error, closing connection\n");
socket->close();
return NULL;
}
if(line->getData()[0] == '/')
{
uint8 *data = line->getData();
- data[line->getUsedDataLen() - 1] = '\0';
- data[line->getUsedDataLen() - 2] = '\0';
string cmd = "";
- for(int i = 1; i < line->getUsedDataLen() - 2; i++)
+ for(int i = 0; i < line->getUsedDataLen(); i++)
{
cmd.push_back(data[i]);
}
Tiki::Debug::printf("cmd: %s\n", cmd.c_str());
- std::map<std::string, void (*)( TCPSocket * )>::const_iterator i =
- g_commandHandlers.find( cmd );
+ std::map<std::string, void (*)( TCPSocket * )>::const_iterator i =
+ g_commandHandlers.find( cmd );
if( i != g_commandHandlers.end() ){
i->second(socket);
}
@@ -101,6 +100,9 @@
}
}
}
+ Tiki::Debug::printf("isOpen: %s\n", socket->isOpen() ? "true" : "false");
+ Tiki::Debug::printf("quitting: %s\n", quitting ? "true" : "false");
+
Tiki::Debug::printf("Closing connection from: %s\n",
socket->getPeerAddress()->getIPAddressString().c_str());
socket->close();
@@ -108,6 +110,7 @@
}
extern "C" int tiki_main( int argc, char **argv) {
+ Tiki::init(argc, argv);
Tiki::Net::init();
Hid::callbackReg( tkCallback, NULL );
Modified: tiki/include/Tiki/net/tcpsocket.h
===================================================================
--- tiki/include/Tiki/net/tcpsocket.h 2007-08-21 08:33:49 UTC (rev 480)
+++ tiki/include/Tiki/net/tcpsocket.h 2007-08-21 16:14:06 UTC (rev 481)
@@ -35,7 +35,7 @@
#if TIKI_PLAT == TIKI_WIN32
TCPSocket(RefPtr<Address> address, SOCKET socket) : Socket(address), m_socket(socket), m_open(true) {setNonBlocking(false);};
#else
- TCPSocket(RefPtr<Address> address, int socket) : Socket(address), m_socket(socket) {setNonBlocking(false);};
+ TCPSocket(RefPtr<Address> address, int socket) : Socket(address), m_socket(socket), m_open(true) {setNonBlocking(false);};
#endif
virtual void send(RefPtr<Buffer> data);
Modified: tiki/sdl/src/platnet.cpp
===================================================================
--- tiki/sdl/src/platnet.cpp 2007-08-21 08:33:49 UTC (rev 480)
+++ tiki/sdl/src/platnet.cpp 2007-08-21 16:14:06 UTC (rev 481)
@@ -7,7 +7,7 @@
*/
#include "Tiki/tiki.h"
-#include "Tiki/net/net.h"
+#include "Tiki/net.h"
namespace Tiki {
Modified: tiki/src/net/tcpserversocket.cpp
===================================================================
--- tiki/src/net/tcpserversocket.cpp 2007-08-21 08:33:49 UTC (rev 480)
+++ tiki/src/net/tcpserversocket.cpp 2007-08-21 16:14:06 UTC (rev 481)
@@ -1,28 +1,28 @@
-/*
- Tiki
-
- tcpserversocket.cpp
-
- Copyright (C)2007 Atani Software
-*/
-
-#include "pch.h"
-#include "Tiki/tiki.h"
-#include "Tiki/net.h"
-
-namespace Tiki {
-
-namespace Net {
-
-namespace TCP {
-
-void TCPServerSocket::bind(size_t maxwaiting)
-{
- struct sockaddr_in sock_addr;
-
- memset(&sock_addr, 0, sizeof(sock_addr));
- sock_addr.sin_family = AF_INET;
- sock_addr.sin_addr.s_addr = INADDR_ANY;
+/*
+ Tiki
+
+ tcpserversocket.cpp
+
+ Copyright (C)2007 Atani Software
+*/
+
+#include "pch.h"
+#include "Tiki/tiki.h"
+#include "Tiki/net.h"
+
+namespace Tiki {
+
+namespace Net {
+
+namespace TCP {
+
+void TCPServerSocket::bind(size_t maxwaiting)
+{
+ struct sockaddr_in sock_addr;
+
+ memset(&sock_addr, 0, sizeof(sock_addr));
+ sock_addr.sin_family = AF_INET;
+ sock_addr.sin_addr.s_addr = INADDR_ANY;
sock_addr.sin_port = htons(getPort());
if(isNonBlocking()) {
@@ -34,44 +34,48 @@
fcntl(m_socket, F_SETFL, O_NONBLOCK);
#endif
}
-
-
- /* Bind the socket for listening */
- if ( ::bind(m_socket, (struct sockaddr *)&sock_addr,
- sizeof(sock_addr)) == SOCKET_ERROR ) {
- Tiki::Debug::printf("Couldn't bind to local port\n");
- close();
- return;
- }
- if ( listen(m_socket, (int)maxwaiting) == SOCKET_ERROR ) {
- Tiki::Debug::printf("Couldn't listen to local port\n");
- close();
- return;
- }
-}
-
-RefPtr<TCPSocket> TCPServerSocket::accept()
-{
- struct sockaddr_in sock_addr;
-#if TIKI_PLAT == TIKI_WIN32
- SOCKET socket;
-#else
- int socket;
-#endif
-
- size_t addrlen = sizeof(struct sockaddr_in);
- socket = ::accept(m_socket, (sockaddr *)&sock_addr, (int *)&addrlen);
-
- if(socket != INVALID_SOCKET) {
- RefPtr<Address> remote = new Address();
- remote->setIPAddress(sock_addr.sin_addr.s_addr);
- return new TCPSocket(remote, socket);
- }
- return NULL;
-}
-
-} // namespace TCP
-
-} // namespace Net
-
-} // namespace Tiki
+
+
+ /* Bind the socket for listening */
+ if ( ::bind(m_socket, (struct sockaddr *)&sock_addr,
+ sizeof(sock_addr)) == SOCKET_ERROR ) {
+ Tiki::Debug::printf("Couldn't bind to local port\n");
+ close();
+ return;
+ }
+ if ( listen(m_socket, (int)maxwaiting) == SOCKET_ERROR ) {
+ Tiki::Debug::printf("Couldn't listen to local port\n");
+ close();
+ return;
+ }
+}
+
+RefPtr<TCPSocket> TCPServerSocket::accept()
+{
+ struct sockaddr_in sock_addr;
+#if TIKI_PLAT == TIKI_WIN32
+ SOCKET socket;
+#else
+ int socket;
+#endif
+
+ size_t addrlen = sizeof(struct sockaddr_in);
+#if TIKI_PLAT == TIKI_SDL
+ socket = ::accept(m_socket, (sockaddr *)&sock_addr, (socklen_t *)&addrlen);
+#else
+ socket = ::accept(m_socket, (sockaddr *)&sock_addr, (int *)&addrlen);
+#endif
+
+ if(socket != INVALID_SOCKET) {
+ RefPtr<Address> remote = new Address();
+ remote->setIPAddress(sock_addr.sin_addr.s_addr);
+ return new TCPSocket(remote, socket);
+ }
+ return NULL;
+}
+
+} // namespace TCP
+
+} // namespace Net
+
+} // namespace Tiki
Modified: tiki/src/net/tcpsocket.cpp
===================================================================
--- tiki/src/net/tcpsocket.cpp 2007-08-21 08:33:49 UTC (rev 480)
+++ tiki/src/net/tcpsocket.cpp 2007-08-21 16:14:06 UTC (rev 481)
@@ -31,11 +31,7 @@
dataLen -= len;
data += len;
}
- else {
- Tiki::Debug::printf("sent %d bytes\n", len);
- }
} while(dataLen > 0 && (len > 0 || errno == EINTR));
- Tiki::Debug::printf("errno: %d [%x]\n", errno, errno);
}
void TCPSocket::recv(RefPtr<Buffer> data) {
@@ -43,7 +39,7 @@
memset(tmp, 0, data->getDataLen());
int recvlen = 0;
errno = 0;
- Tiki::Debug::printf("receiving %d bytes\n", data->getDataLen());
+ //Tiki::Debug::printf("receiving %d bytes\n", data->getDataLen());
do {
recvlen = ::recv(m_socket, (char *)tmp, (int)data->getDataLen(), 0);
#if TIKI_PLAT == TIKI_WIN32
@@ -51,12 +47,12 @@
#else
} while(errno == EINTR);
#endif
- Tiki::Debug::printf("received %d bytes\nerrno %d\n", recvlen, errno);
if(recvlen > 0) {
+ //Tiki::Debug::printf("received %d bytes\nerrno %d\n", recvlen, errno);
data->setData(tmp, recvlen);
}
- else
- {
+ else if(recvlen < 0) {
+ Tiki::Debug::printf("socket error, closing socket");
close();
}
@@ -122,19 +118,19 @@
{
Tiki::Debug::printf("%sabling blocking\n", blocking ? "dis" : "en" );
Socket::setNonBlocking(blocking);
-#if TIKI_PLAT == TIKI_WIN32
- unsigned long mode = (!blocking);
- ioctlsocket(m_socket, FIONBIO, &mode);
-#else
- int flags = fcntl(m_socket, F_GETFL, 0);
- if(!blocking)
- {
- fcntl(m_socket, F_SETFL, flags & ~O_NONBLOCK);
- }
- else
- {
- fcntl(m_socket, F_SETFL, flags & ~O_NONBLOCK);
- }
+#if TIKI_PLAT == TIKI_WIN32
+ unsigned long mode = (!blocking);
+ ioctlsocket(m_socket, FIONBIO, &mode);
+#else
+ int flags = fcntl(m_socket, F_GETFL, 0);
+ if(!blocking)
+ {
+ fcntl(m_socket, F_SETFL, flags & ~O_NONBLOCK);
+ }
+ else
+ {
+ fcntl(m_socket, F_SETFL, flags | O_NONBLOCK);
+ }
#endif
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <at...@us...> - 2007-08-21 23:56:18
|
Revision: 482
http://cadcdev.svn.sourceforge.net/cadcdev/?rev=482&view=rev
Author: atani
Date: 2007-08-21 16:56:11 -0700 (Tue, 21 Aug 2007)
Log Message:
-----------
Tiki::Net::Http implementation for GET
Modified Paths:
--------------
tiki/include/Tiki/net/buffer.h
tiki/sdl/Makefile
Added Paths:
-----------
tiki/examples/net/httpclient/
tiki/examples/net/httpclient/Makefile
tiki/examples/net/httpclient/httpclient.vcproj
tiki/examples/net/httpclient/src/
tiki/examples/net/httpclient/src/HttpClient.cpp
tiki/examples/net/httpclient/src/main.cpp
tiki/include/Tiki/net/http/
tiki/include/Tiki/net/http/cookie.h
tiki/include/Tiki/net/http/request.h
tiki/include/Tiki/net/http/response.h
tiki/include/Tiki/net/http/useragent.h
tiki/src/net/http/
tiki/src/net/http/request.cpp
tiki/src/net/http/response.cpp
tiki/src/net/http/useragent.cpp
Added: tiki/examples/net/httpclient/Makefile
===================================================================
--- tiki/examples/net/httpclient/Makefile (rev 0)
+++ tiki/examples/net/httpclient/Makefile 2007-08-21 23:56:11 UTC (rev 482)
@@ -0,0 +1,13 @@
+
+TIKI_DIR=../../../
+CFLAGS=-I$(TIKI_DIR)$(TIKI_PLAT)/include -I$(TIKI_DIR)include
+OBJS = $(patsubst %.cpp,%.o,$(wildcard src/*.cpp))
+
+all: $(OBJS)
+ $(CXX) $(LDFLAGS) -L$(TIKI_DIR)$(TIKI_PLAT) -L$(TIKI_DIR)$(TIKI_PLAT)/lib $(OBJS) $(TIKI_BASE_LIBS) -o httpclient
+
+clean:
+ -rm -f $(OBJS) httpclient
+
+DEPSDIR=$(CURDIR)
+include $(TIKI_DIR)$(TIKI_PLAT)/Makefile.rules
Added: tiki/examples/net/httpclient/httpclient.vcproj
===================================================================
--- tiki/examples/net/httpclient/httpclient.vcproj (rev 0)
+++ tiki/examples/net/httpclient/httpclient.vcproj 2007-08-21 23:56:11 UTC (rev 482)
@@ -0,0 +1,205 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="HttpClient"
+ ProjectGUID="{7B823C96-861C-4578-95FF-1087A45AF1AA}"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(ProjectDir)\..\..\..\win32\include;$(ProjectDir)\..\..\..\include;"C:\Program Files\OpenAL 1.1 SDK\include""
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;"
+ 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="gdi32.lib kernel32.lib user32.lib opengl32.lib glu32.lib comdlg32.lib ws2_32.lib"
+ LinkIncremental="2"
+ AdditionalLibraryDirectories="$(ProjectDir)\..\..\..\win32\Debug;"C:\Program Files\OpenAL 1.1 SDK\libs\Win32""
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="$(ProjectDir)\..\..\..\win32\include;$(ProjectDir)\..\..\..\include;"C:\Program Files\OpenAL 1.1 SDK\include""
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;"
+ RuntimeLibrary="0"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="gdi32.lib kernel32.lib user32.lib opengl32.lib glu32.lib comdlg32.lib ws2_32.lib"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories="$(ProjectDir)\..\..\..\win32\Release;C:\Program Files\OpenAL 1.1 SDK\libs\Win32"
+ IgnoreDefaultLibraryNames=""
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+ >
+ </Filter>
+ <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\ChatClient.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\src\main.cpp"
+ >
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
Added: tiki/examples/net/httpclient/src/HttpClient.cpp
===================================================================
--- tiki/examples/net/httpclient/src/HttpClient.cpp (rev 0)
+++ tiki/examples/net/httpclient/src/HttpClient.cpp 2007-08-21 23:56:11 UTC (rev 482)
@@ -0,0 +1,27 @@
+/*
+* HttpClient.cpp
+* HttpClient
+*
+* Copyright (C)2007 Atani Software
+*
+*/
+
+#include <Tiki/tiki.h>
+#include <pch.h>
+
+#if TIKI_PLAT == TIKI_WIN32
+#include <windows.h>
+
+static char szAppName[] = "HttpClient";
+int APIENTRY WinMain( HINSTANCE hInst, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow )
+#else
+extern "C" int tiki_main( int argc, char *argv[] );
+int main( int argc, char *argv[] )
+#endif
+{
+#if TIKI_PLAT != TIKI_WIN32
+ return tiki_main( argc, argv );
+#else
+ return Tiki::DoMain( szAppName, hInst, hPrevInstance, lpCmdLine, nCmdShow );
+#endif
+}
Added: tiki/examples/net/httpclient/src/main.cpp
===================================================================
--- tiki/examples/net/httpclient/src/main.cpp (rev 0)
+++ tiki/examples/net/httpclient/src/main.cpp 2007-08-21 23:56:11 UTC (rev 482)
@@ -0,0 +1,61 @@
+/*
+* main.cpp
+* Simple Http Client Main method
+*
+* Copyright (C)2007 Atani Software
+*
+*/
+
+#include <Tiki/tiki.h>
+#include <Tiki/refcnt.h>
+#include <Tiki/hid.h>
+#include <Tiki/tikitime.h>
+#include <Tiki/net.h>
+#include <Tiki/net/http/useragent.h>
+#include <Tiki/net/http/request.h>
+
+using namespace Tiki;
+using namespace Tiki::Debug;
+using namespace Tiki::Net;
+using namespace Tiki::Net::Http;
+
+volatile bool g_quitting = false;
+void tkCallback( const Hid::Event & evt, void * data ) {
+ if ( evt.type == Hid::Event::EvtQuit ) {
+ g_quitting = true;
+ }
+}
+
+extern "C" int tiki_main( int argc, char **argv) {
+ Tiki::init(argc, argv);
+ Tiki::Net::init();
+ Hid::callbackReg( tkCallback, NULL );
+
+ if(argc < 2) {
+ Tiki::Debug::printf("Need to pass request url on commandline\n");
+ return -1;
+ }
+
+ RefPtr<HttpUserAgent> useragent = new HttpUserAgent();
+ useragent->setProxyHost("www-proxy.us.oracle.com");
+ useragent->setProxyPort(80);
+
+ RefPtr<Request> request = new Request();
+ request->setUrl(argv[1]);
+
+ RefPtr<Response> response = useragent->get(request);
+ Tiki::Debug::printf("response code: %d\n", response->getResultCode());
+
+ std::list<std::string> content = response->getContentPartNames();
+ for(std::list<std::string>::iterator iter = content.begin();
+ iter != content.end();
+ ++iter)
+ {
+ RefPtr<Buffer> responseBuf = response->getContentPart(*iter);
+ Tiki::Debug::printf("Content Part: %s [%u bytes]\n", (*iter).c_str(), responseBuf->getUsedDataLen());
+ }
+
+
+ Tiki::Net::shutdown();
+ return 0;
+}
Modified: tiki/include/Tiki/net/buffer.h
===================================================================
--- tiki/include/Tiki/net/buffer.h 2007-08-21 16:14:06 UTC (rev 481)
+++ tiki/include/Tiki/net/buffer.h 2007-08-21 23:56:11 UTC (rev 482)
@@ -21,14 +21,26 @@
m_data = new uint8[len];
memset(m_data, 0, len);
m_dataLen = len;
+ m_usedDataLen = 0;
}
Buffer(size_t len, uint8 *data) {
m_data = new uint8[len];
memset(m_data, 0, len);
m_dataLen = len;
+ m_usedDataLen = len;
memcpy(m_data, data, len);
}
+ void append(RefPtr<Buffer> buf) {
+ uint8 * newbuf = new uint8[ m_dataLen + buf->getDataLen() ];
+ memcpy(newbuf, m_data, m_usedDataLen);
+ memcpy(newbuf + m_usedDataLen, buf->getData(), buf->getUsedDataLen());
+ delete [] m_data;
+ m_data = newbuf;
+ m_dataLen += buf->getDataLen();
+ m_usedDataLen += buf->getUsedDataLen();
+ }
+
void reset() {
memset(m_data, 0, m_dataLen);
m_usedDataLen = 0;
Added: tiki/include/Tiki/net/http/cookie.h
===================================================================
--- tiki/include/Tiki/net/http/cookie.h (rev 0)
+++ tiki/include/Tiki/net/http/cookie.h 2007-08-21 23:56:11 UTC (rev 482)
@@ -0,0 +1,72 @@
+/*
+ Tiki
+
+ useragent.h
+
+ Copyright (C)2007 Atani Software
+*/
+#ifndef __TIKI_NET_HTTP_COOKIE_H
+#define __TIKI_NET_HTTP_COOKIE_H
+
+#include "Tiki/refcnt.h"
+
+namespace Tiki {
+
+namespace Net {
+
+namespace Http {
+
+class Cookie : public RefCnt {
+
+ public:
+ Cookie( std::string name, std::string value, std::string version,
+ std::string comment = "", long maxage = 0, std::string path = "",
+ bool secure = false) :
+ m_name(name), m_value(value), m_version(version), m_comment(comment),
+ m_maxage(maxage), m_path(path), m_secure(secure) {};
+
+ std::string getName() const {
+ return m_name;
+ }
+
+ std::string getValue() const {
+ return m_value;
+ }
+
+ std::string getVersion() const {
+ return m_version;
+ }
+
+ std::string getComment() const {
+ return m_comment;
+ }
+
+ std::string getPath() const {
+ return m_path;
+ }
+
+ long getMaxAge() const {
+ return m_maxage;
+ }
+
+ bool isSecure() {
+ return m_secure;
+ }
+ private:
+ std::string m_name;
+ std::string m_value;
+ std::string m_version;
+ std::string m_comment;
+ long m_maxage;
+ std::string m_path;
+ bool m_secure;
+};
+
+
+}; // namespace Http
+
+}; // namespace Net
+
+}; // namespace Tiki
+
+#endif // __TIKI_NET_HTTP_COOKIE_H
Added: tiki/include/Tiki/net/http/request.h
===================================================================
--- tiki/include/Tiki/net/http/request.h (rev 0)
+++ tiki/include/Tiki/net/http/request.h 2007-08-21 23:56:11 UTC (rev 482)
@@ -0,0 +1,55 @@
+/*
+ Tiki
+
+ useragent.h
+
+ Copyright (C)2007 Atani Software
+*/
+#ifndef __TIKI_NET_HTTP_REQUEST_H
+#define __TIKI_NET_HTTP_REQUEST_H
+
+#include "Tiki/refcnt.h"
+
+namespace Tiki {
+
+namespace Net {
+
+namespace Http {
+
+extern std::string DEFAULT_CONTENT_PART;
+
+class Request : public RefCnt {
+ public:
+ Request();
+
+ std::string getUrl() const {
+ return m_url;
+ }
+
+ void setUrl(string url) {
+ m_url = url;
+ }
+
+ void setHeaderParam(std::string param, std::string value);
+ std::string getHeaderParam(std::string param) const;
+ std::list<std::string> getHeaderParamNames() const;
+
+ void addContentPart(std::string name, RefPtr<Buffer> input);
+ std::list<std::string> getContentPartNames() const;
+ RefPtr<Buffer> getContentPart(std::string name) const;
+
+ private:
+ std::string m_url;
+ typedef std::map<std::string, std::string> StringStringMap;
+ typedef std::map<std::string, RefPtr< Buffer > > StringBufferMap;
+ StringStringMap m_params;
+ StringBufferMap m_parts;
+};
+
+}; // namespace Http
+
+}; // namespace Net
+
+}; // namespace Tiki
+
+#endif // __TIKI_NET_HTTP_REQUEST_H
Added: tiki/include/Tiki/net/http/response.h
===================================================================
--- tiki/include/Tiki/net/http/response.h (rev 0)
+++ tiki/include/Tiki/net/http/response.h 2007-08-21 23:56:11 UTC (rev 482)
@@ -0,0 +1,37 @@
+/*
+ Tiki
+
+ useragent.h
+
+ Copyright (C)2007 Atani Software
+*/
+#ifndef __TIKI_NET_HTTP_RESPONSE_H
+#define __TIKI_NET_HTTP_RESPONSE_H
+
+namespace Tiki {
+
+namespace Net {
+
+namespace Http {
+
+class Response : public Request {
+ public:
+ Response();
+
+ int getResultCode() const {
+ return m_resultCode;
+ }
+ void setResultCode(int code) {
+ m_resultCode = code;
+ }
+ private:
+ int m_resultCode;
+};
+
+}; // namespace Http
+
+}; // namespace Net
+
+}; // namespace Tiki
+
+#endif // __TIKI_NET_HTTP_RESPONSE_H
Added: tiki/include/Tiki/net/http/useragent.h
===================================================================
--- tiki/include/Tiki/net/http/useragent.h (rev 0)
+++ tiki/include/Tiki/net/http/useragent.h 2007-08-21 23:56:11 UTC (rev 482)
@@ -0,0 +1,74 @@
+/*
+ Tiki
+
+ useragent.h
+
+ Copyright (C)2007 Atani Software
+*/
+#ifndef __TIKI_NET_HTTP_USERAGENT_H
+#define __TIKI_NET_HTTP_USERAGENT_H
+
+#include "Tiki/refcnt.h"
+#include "Tiki/net/http/cookie.h"
+#include "Tiki/net/http/request.h"
+#include "Tiki/net/http/response.h"
+
+namespace Tiki {
+
+namespace Net {
+
+namespace Http {
+
+class HttpUserAgent : public RefCnt {
+
+ public:
+ HttpUserAgent();
+
+ void setUserAgentName(std::string name) {
+ m_userAgentName = name;
+ }
+
+ std::string getUserAgentName() const {
+ return m_userAgentName;
+ }
+
+ void setProxyHost(std::string host) {
+ m_proxyHost = host;
+ }
+
+ std::string getProxyHost() const {
+ return m_proxyHost;
+ }
+
+ void setProxyPort(int port) {
+ m_proxyPort = port;
+ }
+
+ int getProxyPort() const {
+ return m_proxyPort;
+ }
+
+ std::list< RefPtr< Cookie > > getCookies() const {
+ return m_cookies;
+ }
+
+ RefPtr<Response> get(RefPtr<Request> req) const;
+
+ RefPtr<Response> post(RefPtr<Request> req) const;
+
+ private:
+ std::string m_userAgentName;
+ std::string m_proxyHost;
+ int m_proxyPort;
+ std::list< RefPtr< Cookie > > m_cookies;
+
+
+};
+
+}; // namespace Http
+
+}; // namespace Net
+
+}; // namespace Tiki
+
+#endif // __TIKI_NET_HTTP_USERAGENT_H
Modified: tiki/sdl/Makefile
===================================================================
--- tiki/sdl/Makefile 2007-08-21 16:14:06 UTC (rev 481)
+++ tiki/sdl/Makefile 2007-08-21 23:56:11 UTC (rev 482)
@@ -11,6 +11,7 @@
BASE_MATH_OBJ=$(patsubst %.cpp,%.o,$(wildcard ../src/math/*.cpp))
BASE_THREAD_OBJ=$(patsubst %.cpp,%.o,$(wildcard ../src/thread/*.cpp))
BASE_NET_OBJ=$(patsubst %.cpp,%.o,$(wildcard ../src/net/*.cpp))
+BASE_NET_OBJ+=$(patsubst %.cpp,%.o,$(wildcard ../src/net/http/*.cpp))
JPEG_OBJ=$(patsubst %.c,%.o,$(wildcard ../3rdparty/libjpeg/*.c))
PNG_OBJ=$(patsubst %.c,%.o,$(wildcard ../3rdparty/libpng/*.c))
@@ -58,6 +59,10 @@
examples:
$(MAKE) TIKI_PLAT=sdl TIKI_DIR=$(CURDIR)/../ -C$(CURDIR)/../examples/TikiTest
$(MAKE) TIKI_PLAT=sdl TIKI_DIR=$(CURDIR)/../ -C$(CURDIR)/../examples/console/TikiSnake
+ $(MAKE) TIKI_PLAT=sdl TIKI_DIR=$(CURDIR)/../ -C$(CURDIR)/../examples/net/basic
+ $(MAKE) TIKI_PLAT=sdl TIKI_DIR=$(CURDIR)/../ -C$(CURDIR)/../examples/net/chatd
+ $(MAKE) TIKI_PLAT=sdl TIKI_DIR=$(CURDIR)/../ -C$(CURDIR)/../examples/net/chat
+ $(MAKE) TIKI_PLAT=sdl TIKI_DIR=$(CURDIR)/../ -C$(CURDIR)/../examples/net/httpclient
package:
tar -cvf ../dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-sdl.tar libtiki.a
Added: tiki/src/net/http/request.cpp
===================================================================
--- tiki/src/net/http/request.cpp (rev 0)
+++ tiki/src/net/http/request.cpp 2007-08-21 23:56:11 UTC (rev 482)
@@ -0,0 +1,87 @@
+/*
+ Tiki
+
+ request.cpp
+
+ Copyright (C)2007 Atani Software
+*/
+
+#include "Tiki/tiki.h"
+#include "Tiki/net.h"
+#include "Tiki/net/http/request.h"
+
+namespace Tiki {
+
+namespace Net {
+
+namespace Http {
+
+std::string DEFAULT_CONTENT_PART = "__TIKI__DEFAULT__";
+
+Request::Request() {
+ setHeaderParam("Connection", "close");
+}
+
+void Request::setHeaderParam(std::string param, std::string value) {
+// if(m_params.find(param) != m_params.end()) {
+// m_params.erase(m_params.find(param));
+// }
+
+ m_params.insert(std::make_pair(param, value));
+}
+
+std::string Request::getHeaderParam(std::string param) const {
+ if(m_params.find(param) != m_params.end()) {
+ return m_params.find(param)->second;
+ }
+ return "";
+}
+
+std::list<std::string> Request::getHeaderParamNames() const {
+ std::list<std::string> params;
+
+ for( StringStringMap::const_iterator param = m_params.begin();
+ param != m_params.end();
+ ++param) {
+
+ params.push_back(param->first);
+ }
+
+ return params;
+}
+
+void Request::addContentPart(std::string name, RefPtr<Buffer> input) {
+ //if(m_parts.find(name) != m_parts.end()) {
+ // m_parts.erase(m_parts.find(name));
+ //}
+
+ m_parts.insert(std::make_pair(name, input));
+}
+
+RefPtr<Buffer> Request::getContentPart(std::string name) const {
+ if(m_parts.find(name) != m_parts.end()) {
+ return m_parts.find(name)->second;
+ }
+ return NULL;
+}
+
+std::list<std::string> Request::getContentPartNames() const {
+ std::list<std::string> parts;
+
+ for( StringBufferMap::const_iterator part = m_parts.begin();
+ part != m_parts.end();
+ ++part) {
+
+ parts.push_back(part->first);
+ }
+
+ return parts;
+}
+
+
+}; // namespace Http
+
+}; // namespace Net
+
+}; // namespace Tiki
+
Added: tiki/src/net/http/response.cpp
===================================================================
--- tiki/src/net/http/response.cpp (rev 0)
+++ tiki/src/net/http/response.cpp 2007-08-21 23:56:11 UTC (rev 482)
@@ -0,0 +1,28 @@
+/*
+ Tiki
+
+ response.cpp
+
+ Copyright (C)2007 Atani Software
+*/
+
+#include "Tiki/tiki.h"
+#include "Tiki/net.h"
+#include "Tiki/net/http/request.h"
+#include "Tiki/net/http/response.h"
+
+namespace Tiki {
+
+namespace Net {
+
+namespace Http {
+
+Response::Response() {
+}
+
+}; // namespace Http
+
+}; // namespace Net
+
+}; // namespace Tiki
+
Added: tiki/src/net/http/useragent.cpp
===================================================================
--- tiki/src/net/http/useragent.cpp (rev 0)
+++ tiki/src/net/http/useragent.cpp 2007-08-21 23:56:11 UTC (rev 482)
@@ -0,0 +1,252 @@
+/*
+ Tiki
+
+ useragent.cpp
+
+ Copyright (C)2007 Atani Software
+*/
+
+#include "Tiki/tiki.h"
+#include "Tiki/net.h"
+#include "Tiki/net/http/useragent.h"
+
+#include <sstream>
+
+namespace Tiki {
+
+namespace Net {
+
+namespace Http {
+
+using namespace Tiki::Net::TCP;
+
+#define READ_ONE_LINE(res, socket) \
+ { \
+ RefPtr<Buffer> recvBuf = new Buffer(1); \
+ char tbuf[2]; \
+ res = ""; \
+ while(socket->isOpen()) { \
+ recvBuf->reset(); \
+ socket->recv(recvBuf); \
+ if(recvBuf->getUsedDataLen() > 0) { \
+ tbuf[0] = recvBuf->getData()[0]; \
+ tbuf[1] = '\0'; \
+ if(tbuf[0] != '\n' && tbuf[0] != '\r' ) { \
+ res.append((char *)tbuf); \
+ } \
+ else if(tbuf[0] != '\r' ) { \
+ break; \
+ } \
+ } \
+ } \
+ }
+
+HttpUserAgent::HttpUserAgent() {
+ setUserAgentName("Tiki/1.0");
+ setProxyHost("");
+ setProxyPort(8080);
+}
+
+RefPtr<Response> HttpUserAgent::get(RefPtr<Request> req) const {
+ RefPtr<TCPSocket> socket = new TCPSocket();
+ socket->setNonBlocking(false);
+ RefPtr<Response> response = new Response();
+ response->setUrl(req->getUrl());
+ response->setResultCode(200);
+
+ std::string url = req->getUrl();
+ std::string hostname = "";
+ int port = 80;
+ std::string resource = "/index.html";
+
+ if(url.find("http://") == 0) {
+ url = url.substr(std::string("http://").length());
+ }
+ else if(url.find("https://") == 0) {
+ url = url.substr(std::string("https://").length());
+ }
+ hostname = url.substr(0, url.find("/"));
+ if(url.find("/") != std::string::npos) {
+ resource = url.substr(url.find("/"));
+ }
+ if(hostname.find(":") != std::string::npos) {
+ std::string portstr = url.substr(hostname.find(":"));
+ port = atoi(portstr.c_str());
+ hostname = hostname.substr(0, hostname.find(":"));
+ }
+
+ RefPtr<Address> requestAddress = new Address();
+
+ std::stringstream request;
+ if(m_proxyHost.empty()) {
+ request << "GET " << resource << " HTTP/1.1\r\n";
+ request << "Host: " << hostname << "\r\n";
+ requestAddress->setHostName(hostname);
+ requestAddress->setPort(port);
+ }
+ else {
+ // proxy connection
+ request << "GET " << req->getUrl();
+ if(port != 80) {
+ request << ":" << port;
+ }
+ request << " HTTP/1.1\r\n";
+ request << "Host: " << hostname << "\r\n";
+ requestAddress->setHostName(m_proxyHost);
+ requestAddress->setPort(m_proxyPort);
+ }
+ std::list<std::string> params = req->getHeaderParamNames();
+ for(std::list<string>::const_iterator param = params.begin();
+ param != params.end();
+ ++param) {
+ request << *param << ": " << req->getHeaderParam(*param) << "\r\n";
+ }
+ request << "\r\n";
+ socket->setPeerAddress(requestAddress);
+ Tiki::Debug::printf("Request:\n%s", request.str().c_str());
+
+ socket->open();
+ if(socket->isOpen()) {
+ Tiki::Debug::printf("Sending request...\n");
+ }
+ else {
+ Tiki::Debug::printf("connect failed\n");
+ response->setResultCode(504);
+ return response;
+ }
+
+ RefPtr<Buffer> buf = new Buffer(2048);
+ std::string requeststr = request.str();
+ buf->setData((uint8 *)requeststr.c_str(), requeststr.size());
+ socket->send(buf);
+
+ std::string status = "";
+ READ_ONE_LINE(status, socket)
+
+ Tiki::Debug::printf("Status: %s\n", status.c_str());
+ for(int i = 0; i < status.size(); i++) {
+ if(status.at(i) == ' ') {
+ response->setResultCode(atoi(status.c_str()+i + 1));
+ break;
+ }
+ }
+
+ while(1) {
+ std::string line = "";
+ READ_ONE_LINE(line, socket)
+ if(line.size() == 0) {
+ // done with headers
+ break;
+ }
+ if(line.find(":") != std::string::npos) {
+ std::string field = line.substr(0, line.find(":"));
+ std::string value = line.substr(line.find(":") + 1);
+ while(value.at(0) == ' ') {
+ value = value.substr(1);
+ }
+
+ if(!field.compare("Set-Cookie")) {
+
+ }
+ else {
+ response->setHeaderParam(field, value);
+ }
+ }
+ }
+
+ RefPtr<Buffer> fullBuf = new Buffer(1);
+
+ if(!response->getHeaderParam("Transfer-Encoding").compare("chunked")) {
+ Tiki::Debug::printf("Encoding is chunked\n");
+ // evil chunked encoding
+ size_t totalSize = 0;
+
+ long sizeDecoded = 0;
+ do
+ {
+ sizeDecoded = 0;
+ std::string size = "";
+ READ_ONE_LINE(size, socket);
+ if(size.size() == 0) {
+ sizeDecoded = 1;
+ continue;
+ }
+
+ int base = 1;
+ for(int i = 0; i < size.size(); i++ ) {
+ char ch = size.at(i);
+ if(ch >= 'A' && ch <= 'F') {
+ ch -= 'A';
+ ch += 10;
+ }
+ else if(ch >= 'a' && ch <= 'f') {
+ ch -= 'a';
+ ch += 10;
+ }
+ else if(ch >= '0' && ch <= '9') {
+ ch -= '0';
+ }
+ else {
+ continue;
+ }
+ sizeDecoded += (ch * pow(16.0f, size.size() - i - 1));
+ }
+ //Tiki::Debug::printf("chunk size: %d [%s]\n", sizeDecoded, size.c_str());
+ if(sizeDecoded > 0) {
+
+ RefPtr<Buffer> chunkBuf = new Buffer(sizeDecoded);
+ socket->recv(chunkBuf);
+ if(chunkBuf->getUsedDataLen() < sizeDecoded)
+ {
+ //Tiki::Debug::printf("Buffer underflow\n");
+ int needed = sizeDecoded - chunkBuf->getUsedDataLen();
+ while(needed > 0) {
+ RefPtr<Buffer> chunkBuf2 = new Buffer(needed);
+ socket->recv(chunkBuf2);
+ chunkBuf->append(chunkBuf2);
+ needed -= chunkBuf2->getUsedDataLen();
+ }
+ }
+ totalSize += chunkBuf->getUsedDataLen();
+ fullBuf->append(chunkBuf);
+ }
+ } while(sizeDecoded > 0);
+ Tiki::Debug::printf("total size: %d %x\n", totalSize, totalSize);
+ }
+ else if(response->getHeaderParam("Content-Length").compare("")) {
+ Tiki::Debug::printf("Encoding is inline\n");
+ long sizeDecoded = atoi(response->getHeaderParam("Content-Length").c_str());
+ Tiki::Debug::printf("decodedSize: %d\n", sizeDecoded);
+
+ RefPtr<Buffer> chunkBuf = new Buffer(sizeDecoded);
+ socket->recv(chunkBuf);
+ if(chunkBuf->getUsedDataLen() < sizeDecoded)
+ {
+ sizeDecoded -= chunkBuf->getUsedDataLen();
+ while(sizeDecoded > 0) {
+ RefPtr<Buffer> chunkBuf2 = new Buffer(sizeDecoded);
+ socket->recv(chunkBuf2);
+ chunkBuf->append(chunkBuf2);
+ sizeDecoded -= chunkBuf2->getUsedDataLen();
+ }
+ }
+ fullBuf->append(chunkBuf);
+ }
+ else {
+ Tiki::Debug::printf("Encoding is unknown\n");
+ }
+ response->addContentPart(DEFAULT_CONTENT_PART, fullBuf);
+
+ return response;
+}
+
+RefPtr<Response> HttpUserAgent::post(RefPtr<Request> req) const {
+ return NULL;
+}
+
+}; // namespace Http
+
+}; // namespace Net
+
+}; // namespace Tiki
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <at...@us...> - 2007-08-22 17:46:36
|
Revision: 484
http://cadcdev.svn.sourceforge.net/cadcdev/?rev=484&view=rev
Author: atani
Date: 2007-08-22 10:46:32 -0700 (Wed, 22 Aug 2007)
Log Message:
-----------
updates to support POST requests
Modified Paths:
--------------
tiki/examples/net/httpclient/src/main.cpp
tiki/include/Tiki/net/buffer.h
tiki/include/Tiki/net/http/request.h
tiki/include/Tiki/net/http/useragent.h
tiki/src/net/http/request.cpp
tiki/src/net/http/useragent.cpp
Modified: tiki/examples/net/httpclient/src/main.cpp
===================================================================
--- tiki/examples/net/httpclient/src/main.cpp 2007-08-22 00:39:13 UTC (rev 483)
+++ tiki/examples/net/httpclient/src/main.cpp 2007-08-22 17:46:32 UTC (rev 484)
@@ -53,6 +53,7 @@
{
RefPtr<Buffer> responseBuf = response->getContentPart(*iter);
Tiki::Debug::printf("Content Part: %s [%u bytes]\n", (*iter).c_str(), responseBuf->getUsedDataLen());
+ Tiki::Debug::printf("%s\n", responseBuf->getData());
}
Modified: tiki/include/Tiki/net/buffer.h
===================================================================
--- tiki/include/Tiki/net/buffer.h 2007-08-22 00:39:13 UTC (rev 483)
+++ tiki/include/Tiki/net/buffer.h 2007-08-22 17:46:32 UTC (rev 484)
@@ -10,6 +10,8 @@
#include "Tiki/object.h"
+#include <fstream>
+
namespace Tiki {
namespace Net {
@@ -17,13 +19,14 @@
class Buffer : public Object
{
public:
- Buffer(size_t len) {
+ Buffer(size_t len, std::string contentType = "application/octet-stream") : m_contentType(contentType) {
m_data = new uint8[len];
memset(m_data, 0, len);
m_dataLen = len;
m_usedDataLen = 0;
}
- Buffer(size_t len, uint8 *data) {
+
+ Buffer(size_t len, uint8 *data, std::string contentType = "application/octet-stream") : m_contentType(contentType) {
m_data = new uint8[len];
memset(m_data, 0, len);
m_dataLen = len;
@@ -31,6 +34,16 @@
memcpy(m_data, data, len);
}
+ Buffer(std::string filename, std::string contentType, std::string fieldName = "") : m_fileName(filename), m_contentType(contentType), m_fieldName(fieldName) {
+ std::ifstream stream(filename.c_str(), std::ios::in | std::ios::binary);
+ stream.seekg(0, std::ios::end);
+ m_dataLen = m_usedDataLen = stream.tellg();
+ stream.seekg(0);
+ m_data = new uint8[m_dataLen];
+ stream.read((char *)m_data, m_dataLen);
+ stream.close();
+ }
+
void append(RefPtr<Buffer> buf) {
uint8 * newbuf = new uint8[ m_dataLen + buf->getDataLen() ];
memcpy(newbuf, m_data, m_usedDataLen);
@@ -50,6 +63,29 @@
return m_data;
}
+ std::string getContentType() const {
+ return m_contentType;
+ }
+
+ std::string getFileName() const {
+ return m_fileName;
+ }
+
+ std::string getFileNameShort() const {
+ std::string filename = m_fileName;
+ while(filename.find("/") != std::string::npos) {
+ filename = filename.substr(filename.find("/") + 1);
+ }
+ while(filename.find("\\") != std::string::npos) {
+ filename = filename.substr(filename.find("\\") + 1);
+ }
+ return filename;
+ }
+
+ std::string getFieldName() const {
+ return m_fieldName;
+ }
+
size_t getDataLen() const {
return m_dataLen;
}
@@ -73,6 +109,9 @@
}
private:
+ std::string m_contentType;
+ std::string m_fileName;
+ std::string m_fieldName;
uint8 *m_data;
size_t m_dataLen;
size_t m_usedDataLen;
Modified: tiki/include/Tiki/net/http/request.h
===================================================================
--- tiki/include/Tiki/net/http/request.h 2007-08-22 00:39:13 UTC (rev 483)
+++ tiki/include/Tiki/net/http/request.h 2007-08-22 17:46:32 UTC (rev 484)
@@ -38,8 +38,13 @@
std::list<std::string> getContentPartNames() const;
RefPtr<Buffer> getContentPart(std::string name) const;
+ std::string getBoundaryMarker() const {
+ return m_boundaryMarker;
+ }
+
private:
std::string m_url;
+ std::string m_boundaryMarker;
typedef std::map<std::string, std::string> StringStringMap;
typedef std::map<std::string, RefPtr< Buffer > > StringBufferMap;
StringStringMap m_params;
Modified: tiki/include/Tiki/net/http/useragent.h
===================================================================
--- tiki/include/Tiki/net/http/useragent.h 2007-08-22 00:39:13 UTC (rev 483)
+++ tiki/include/Tiki/net/http/useragent.h 2007-08-22 17:46:32 UTC (rev 484)
@@ -9,6 +9,7 @@
#define __TIKI_NET_HTTP_USERAGENT_H
#include "Tiki/refcnt.h"
+#include "Tiki/net/tcpsocket.h"
#include "Tiki/net/http/cookie.h"
#include "Tiki/net/http/request.h"
#include "Tiki/net/http/response.h"
@@ -19,6 +20,8 @@
namespace Http {
+using Tiki::Net::TCP::TCPSocket;
+
class HttpUserAgent : public RefCnt {
public:
@@ -52,9 +55,9 @@
return m_cookies;
}
- RefPtr<Response> get(RefPtr<Request> req) const;
+ RefPtr<Response> get(RefPtr<Request> req);
- RefPtr<Response> post(RefPtr<Request> req) const;
+ RefPtr<Response> post(RefPtr<Request> req);
private:
std::string m_userAgentName;
@@ -62,6 +65,11 @@
int m_proxyPort;
std::list< RefPtr< Cookie > > m_cookies;
+ void parseUrl(const std::string url, std::string &host, std::string &resource, int &port);
+ void buildRequest(const std::string host, const std::string resource, const int port,
+ const std::string mode, RefPtr<Request> request, std::string &requestText,
+ RefPtr<Address> address);
+ void readResponse(RefPtr<Response> response, RefPtr<TCPSocket> socket);
};
Modified: tiki/src/net/http/request.cpp
===================================================================
--- tiki/src/net/http/request.cpp 2007-08-22 00:39:13 UTC (rev 483)
+++ tiki/src/net/http/request.cpp 2007-08-22 17:46:32 UTC (rev 484)
@@ -20,6 +20,8 @@
Request::Request() {
setHeaderParam("Connection", "close");
+ m_boundaryMarker = "-----------------------09f911019d74e35bd84156c5635688c0";
+
}
void Request::setHeaderParam(std::string param, std::string value) {
Modified: tiki/src/net/http/useragent.cpp
===================================================================
--- tiki/src/net/http/useragent.cpp 2007-08-22 00:39:13 UTC (rev 483)
+++ tiki/src/net/http/useragent.cpp 2007-08-22 17:46:32 UTC (rev 484)
@@ -11,6 +11,7 @@
#include "Tiki/net/http/useragent.h"
#include <sstream>
+#include <math.h>
namespace Tiki {
@@ -47,79 +48,209 @@
setProxyPort(8080);
}
-RefPtr<Response> HttpUserAgent::get(RefPtr<Request> req) const {
+RefPtr<Response> HttpUserAgent::get(RefPtr<Request> req) {
RefPtr<TCPSocket> socket = new TCPSocket();
socket->setNonBlocking(false);
RefPtr<Response> response = new Response();
response->setUrl(req->getUrl());
response->setResultCode(200);
- std::string url = req->getUrl();
- std::string hostname = "";
- int port = 80;
- std::string resource = "/index.html";
+ std::string hostname;
+ int port;
+ std::string resource;
- if(url.find("http://") == 0) {
- url = url.substr(std::string("http://").length());
+ parseUrl(req->getUrl(), hostname, resource, port);
+
+ RefPtr<Address> requestAddress = new Address();
+
+ std::string requestText;
+ buildRequest(hostname, resource, port, "GET", req, requestText, requestAddress);
+ socket->setPeerAddress(requestAddress);
+ Tiki::Debug::printf("Request:\n%s", requestText.c_str());
+
+ socket->open();
+ if(socket->isOpen()) {
+ Tiki::Debug::printf("Sending request...\n");
}
- else if(url.find("https://") == 0) {
- url = url.substr(std::string("https://").length());
+ else {
+ Tiki::Debug::printf("connect failed\n");
+ response->setResultCode(504);
+ return response;
}
- hostname = url.substr(0, url.find("/"));
- if(url.find("/") != std::string::npos) {
- resource = url.substr(url.find("/"));
+
+ RefPtr<Buffer> buf = new Buffer(2048);
+ buf->setData((uint8 *)requestText.c_str(), requestText.size());
+ socket->send(buf);
+
+ readResponse(response, socket);
+
+ return response;
+}
+
+RefPtr<Response> HttpUserAgent::post(RefPtr<Request> req) {
+ RefPtr<TCPSocket> socket = new TCPSocket();
+ socket->setNonBlocking(false);
+ RefPtr<Response> response = new Response();
+ response->setUrl(req->getUrl());
+ response->setResultCode(200);
+
+ std::string hostname;
+ int port;
+ std::string resource;
+
+ parseUrl(req->getUrl(), hostname, resource, port);
+
+ RefPtr<Address> requestAddress = new Address();
+
+ std::string requestText;
+ buildRequest(hostname, resource, port, "POST", req, requestText, requestAddress);
+ socket->setPeerAddress(requestAddress);
+ Tiki::Debug::printf("Request:\n%s", requestText.c_str());
+
+ socket->open();
+ if(socket->isOpen()) {
+ Tiki::Debug::printf("Sending request...\n");
}
- if(hostname.find(":") != std::string::npos) {
- std::string portstr = url.substr(hostname.find(":"));
+ else {
+ Tiki::Debug::printf("connect failed\n");
+ response->setResultCode(504);
+ return response;
+ }
+
+ RefPtr<Buffer> buf = new Buffer(2048);
+ buf->setData((uint8 *)requestText.c_str(), requestText.size());
+ socket->send(buf);
+
+ std::list<std::string> content = req->getContentPartNames();
+ if(content.size() > 1) {
+ for(std::list<std::string>::iterator iter = content.begin();
+ iter != content.end();
+ ++iter) {
+ RefPtr<Buffer> buf = req->getContentPart(*iter);
+ std::stringstream temp;
+ temp << req->getBoundaryMarker() << "\r\n";
+ temp << "Content-Disposition: form-data: name=\"";
+ if(buf->getFieldName().size() > 0) {
+ temp << buf->getFieldName();
+ }
+ else {
+ temp << "File";
+ }
+ temp << "\"; filename=\"" << buf->getFileNameShort() << "\"\r\nContent-Type: " << buf->getContentType() << "\r\n";
+ RefPtr<Buffer> headerBuf = new Buffer(2048);
+ std::string headerText = temp.str();
+ headerBuf->setData((uint8 *)headerText.c_str(), headerText.size());
+ socket->send(headerBuf);
+ socket->send(buf);
+ }
+ std::string footerText = req->getBoundaryMarker();
+ footerText.append("--\r\n");
+ RefPtr<Buffer> footerBuf = new Buffer(2048);
+ footerBuf->setData((uint8 *)footerText.c_str(), footerText.size());
+ socket->send(footerBuf);
+ }
+ else if(content.size() == 1) {
+ RefPtr<Buffer> buf = req->getContentPart(*content.begin());
+ socket->send(buf);
+ }
+
+ readResponse(response, socket);
+
+ return response;
+}
+
+void HttpUserAgent::parseUrl(const std::string url, std::string &host, std::string &resource, int &port) {
+ std::string temp_url = url;
+
+ // set defaults
+ host = "";
+ port = 80;
+ resource = "/index.html";
+
+ if(temp_url.find("http://") == 0) {
+ temp_url = temp_url.substr(std::string("http://").length());
+ }
+ else if(temp_url.find("https://") == 0) {
+ temp_url = temp_url.substr(std::string("https://").length());
+ }
+ host = temp_url.substr(0, temp_url.find("/"));
+ if(temp_url.find("/") != std::string::npos) {
+ resource = temp_url.substr(temp_url.find("/"));
+ }
+ if(host.find(":") != std::string::npos) {
+ std::string portstr = url.substr(host.find(":"));
port = atoi(portstr.c_str());
- hostname = hostname.substr(0, hostname.find(":"));
+ host = host.substr(0, host.find(":"));
}
+}
- RefPtr<Address> requestAddress = new Address();
+void HttpUserAgent::buildRequest(const std::string host, const std::string resource, const int port,
+ const std::string mode, RefPtr<Request> request, std::string &requestText,
+ RefPtr<Address> address) {
- std::stringstream request;
+ std::stringstream req;
if(m_proxyHost.empty()) {
- request << "GET " << resource << " HTTP/1.1\r\n";
- request << "Host: " << hostname << "\r\n";
- requestAddress->setHostName(hostname);
- requestAddress->setPort(port);
+ req << mode << " " << resource << " HTTP/1.1\r\n";
+ req << "Host: " << host << "\r\n";
+ address->setHostName(host);
+ address->setPort(port);
}
else {
// proxy connection
- request << "GET " << req->getUrl();
+ req << mode << " " << request->getUrl();
if(port != 80) {
- request << ":" << port;
+ req << ":" << port;
}
- request << " HTTP/1.1\r\n";
- request << "Host: " << hostname << "\r\n";
- requestAddress->setHostName(m_proxyHost);
- requestAddress->setPort(m_proxyPort);
+ req << " HTTP/1.1\r\n";
+ req << "Host: " << host << "\r\n";
+ address->setHostName(m_proxyHost);
+ address->setPort(m_proxyPort);
}
- std::list<std::string> params = req->getHeaderParamNames();
+ std::list<std::string> params = request->getHeaderParamNames();
for(std::list<string>::const_iterator param = params.begin();
param != params.end();
++param) {
- request << *param << ": " << req->getHeaderParam(*param) << "\r\n";
+ req << *param << ": " << request->getHeaderParam(*param) << "\r\n";
}
- request << "\r\n";
- socket->setPeerAddress(requestAddress);
- Tiki::Debug::printf("Request:\n%s", request.str().c_str());
- socket->open();
- if(socket->isOpen()) {
- Tiki::Debug::printf("Sending request...\n");
+ std::list<std::string> content = request->getContentPartNames();
+ if(!mode.compare("POST") && content.size() > 1) {
+ uint64 totalSize = request->getBoundaryMarker().size() + 4; // add 4 to account for --\r\n
+ for(std::list<std::string>::iterator iter = content.begin();
+ iter != content.end();
+ ++iter) {
+ RefPtr<Buffer> buf = request->getContentPart(*iter);
+ totalSize += buf->getUsedDataLen();
+ std::stringstream temp;
+ temp << "Content-Disposition: form-data: name=\"";
+ if(buf->getFieldName().size() > 0) {
+ temp << buf->getFieldName();
+ }
+ else {
+ temp << "File";
+ }
+ temp << "\"; filename=\"" << buf->getFileNameShort() << "\"\r\nContent-Type: " << buf->getContentType() << "\r\n";
+
+ // add section header size
+ totalSize += temp.str().size();
+ }
+
+ req << "Content-Length: " << totalSize << "\r\n";
+ req << "Expect: 100-continue\r\n";
+ req << "Content-Type: multipart/form-data; boundary=" << request->getBoundaryMarker() << "\r\n";
}
- else {
- Tiki::Debug::printf("connect failed\n");
- response->setResultCode(504);
- return response;
+ else if(!mode.compare("POST") && content.size() == 1) {
+ RefPtr<Buffer> buf = request->getContentPart(*content.begin());
+ req << "Content-Type: " << buf->getContentType() << "\r\n";
+ req << "Content-Length: " << buf->getUsedDataLen() << "\r\n";
}
+ req << "\r\n";
- RefPtr<Buffer> buf = new Buffer(2048);
- std::string requeststr = request.str();
- buf->setData((uint8 *)requeststr.c_str(), requeststr.size());
- socket->send(buf);
+ Tiki::Debug::printf("Request Text: %s\n", req.str().c_str());
+ requestText = req.str();
+}
+void HttpUserAgent::readResponse(RefPtr<Response> response, RefPtr<TCPSocket> socket) {
std::string status = "";
READ_ONE_LINE(status, socket)
@@ -189,7 +320,7 @@
else {
continue;
}
- sizeDecoded += (ch * pow(16.0f, size.size() - i - 1));
+ sizeDecoded += (ch * static_cast<int>(pow(16.0f, size.size() - i - 1)));
}
//Tiki::Debug::printf("chunk size: %d [%s]\n", sizeDecoded, size.c_str());
if(sizeDecoded > 0) {
@@ -236,14 +367,8 @@
Tiki::Debug::printf("Encoding is unknown\n");
}
response->addContentPart(DEFAULT_CONTENT_PART, fullBuf);
-
- return response;
}
-RefPtr<Response> HttpUserAgent::post(RefPtr<Request> req) const {
- return NULL;
-}
-
}; // namespace Http
}; // namespace Net
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <at...@us...> - 2007-08-23 00:02:00
|
Revision: 487
http://cadcdev.svn.sourceforge.net/cadcdev/?rev=487&view=rev
Author: atani
Date: 2007-08-22 17:01:53 -0700 (Wed, 22 Aug 2007)
Log Message:
-----------
nds and osx Tiki::Net support
Modified Paths:
--------------
tiki/include/Tiki/net/tcpsocket.h
tiki/include/Tiki/net.h
tiki/nds/Makefile
tiki/osx/Tiki.xcodeproj/project.pbxproj
tiki/osx/src/init_shutdown.cpp
tiki/osx/src/platnet.cpp
tiki/sdl/src/platnet.cpp
tiki/src/net/address.cpp
tiki/src/net/tcpserversocket.cpp
tiki/src/net/tcpsocket.cpp
Added Paths:
-----------
tiki/nds/include/Tiki/platnet.h
tiki/nds/src/platnet.cpp
Modified: tiki/include/Tiki/net/tcpsocket.h
===================================================================
--- tiki/include/Tiki/net/tcpsocket.h 2007-08-22 20:47:44 UTC (rev 486)
+++ tiki/include/Tiki/net/tcpsocket.h 2007-08-23 00:01:53 UTC (rev 487)
@@ -25,11 +25,12 @@
public:
#ifndef INVALID_SOCKET
- enum {
- INVALID_SOCKET = -1,
- SOCKET_ERROR = -1
- };
+#define INVALID_SOCKET -1
#endif
+
+#ifndef SOCKET_ERROR
+#define SOCKET_ERROR -1
+#endif
TCPSocket() : Socket(), m_open(false) {};
TCPSocket(RefPtr<Address> address) : Socket(address), m_open(false) {};
#if TIKI_PLAT == TIKI_WIN32
Modified: tiki/include/Tiki/net.h
===================================================================
--- tiki/include/Tiki/net.h 2007-08-22 20:47:44 UTC (rev 486)
+++ tiki/include/Tiki/net.h 2007-08-23 00:01:53 UTC (rev 487)
@@ -14,6 +14,9 @@
void init();
void shutdown();
+bool connect();
+bool isConnected();
+void disconnect();
} // namespace Net
Modified: tiki/nds/Makefile
===================================================================
--- tiki/nds/Makefile 2007-08-22 20:47:44 UTC (rev 486)
+++ tiki/nds/Makefile 2007-08-23 00:01:53 UTC (rev 487)
@@ -10,6 +10,8 @@
BASE_IMAGE_OBJ=$(patsubst %.cpp,%.o,$(wildcard ../src/image/*.cpp))
BASE_MATH_OBJ=$(patsubst %.cpp,%.o,$(wildcard ../src/math/*.cpp))
BASE_THREAD_OBJ=$(patsubst %.cpp,%.o,$(wildcard ../src/thread/*.cpp))
+BASE_NET_OBJ=$(patsubst %.cpp,%.o,$(wildcard ../src/net/*.cpp))
+BASE_NET_OBJ+=$(patsubst %.cpp,%.o,$(wildcard ../src/net/http/*.cpp))
JPEG_OBJ=$(patsubst %.c,%.o,$(wildcard ../3rdparty/libjpeg/*.c))
PNG_OBJ=$(patsubst %.c,%.o,$(wildcard ../3rdparty/libpng/*.c))
@@ -39,7 +41,7 @@
BASE_OBJS = $(BASE_AUDIO_OBJ) $(BASE_BASE_OBJ) $(BASE_GL_OBJ) \
$(BASE_HID_OBJ) $(BASE_IMAGE_OBJ) $(BASE_MATH_OBJ) \
- $(BASE_THREAD_OBJ)
+ $(BASE_THREAD_OBJ) $(BASE_NET_OBJ)
THIRD_PARTY_OBJS = $(JPEG_OBJ) $(OGG_OBJ) $(VORBIS_OBJ) $(PNG_OBJ) $(ZLIB_OBJ)
@@ -56,6 +58,10 @@
examples:
$(MAKE) TIKI_PLAT=nds TIKI_DIR=$(CURDIR)/../ -C$(CURDIR)/../examples/TikiTest
$(MAKE) TIKI_PLAT=nds TIKI_DIR=$(CURDIR)/../ -C$(CURDIR)/../examples/console/TikiSnake
+ $(MAKE) TIKI_PLAT=nds TIKI_DIR=$(CURDIR)/../ -C$(CURDIR)/../examples/net/basic
+ $(MAKE) TIKI_PLAT=nds TIKI_DIR=$(CURDIR)/../ -C$(CURDIR)/../examples/net/chat
+ $(MAKE) TIKI_PLAT=nds TIKI_DIR=$(CURDIR)/../ -C$(CURDIR)/../examples/net/chatd
+ $(MAKE) TIKI_PLAT=nds TIKI_DIR=$(CURDIR)/../ -C$(CURDIR)/../examples/net/httpclient
package:
zip -9r ../dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-nds.zip \
Added: tiki/nds/include/Tiki/platnet.h
===================================================================
--- tiki/nds/include/Tiki/platnet.h (rev 0)
+++ tiki/nds/include/Tiki/platnet.h 2007-08-23 00:01:53 UTC (rev 487)
@@ -0,0 +1,14 @@
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <netinet/in.h>
+#include <netdb.h>
+#include <sys/socket.h>
+#include <sys/time.h>
+
+#include <nds.h>
+#include <dswifi9.h>
+
Added: tiki/nds/src/platnet.cpp
===================================================================
--- tiki/nds/src/platnet.cpp (rev 0)
+++ tiki/nds/src/platnet.cpp 2007-08-23 00:01:53 UTC (rev 487)
@@ -0,0 +1,50 @@
+/*
+ Tiki
+
+ platnet.cpp
+
+ Copyright (C)2007 Atani Software
+*/
+
+#include "Tiki/tiki.h"
+#include "Tiki/net.h"
+
+namespace Tiki {
+
+namespace Net {
+
+void init() {
+}
+
+void shutdown() {
+}
+
+bool connect() {
+ if(!isConnected()) {
+ Wifi_AutoConnect();
+ while(1) {
+ switch(Wifi_AssocStatus()) {
+ case ASSOCSTATUS_ASSOCIATED:
+ return true;
+ case ASSOCSTATUS_CANNOTCONNECT:
+ return false;
+ }
+ }
+ }
+
+ return true;
+}
+
+bool isConnected() {
+ return (Wifi_AssocStatus() == ASSOCSTATUS_ASSOCIATED);
+}
+
+void disconnect() {
+ if(isConnected()) {
+ Wifi_DisconnectAP();
+ }
+}
+
+} // namespace Net
+
+} // namespace Tiki
Modified: tiki/osx/Tiki.xcodeproj/project.pbxproj
===================================================================
--- tiki/osx/Tiki.xcodeproj/project.pbxproj 2007-08-22 20:47:44 UTC (rev 486)
+++ tiki/osx/Tiki.xcodeproj/project.pbxproj 2007-08-23 00:01:53 UTC (rev 487)
@@ -17,6 +17,27 @@
6444BEE60932A3D800A29768 /* texturetile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6444BEE50932A3D700A29768 /* texturetile.cpp */; };
6444BEE80932A3F200A29768 /* texturetile.h in Headers */ = {isa = PBXBuildFile; fileRef = 6444BEE70932A3F200A29768 /* texturetile.h */; };
64D758F4092EB9A5002667EE /* sleep.h in Headers */ = {isa = PBXBuildFile; fileRef = 64D758F3092EB9A5002667EE /* sleep.h */; };
+ 64ED75F50C7CFAE500D16D5C /* address.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 64ED75F10C7CFAE500D16D5C /* address.cpp */; };
+ 64ED75F60C7CFAE500D16D5C /* socket.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 64ED75F20C7CFAE500D16D5C /* socket.cpp */; };
+ 64ED75F70C7CFAE500D16D5C /* tcpserversocket.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 64ED75F30C7CFAE500D16D5C /* tcpserversocket.cpp */; };
+ 64ED75F80C7CFAE500D16D5C /* tcpsocket.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 64ED75F40C7CFAE500D16D5C /* tcpsocket.cpp */; };
+ 64ED75FD0C7CFB1800D16D5C /* request.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 64ED75FA0C7CFB1800D16D5C /* request.cpp */; };
+ 64ED75FE0C7CFB1800D16D5C /* response.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 64ED75FB0C7CFB1800D16D5C /* response.cpp */; };
+ 64ED75FF0C7CFB1800D16D5C /* useragent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 64ED75FC0C7CFB1800D16D5C /* useragent.cpp */; };
+ 64ED76190C7CFB4C00D16D5C /* address.h in Headers */ = {isa = PBXBuildFile; fileRef = 64ED76130C7CFB4C00D16D5C /* address.h */; };
+ 64ED761A0C7CFB4C00D16D5C /* buffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 64ED76140C7CFB4C00D16D5C /* buffer.h */; };
+ 64ED761B0C7CFB4C00D16D5C /* socket.h in Headers */ = {isa = PBXBuildFile; fileRef = 64ED76150C7CFB4C00D16D5C /* socket.h */; };
+ 64ED761C0C7CFB4C00D16D5C /* tcpserversocket.h in Headers */ = {isa = PBXBuildFile; fileRef = 64ED76160C7CFB4C00D16D5C /* tcpserversocket.h */; };
+ 64ED761D0C7CFB4C00D16D5C /* tcpsocket.h in Headers */ = {isa = PBXBuildFile; fileRef = 64ED76170C7CFB4C00D16D5C /* tcpsocket.h */; };
+ 64ED761E0C7CFB4C00D16D5C /* udpsocket.h in Headers */ = {isa = PBXBuildFile; fileRef = 64ED76180C7CFB4C00D16D5C /* udpsocket.h */; };
+ 64ED76230C7CFB6200D16D5C /* cookie.h in Headers */ = {isa = PBXBuildFile; fileRef = 64ED761F0C7CFB6200D16D5C /* cookie.h */; };
+ 64ED76240C7CFB6200D16D5C /* request.h in Headers */ = {isa = PBXBuildFile; fileRef = 64ED76200C7CFB6200D16D5C /* request.h */; };
+ 64ED76250C7CFB6200D16D5C /* response.h in Headers */ = {isa = PBXBuildFile; fileRef = 64ED76210C7CFB6200D16D5C /* response.h */; };
+ 64ED76260C7CFB6200D16D5C /* useragent.h in Headers */ = {isa = PBXBuildFile; fileRef = 64ED76220C7CFB6200D16D5C /* useragent.h */; };
+ 64ED76290C7CFB7E00D16D5C /* endian.h in Headers */ = {isa = PBXBuildFile; fileRef = 64ED76270C7CFB7E00D16D5C /* endian.h */; };
+ 64ED762A0C7CFB7E00D16D5C /* net.h in Headers */ = {isa = PBXBuildFile; fileRef = 64ED76280C7CFB7E00D16D5C /* net.h */; };
+ 64ED762C0C7CFB9400D16D5C /* platnet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 64ED762B0C7CFB9400D16D5C /* platnet.cpp */; };
+ 64ED762E0C7CFBA100D16D5C /* platnet.h in Headers */ = {isa = PBXBuildFile; fileRef = 64ED762D0C7CFBA100D16D5C /* platnet.h */; };
8DC2EF530486A6940098B216 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C1666FE841158C02AAC07 /* InfoPlist.strings */; };
8DC2EF570486A6940098B216 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */; };
C4287F7C07C9491100D238E1 /* image.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C4287F7B07C9491100D238E1 /* image.cpp */; };
@@ -184,6 +205,27 @@
6444BEE50932A3D700A29768 /* texturetile.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = texturetile.cpp; path = ../src/gl/drawables/texturetile.cpp; sourceTree = SOURCE_ROOT; };
6444BEE70932A3F200A29768 /* texturetile.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = texturetile.h; path = ../include/Tiki/drawables/texturetile.h; sourceTree = SOURCE_ROOT; };
64D758F3092EB9A5002667EE /* sleep.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = sleep.h; path = ../include/Tiki/anims/sleep.h; sourceTree = SOURCE_ROOT; };
+ 64ED75F10C7CFAE500D16D5C /* address.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = address.cpp; path = ../src/net/address.cpp; sourceTree = SOURCE_ROOT; };
+ 64ED75F20C7CFAE500D16D5C /* socket.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = socket.cpp; path = ../src/net/socket.cpp; sourceTree = SOURCE_ROOT; };
+ 64ED75F30C7CFAE500D16D5C /* tcpserversocket.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = tcpserversocket.cpp; path = ../src/net/tcpserversocket.cpp; sourceTree = SOURCE_ROOT; };
+ 64ED75F40C7CFAE500D16D5C /* tcpsocket.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = tcpsocket.cpp; path = ../src/net/tcpsocket.cpp; sourceTree = SOURCE_ROOT; };
+ 64ED75FA0C7CFB1800D16D5C /* request.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = request.cpp; path = ../src/net/http/request.cpp; sourceTree = SOURCE_ROOT; };
+ 64ED75FB0C7CFB1800D16D5C /* response.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = response.cpp; path = ../src/net/http/response.cpp; sourceTree = SOURCE_ROOT; };
+ 64ED75FC0C7CFB1800D16D5C /* useragent.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = useragent.cpp; path = ../src/net/http/useragent.cpp; sourceTree = SOURCE_ROOT; };
+ 64ED76130C7CFB4C00D16D5C /* address.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = address.h; path = ../include/Tiki/net/address.h; sourceTree = SOURCE_ROOT; };
+ 64ED76140C7CFB4C00D16D5C /* buffer.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = buffer.h; path = ../include/Tiki/net/buffer.h; sourceTree = SOURCE_ROOT; };
+ 64ED76150C7CFB4C00D16D5C /* socket.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = socket.h; path = ../include/Tiki/net/socket.h; sourceTree = SOURCE_ROOT; };
+ 64ED76160C7CFB4C00D16D5C /* tcpserversocket.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = tcpserversocket.h; path = ../include/Tiki/net/tcpserversocket.h; sourceTree = SOURCE_ROOT; };
+ 64ED76170C7CFB4C00D16D5C /* tcpsocket.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = tcpsocket.h; path = ../include/Tiki/net/tcpsocket.h; sourceTree = SOURCE_ROOT; };
+ 64ED76180C7CFB4C00D16D5C /* udpsocket.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = udpsocket.h; path = ../include/Tiki/net/udpsocket.h; sourceTree = SOURCE_ROOT; };
+ 64ED761F0C7CFB6200D16D5C /* cookie.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = cookie.h; path = ../include/Tiki/net/http/cookie.h; sourceTree = SOURCE_ROOT; };
+ 64ED76200C7CFB6200D16D5C /* request.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = request.h; path = ../include/Tiki/net/http/request.h; sourceTree = SOURCE_ROOT; };
+ 64ED76210C7CFB6200D16D5C /* response.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = response.h; path = ../include/Tiki/net/http/response.h; sourceTree = SOURCE_ROOT; };
+ 64ED76220C7CFB6200D16D5C /* useragent.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = useragent.h; path = ../include/Tiki/net/http/useragent.h; sourceTree = SOURCE_ROOT; };
+ 64ED76270C7CFB7E00D16D5C /* endian.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = endian.h; path = ../include/Tiki/endian.h; sourceTree = SOURCE_ROOT; };
+ 64ED76280C7CFB7E00D16D5C /* net.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = net.h; path = ../include/Tiki/net.h; sourceTree = SOURCE_ROOT; };
+ 64ED762B0C7CFB9400D16D5C /* platnet.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = platnet.cpp; path = src/platnet.cpp; sourceTree = "<group>"; };
+ 64ED762D0C7CFBA100D16D5C /* platnet.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = platnet.h; path = include/Tiki/platnet.h; sourceTree = "<group>"; };
8DC2EF5A0486A6940098B216 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
8DC2EF5B0486A6940098B216 /* Tiki.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Tiki.framework; sourceTree = BUILT_PRODUCTS_DIR; };
C40D72C1083723B50084B52D /* design_v2.rtf */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = design_v2.rtf; path = ../notes/design_v2.rtf; sourceTree = SOURCE_ROOT; };
@@ -475,9 +517,57 @@
name = "Other Sources";
sourceTree = "<group>";
};
+ 64ED75F00C7CFAC500D16D5C /* net */ = {
+ isa = PBXGroup;
+ children = (
+ 64ED75F90C7CFAE900D16D5C /* http */,
+ 64ED75F10C7CFAE500D16D5C /* address.cpp */,
+ 64ED75F20C7CFAE500D16D5C /* socket.cpp */,
+ 64ED75F30C7CFAE500D16D5C /* tcpserversocket.cpp */,
+ 64ED75F40C7CFAE500D16D5C /* tcpsocket.cpp */,
+ );
+ name = net;
+ sourceTree = "<group>";
+ };
+ 64ED75F90C7CFAE900D16D5C /* http */ = {
+ isa = PBXGroup;
+ children = (
+ 64ED75FA0C7CFB1800D16D5C /* request.cpp */,
+ 64ED75FB0C7CFB1800D16D5C /* response.cpp */,
+ 64ED75FC0C7CFB1800D16D5C /* useragent.cpp */,
+ );
+ name = http;
+ sourceTree = "<group>";
+ };
+ 64ED76110C7CFB2200D16D5C /* net */ = {
+ isa = PBXGroup;
+ children = (
+ 64ED76130C7CFB4C00D16D5C /* address.h */,
+ 64ED76140C7CFB4C00D16D5C /* buffer.h */,
+ 64ED76150C7CFB4C00D16D5C /* socket.h */,
+ 64ED76160C7CFB4C00D16D5C /* tcpserversocket.h */,
+ 64ED76170C7CFB4C00D16D5C /* tcpsocket.h */,
+ 64ED76180C7CFB4C00D16D5C /* udpsocket.h */,
+ 64ED76120C7CFB2D00D16D5C /* http */,
+ );
+ name = net;
+ sourceTree = "<group>";
+ };
+ 64ED76120C7CFB2D00D16D5C /* http */ = {
+ isa = PBXGroup;
+ children = (
+ 64ED761F0C7CFB6200D16D5C /* cookie.h */,
+ 64ED76200C7CFB6200D16D5C /* request.h */,
+ 64ED76210C7CFB6200D16D5C /* response.h */,
+ 64ED76220C7CFB6200D16D5C /* useragent.h */,
+ );
+ name = http;
+ sourceTree = "<group>";
+ };
C42BD273078FC90300061670 /* Include */ = {
isa = PBXGroup;
children = (
+ 64ED76110C7CFB2200D16D5C /* net */,
C4AD531B0793CF3400E1B779 /* AutoIncluded */,
C48ACAD2079B7121005DF20E /* audio */,
C4AD50FD0793ABEC00E1B779 /* base */,
@@ -492,10 +582,11 @@
C42BD2AD078FC94800061670 /* Source */ = {
isa = PBXGroup;
children = (
+ 64ED75F00C7CFAC500D16D5C /* net */,
C4AD52E30793CDC100E1B779 /* audio */,
C42BD2D6078FC9BF00061670 /* base */,
C4F51516079A0B1C0001D0D0 /* gl */,
- C4539923079A455600F3A584 /* hid */,
+ C4539923079A455600F3A584 /* t */,
C48814FE079F8A3B0038D5B0 /* image */,
C4F5157D079A0CFB0001D0D0 /* math */,
C472B72C079B0FBA00F0C00A /* thread */,
@@ -538,6 +629,7 @@
C42BD4B0078FCB0A00061670 /* Source */ = {
isa = PBXGroup;
children = (
+ 64ED762B0C7CFB9400D16D5C /* platnet.cpp */,
C498925907EE98040050854A /* platgl.cpp */,
C498925707EE97E70050854A /* TikiMain.m */,
C4B5838C0794CFC7004D22F2 /* init_shutdown.cpp */,
@@ -551,6 +643,7 @@
C42BD4B1078FCB0E00061670 /* Include */ = {
isa = PBXGroup;
children = (
+ 64ED762D0C7CFBA100D16D5C /* platnet.h */,
C4AD527D0793C96A00E1B779 /* glhdrs.h */,
C42BD4B3078FCB5A00061670 /* pch.h */,
C472B719079AFA1600F0C00A /* platthread.h */,
@@ -579,13 +672,13 @@
name = hid;
sourceTree = "<group>";
};
- C4539923079A455600F3A584 /* hid */ = {
+ C4539923079A455600F3A584 /* t */ = {
isa = PBXGroup;
children = (
C48E6CD607A48FDE00045273 /* eventcollector.cpp */,
C453992A079A477500F3A584 /* hid.cpp */,
);
- name = hid;
+ name = t;
sourceTree = "<group>";
};
C472B72C079B0FBA00F0C00A /* thread */ = {
@@ -629,6 +722,8 @@
C4AD50FD0793ABEC00E1B779 /* base */ = {
isa = PBXGroup;
children = (
+ 64ED76270C7CFB7E00D16D5C /* endian.h */,
+ 64ED76280C7CFB7E00D16D5C /* net.h */,
C4EAEB1F08678F1F003F5342 /* TikiAll.h */,
C4AD50E30793ABA000E1B779 /* debug.h */,
C4AD522B0793B4E300E1B779 /* file.h */,
@@ -979,6 +1074,19 @@
2290A10209302D9F00B7D80C /* pointerArrow.h in Headers */,
6444BEE80932A3F200A29768 /* texturetile.h in Headers */,
223226830A165A7A0035025E /* console.h in Headers */,
+ 64ED76190C7CFB4C00D16D5C /* address.h in Headers */,
+ 64ED761A0C7CFB4C00D16D5C /* buffer.h in Headers */,
+ 64ED761B0C7CFB4C00D16D5C /* socket.h in Headers */,
+ 64ED761C0C7CFB4C00D16D5C /* tcpserversocket.h in Headers */,
+ 64ED761D0C7CFB4C00D16D5C /* tcpsocket.h in Headers */,
+ 64ED761E0C7CFB4C00D16D5C /* udpsocket.h in Headers */,
+ 64ED76230C7CFB6200D16D5C /* cookie.h in Headers */,
+ 64ED76240C7CFB6200D16D5C /* request.h in Headers */,
+ 64ED76250C7CFB6200D16D5C /* response.h in Headers */,
+ 64ED76260C7CFB6200D16D5C /* useragent.h in Headers */,
+ 64ED76290C7CFB7E00D16D5C /* endian.h in Headers */,
+ 64ED762A0C7CFB7E00D16D5C /* net.h in Headers */,
+ 64ED762E0C7CFBA100D16D5C /* platnet.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -1186,6 +1294,14 @@
2290A0FE09302D7500B7D80C /* pointerArrow.cpp in Sources */,
6444BEE60932A3D800A29768 /* texturetile.cpp in Sources */,
223226810A165A600035025E /* console.cpp in Sources */,
+ 64ED75F50C7CFAE500D16D5C /* address.cpp in Sources */,
+ 64ED75F60C7CFAE500D16D5C /* socket.cpp in Sources */,
+ 64ED75F70C7CFAE500D16D5C /* tcpserversocket.cpp in Sources */,
+ 64ED75F80C7CFAE500D16D5C /* tcpsocket.cpp in Sources */,
+ 64ED75FD0C7CFB1800D16D5C /* request.cpp in Sources */,
+ 64ED75FE0C7CFB1800D16D5C /* response.cpp in Sources */,
+ 64ED75FF0C7CFB1800D16D5C /* useragent.cpp in Sources */,
+ 64ED762C0C7CFB9400D16D5C /* platnet.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Modified: tiki/osx/src/init_shutdown.cpp
===================================================================
--- tiki/osx/src/init_shutdown.cpp 2007-08-22 20:47:44 UTC (rev 486)
+++ tiki/osx/src/init_shutdown.cpp 2007-08-23 00:01:53 UTC (rev 487)
@@ -34,7 +34,7 @@
#if defined(ALC_VERSION_0_1)
dev = alcOpenDevice( const_cast<ALCchar *>( getenv( "OPENAL_DEVICE" ) ) ); // getenv()==NULL is okay.
#else
- dev = alcOpenDevice( getenv( "OPENAL_DEVICE" ) ); // getenv()==NULL is okay.
+ dev = alcOpenDevice( (ALCuint8 *)( getenv( "OPENAL_DEVICE" ) ) ); // getenv()==NULL is okay.
#endif
if ( dev != NULL ) {
Modified: tiki/osx/src/platnet.cpp
===================================================================
--- tiki/osx/src/platnet.cpp 2007-08-22 20:47:44 UTC (rev 486)
+++ tiki/osx/src/platnet.cpp 2007-08-23 00:01:53 UTC (rev 487)
@@ -7,7 +7,7 @@
*/
#include "Tiki/tiki.h"
-#include "Tiki/net/net.h"
+#include "Tiki/net.h"
namespace Tiki {
@@ -19,6 +19,17 @@
void shutdown() {
}
+bool connect() {
+ return true;
+}
+
+bool isConnect() {
+ return true;
+}
+
+void disconnect() {
+}
+
}; // namespace Net
}; // namespace Tiki
Modified: tiki/sdl/src/platnet.cpp
===================================================================
--- tiki/sdl/src/platnet.cpp 2007-08-22 20:47:44 UTC (rev 486)
+++ tiki/sdl/src/platnet.cpp 2007-08-23 00:01:53 UTC (rev 487)
@@ -13,14 +13,18 @@
namespace Net {
-void init()
-{
+void init() {
}
-void shutdown()
-{
+void shutdown() {
}
+bool connect() {
+}
+
+void disconnect() {
+}
+
} // namespace Net
} // namespace Tiki
Modified: tiki/src/net/address.cpp
===================================================================
--- tiki/src/net/address.cpp 2007-08-22 20:47:44 UTC (rev 486)
+++ tiki/src/net/address.cpp 2007-08-23 00:01:53 UTC (rev 487)
@@ -25,6 +25,7 @@
string Address::getHostName()
{
+#if TIKI_PLAT != TIKI_NDS
if(m_hostname.empty() &&
m_ip != AddressUnknown &&
m_ip != AddressBroadcast &&
@@ -37,6 +38,7 @@
m_hostname = string(hp->h_name);
}
}
+#endif
return m_hostname;
}
@@ -55,7 +57,11 @@
struct hostent *hp = gethostbyname(m_hostname.c_str());
if(hp != NULL)
{
+#if TIKI_PLAT == TIKI_NDS
+ memcpy(&m_ip, hp->h_addr_list[0], sizeof(unsigned long));
+#else
memcpy(&m_ip, hp->h_addr, hp->h_length);
+#endif
}
}
return m_ip;
Modified: tiki/src/net/tcpserversocket.cpp
===================================================================
--- tiki/src/net/tcpserversocket.cpp 2007-08-22 20:47:44 UTC (rev 486)
+++ tiki/src/net/tcpserversocket.cpp 2007-08-23 00:01:53 UTC (rev 487)
@@ -60,7 +60,7 @@
#endif
size_t addrlen = sizeof(struct sockaddr_in);
-#if TIKI_PLAT == TIKI_SDL
+#if TIKI_PLAT == TIKI_SDL || TIKI_PLAT == TIKI_OSX
socket = ::accept(m_socket, (sockaddr *)&sock_addr, (socklen_t *)&addrlen);
#else
socket = ::accept(m_socket, (sockaddr *)&sock_addr, (int *)&addrlen);
Modified: tiki/src/net/tcpsocket.cpp
===================================================================
--- tiki/src/net/tcpsocket.cpp 2007-08-22 20:47:44 UTC (rev 486)
+++ tiki/src/net/tcpsocket.cpp 2007-08-23 00:01:53 UTC (rev 487)
@@ -70,10 +70,12 @@
int yes = 1;
+#if TIKI_PLAT != TIKI_NDS
Tiki::Debug::printf("setting TCP_NODELAY\n");
setsockopt(m_socket, IPPROTO_TCP, TCP_NODELAY, (char *)&yes, sizeof(yes));
+#endif
-#if TIKI_PLAT != TIKI_WIN32
+#if TIKI_PLAT != TIKI_WIN32 && TIKI_PLAT != TIKI_NDS
if(isReuse()) {
Tiki::Debug::printf("setting reuse flag\n");
setsockopt(m_socket, SOL_SOCKET, SO_REUSEADDR, (char *)&yes, sizeof(yes));
@@ -103,15 +105,15 @@
void TCPSocket::close() {
m_open = false;
Tiki::Debug::printf("closing socket\n");
+ if(m_socket != INVALID_SOCKET) {
#if TIKI_PLAT == TIKI_WIN32
- if(m_socket != INVALID_SOCKET) {
+ shutdown(m_socket, SHUT_RDWR);
closesocket(m_socket);
- }
#else
- if(m_socket != INVALID_SOCKET) {
+ ::shutdown(m_socket, SHUT_RDWR);
::close(m_socket);
+#endif
}
-#endif
}
void TCPSocket::setNonBlocking(bool blocking)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <at...@us...> - 2007-08-23 18:35:46
|
Revision: 488
http://cadcdev.svn.sourceforge.net/cadcdev/?rev=488&view=rev
Author: atani
Date: 2007-08-23 11:35:40 -0700 (Thu, 23 Aug 2007)
Log Message:
-----------
update win32 project(s) to include Tiki::Net::Http code
added Buffer.read(Tiki::File), Buffer.write(Tiki::File), Buffer(Tiki::File, ...)
fixed chunked data size reading
added Request.removeHeaderParam(std::string param)
Added File.getFileName()
Modified Paths:
--------------
tiki/examples/net/httpclient/httpclient.vcproj
tiki/include/Tiki/file.h
tiki/include/Tiki/net/buffer.h
tiki/include/Tiki/net/http/request.h
tiki/src/base/file.cpp
tiki/src/net/http/request.cpp
tiki/src/net/http/response.cpp
tiki/src/net/http/useragent.cpp
tiki/src/net/tcpsocket.cpp
tiki/win32/tiki_vc80.sln
tiki/win32/tiki_vs80.vcproj
Modified: tiki/examples/net/httpclient/httpclient.vcproj
===================================================================
--- tiki/examples/net/httpclient/httpclient.vcproj 2007-08-23 00:01:53 UTC (rev 487)
+++ tiki/examples/net/httpclient/httpclient.vcproj 2007-08-23 18:35:40 UTC (rev 488)
@@ -191,7 +191,7 @@
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
- RelativePath=".\src\ChatClient.cpp"
+ RelativePath=".\src\HttpClient.cpp"
>
</File>
<File
Modified: tiki/include/Tiki/file.h
===================================================================
--- tiki/include/Tiki/file.h 2007-08-23 00:01:53 UTC (rev 487)
+++ tiki/include/Tiki/file.h 2007-08-23 18:35:40 UTC (rev 488)
@@ -48,6 +48,8 @@
// Write cnt 32-bit little-endian words to the file.
bool writele32( uint32 * in, int cnt );
+ // Returns the filename associated with this File object.
+ string getFileName() const;
// Seek in the file.
int seek( int where, int whence );
@@ -79,6 +81,7 @@
};
RefPtr<FileFD> m_fd;
+ string m_fileName;
};
}
Modified: tiki/include/Tiki/net/buffer.h
===================================================================
--- tiki/include/Tiki/net/buffer.h 2007-08-23 00:01:53 UTC (rev 487)
+++ tiki/include/Tiki/net/buffer.h 2007-08-23 18:35:40 UTC (rev 488)
@@ -9,6 +9,7 @@
#define __TIKI_NET_BUFFER_H
#include "Tiki/object.h"
+#include "Tiki/File.h"
#include <fstream>
@@ -16,6 +17,8 @@
namespace Net {
+using Tiki::File;
+
class Buffer : public Object
{
public:
@@ -34,7 +37,8 @@
memcpy(m_data, data, len);
}
- Buffer(std::string filename, std::string contentType, std::string fieldName = "") : m_fileName(filename), m_contentType(contentType), m_fieldName(fieldName) {
+ Buffer(std::string filename, std::string contentType, std::string fieldName = "") :
+ m_fileName(filename), m_contentType(contentType), m_fieldName(fieldName) {
std::ifstream stream(filename.c_str(), std::ios::in | std::ios::binary);
stream.seekg(0, std::ios::end);
m_dataLen = m_usedDataLen = stream.tellg();
@@ -44,6 +48,24 @@
stream.close();
}
+ Buffer(Tiki::File file, std::string contentType, std::string fieldName = "") :
+ m_contentType(contentType), m_fieldName(fieldName) {
+ read(file);
+ }
+
+ void read(Tiki::File file) {
+ assert(file.isValid());
+ m_fileName = file.getFileName();
+ m_dataLen = m_usedDataLen = file.total();
+ m_data = new uint8[m_dataLen];
+ file.read(m_data, m_dataLen);
+ }
+
+ void write(Tiki::File file) {
+ assert(file.isValid());
+ file.write(m_data, m_usedDataLen);
+ }
+
void append(RefPtr<Buffer> buf) {
uint8 * newbuf = new uint8[ m_dataLen + buf->getDataLen() ];
memcpy(newbuf, m_data, m_usedDataLen);
@@ -60,6 +82,7 @@
}
uint8 *getData() const {
+ m_data[m_usedDataLen] = '\0';
return m_data;
}
Modified: tiki/include/Tiki/net/http/request.h
===================================================================
--- tiki/include/Tiki/net/http/request.h 2007-08-23 00:01:53 UTC (rev 487)
+++ tiki/include/Tiki/net/http/request.h 2007-08-23 18:35:40 UTC (rev 488)
@@ -30,6 +30,7 @@
m_url = url;
}
+ void removeHeaderParam(std::string param);
void setHeaderParam(std::string param, std::string value);
std::string getHeaderParam(std::string param) const;
std::list<std::string> getHeaderParamNames() const;
Modified: tiki/src/base/file.cpp
===================================================================
--- tiki/src/base/file.cpp 2007-08-23 00:01:53 UTC (rev 487)
+++ tiki/src/base/file.cpp 2007-08-23 18:35:40 UTC (rev 488)
@@ -26,6 +26,7 @@
File::~File() {}
bool File::open( const string & fn, const char * access ) {
+ m_fileName = fn;
FILE * f = fopen( fn.c_str(), access );
if ( !f )
return false;
@@ -132,6 +133,10 @@
#endif
}
+string File::getFileName() const {
+ return m_fileName;
+}
+
int File::seek( int where, int whence ) {
if ( !isValid() )
return -1;
Modified: tiki/src/net/http/request.cpp
===================================================================
--- tiki/src/net/http/request.cpp 2007-08-23 00:01:53 UTC (rev 487)
+++ tiki/src/net/http/request.cpp 2007-08-23 18:35:40 UTC (rev 488)
@@ -6,6 +6,7 @@
Copyright (C)2007 Atani Software
*/
+#include "pch.h"
#include "Tiki/tiki.h"
#include "Tiki/net.h"
#include "Tiki/net/http/request.h"
@@ -24,11 +25,17 @@
}
+void Request::removeHeaderParam(std::string param) {
+ if(m_params.find(param) != m_params.end()) {
+ m_params.erase(m_params.find(param));
+ }
+}
+
void Request::setHeaderParam(std::string param, std::string value) {
-// if(m_params.find(param) != m_params.end()) {
-// m_params.erase(m_params.find(param));
-// }
-
+ if(!param.compare("User-Agent")) {
+ Tiki::Debug::printf("Setting User-Agent via Request::setHeaderParam() is not allowed. Use HttpUserAgent::setUserAgentName() instead.\n");
+ return;
+ }
m_params.insert(std::make_pair(param, value));
}
Modified: tiki/src/net/http/response.cpp
===================================================================
--- tiki/src/net/http/response.cpp 2007-08-23 00:01:53 UTC (rev 487)
+++ tiki/src/net/http/response.cpp 2007-08-23 18:35:40 UTC (rev 488)
@@ -6,6 +6,7 @@
Copyright (C)2007 Atani Software
*/
+#include "pch.h"
#include "Tiki/tiki.h"
#include "Tiki/net.h"
#include "Tiki/net/http/request.h"
Modified: tiki/src/net/http/useragent.cpp
===================================================================
--- tiki/src/net/http/useragent.cpp 2007-08-23 00:01:53 UTC (rev 487)
+++ tiki/src/net/http/useragent.cpp 2007-08-23 18:35:40 UTC (rev 488)
@@ -6,6 +6,7 @@
Copyright (C)2007 Atani Software
*/
+#include "pch.h"
#include "Tiki/tiki.h"
#include "Tiki/net.h"
#include "Tiki/net/http/useragent.h"
@@ -43,7 +44,17 @@
}
HttpUserAgent::HttpUserAgent() {
- setUserAgentName("Tiki/1.0");
+#if TIKI_PLAT == TIKI_WIN32
+ setUserAgentName("Tiki/1.0 (Windows)");
+#elif TIKI_PLAT == TIKI_NDS
+ setUserAgentName("Tiki/1.0 (Nintendo DS)");
+#elif TIKI_PLAT == TIKI_SDL
+ setUserAgentName("Tiki/1.0 (SDL)");
+#elif TIKI_PLAT == TIKI_OSX
+ setUserAgentName("Tiki/1.0 (Mac OS X)");
+#else
+ setUserAgentName("Tiki/1.0 (Unknown)");
+#endif
setProxyHost("");
setProxyPort(8080);
}
@@ -79,7 +90,7 @@
}
RefPtr<Buffer> buf = new Buffer(2048);
- buf->setData((uint8 *)requestText.c_str(), requestText.size());
+ buf->setData((uint8 *)requestText.c_str(), requestText.length());
socket->send(buf);
readResponse(response, socket);
@@ -118,7 +129,7 @@
}
RefPtr<Buffer> buf = new Buffer(2048);
- buf->setData((uint8 *)requestText.c_str(), requestText.size());
+ buf->setData((uint8 *)requestText.c_str(), requestText.length());
socket->send(buf);
std::list<std::string> content = req->getContentPartNames();
@@ -130,7 +141,7 @@
std::stringstream temp;
temp << req->getBoundaryMarker() << "\r\n";
temp << "Content-Disposition: form-data: name=\"";
- if(buf->getFieldName().size() > 0) {
+ if(!buf->getFieldName().empty()) {
temp << buf->getFieldName();
}
else {
@@ -139,7 +150,7 @@
temp << "\"; filename=\"" << buf->getFileNameShort() << "\"\r\nContent-Type: " << buf->getContentType() << "\r\n";
RefPtr<Buffer> headerBuf = new Buffer(2048);
std::string headerText = temp.str();
- headerBuf->setData((uint8 *)headerText.c_str(), headerText.size());
+ headerBuf->setData((uint8 *)headerText.c_str(), headerText.length());
socket->send(headerBuf);
socket->send(buf);
}
@@ -147,7 +158,7 @@
footerText.append(req->getBoundaryMarker());
footerText.append("--\r\n");
RefPtr<Buffer> footerBuf = new Buffer(2048);
- footerBuf->setData((uint8 *)footerText.c_str(), footerText.size());
+ footerBuf->setData((uint8 *)footerText.c_str(), footerText.length());
socket->send(footerBuf);
}
else if(content.size() == 1) {
@@ -214,9 +225,13 @@
req << *param << ": " << request->getHeaderParam(*param) << "\r\n";
}
+ if(!m_userAgentName.empty()) {
+ req << "User-Agent: " << m_userAgentName << "\r\n";
+ }
+
std::list<std::string> content = request->getContentPartNames();
if(!mode.compare("POST") && content.size() > 1) {
- uint64 totalSize = request->getBoundaryMarker().size() + 6; // add 6 to account for "--<boundary>--\r\n"
+ uint64 totalSize = request->getBoundaryMarker().length() + 6; // add 6 to account for "--<boundary>--\r\n"
for(std::list<std::string>::iterator iter = content.begin();
iter != content.end();
++iter) {
@@ -224,7 +239,7 @@
totalSize += buf->getUsedDataLen();
std::stringstream temp;
temp << "Content-Disposition: form-data: name=\"";
- if(buf->getFieldName().size() > 0) {
+ if(!buf->getFieldName().empty()) {
temp << buf->getFieldName();
}
else {
@@ -233,7 +248,7 @@
temp << "\"; filename=\"" << buf->getFileNameShort() << "\"\r\nContent-Type: " << buf->getContentType() << "\r\n";
// add section header size
- totalSize += temp.str().size();
+ totalSize += temp.str().length();
}
req << "Content-Length: " << totalSize << "\r\n";
@@ -247,7 +262,6 @@
}
req << "\r\n";
- Tiki::Debug::printf("Request Text: %s\n", req.str().c_str());
requestText = req.str();
}
@@ -255,8 +269,8 @@
std::string status = "";
READ_ONE_LINE(status, socket)
- Tiki::Debug::printf("Status: %s\n", status.c_str());
- for(int i = 0; i < status.size(); i++) {
+ //Tiki::Debug::printf("Status: %s\n", status.c_str());
+ for(int i = 0; i < status.length(); i++) {
if(status.at(i) == ' ') {
response->setResultCode(atoi(status.c_str()+i + 1));
break;
@@ -270,6 +284,7 @@
// done with headers
break;
}
+ //Tiki::Debug::printf("HEADER_LINE: %s\n", line.c_str());
if(line.find(":") != std::string::npos) {
std::string field = line.substr(0, line.find(":"));
std::string value = line.substr(line.find(":") + 1);
@@ -299,13 +314,17 @@
sizeDecoded = 0;
std::string size = "";
READ_ONE_LINE(size, socket);
- if(size.size() == 0) {
+ if(size.empty()) {
sizeDecoded = 1;
continue;
}
+ while(size.find(" ") != std::string::npos) {
+ size.erase(size.find(" "), 1);
+ }
+
int base = 1;
- for(int i = 0; i < size.size(); i++ ) {
+ for(int i = 0; i < size.length(); i++ ) {
char ch = size.at(i);
if(ch >= 'A' && ch <= 'F') {
ch -= 'A';
@@ -321,7 +340,7 @@
else {
continue;
}
- sizeDecoded += (ch * static_cast<int>(pow(16.0f, size.size() - i - 1)));
+ sizeDecoded += (ch * static_cast<int>(pow(16.0f, static_cast<int>(size.length() - i - 1))));
}
//Tiki::Debug::printf("chunk size: %d [%s]\n", sizeDecoded, size.c_str());
if(sizeDecoded > 0) {
@@ -343,12 +362,12 @@
fullBuf->append(chunkBuf);
}
} while(sizeDecoded > 0);
- Tiki::Debug::printf("total size: %d %x\n", totalSize, totalSize);
+ //Tiki::Debug::printf("total size: %d %x\n", totalSize, totalSize);
}
else if(response->getHeaderParam("Content-Length").compare("")) {
Tiki::Debug::printf("Encoding is inline\n");
long sizeDecoded = atoi(response->getHeaderParam("Content-Length").c_str());
- Tiki::Debug::printf("decodedSize: %d\n", sizeDecoded);
+ //Tiki::Debug::printf("decodedSize: %d\n", sizeDecoded);
RefPtr<Buffer> chunkBuf = new Buffer(sizeDecoded);
socket->recv(chunkBuf);
Modified: tiki/src/net/tcpsocket.cpp
===================================================================
--- tiki/src/net/tcpsocket.cpp 2007-08-23 00:01:53 UTC (rev 487)
+++ tiki/src/net/tcpsocket.cpp 2007-08-23 18:35:40 UTC (rev 488)
@@ -105,9 +105,9 @@
void TCPSocket::close() {
m_open = false;
Tiki::Debug::printf("closing socket\n");
- if(m_socket != INVALID_SOCKET) {
+ if(m_socket != INVALID_SOCKET) {
#if TIKI_PLAT == TIKI_WIN32
- shutdown(m_socket, SHUT_RDWR);
+ ::shutdown(m_socket, SD_BOTH);
closesocket(m_socket);
#else
::shutdown(m_socket, SHUT_RDWR);
Modified: tiki/win32/tiki_vc80.sln
===================================================================
--- tiki/win32/tiki_vc80.sln 2007-08-23 00:01:53 UTC (rev 487)
+++ tiki/win32/tiki_vc80.sln 2007-08-23 18:35:40 UTC (rev 488)
@@ -28,6 +28,11 @@
{F2816CAC-B560-4ED9-8A73-9635F832943C} = {F2816CAC-B560-4ED9-8A73-9635F832943C}
EndProjectSection
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HttpClient", "..\examples\net\httpclient\httpclient.vcproj", "{7B823C96-861C-4578-95FF-1087A45AF1AA}"
+ ProjectSection(ProjectDependencies) = postProject
+ {F2816CAC-B560-4ED9-8A73-9635F832943C} = {F2816CAC-B560-4ED9-8A73-9635F832943C}
+ EndProjectSection
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
@@ -58,6 +63,10 @@
{7B823C96-860C-4578-95EE-1087A45AF1AA}.Debug|Win32.Build.0 = Debug|Win32
{7B823C96-860C-4578-95EE-1087A45AF1AA}.Release|Win32.ActiveCfg = Release|Win32
{7B823C96-860C-4578-95EE-1087A45AF1AA}.Release|Win32.Build.0 = Release|Win32
+ {7B823C96-861C-4578-95FF-1087A45AF1AA}.Debug|Win32.ActiveCfg = Debug|Win32
+ {7B823C96-861C-4578-95FF-1087A45AF1AA}.Debug|Win32.Build.0 = Debug|Win32
+ {7B823C96-861C-4578-95FF-1087A45AF1AA}.Release|Win32.ActiveCfg = Release|Win32
+ {7B823C96-861C-4578-95FF-1087A45AF1AA}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Modified: tiki/win32/tiki_vs80.vcproj
===================================================================
--- tiki/win32/tiki_vs80.vcproj 2007-08-23 00:01:53 UTC (rev 487)
+++ tiki/win32/tiki_vs80.vcproj 2007-08-23 18:35:40 UTC (rev 488)
@@ -415,6 +415,22 @@
RelativePath="..\src\net\tcpsocket.cpp"
>
</File>
+ <Filter
+ Name="http"
+ >
+ <File
+ RelativePath="..\src\net\http\request.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\src\net\http\response.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\src\net\http\useragent.cpp"
+ >
+ </File>
+ </Filter>
</Filter>
</Filter>
<Filter
@@ -675,6 +691,26 @@
RelativePath="..\include\Tiki\net\udpsocket.h"
>
</File>
+ <Filter
+ Name="http"
+ >
+ <File
+ RelativePath="..\include\Tiki\net\http\cookie.h"
+ >
+ </File>
+ <File
+ RelativePath="..\include\Tiki\net\http\request.h"
+ >
+ </File>
+ <File
+ RelativePath="..\include\Tiki\net\http\response.h"
+ >
+ </File>
+ <File
+ RelativePath="..\include\Tiki\net\http\useragent.h"
+ >
+ </File>
+ </Filter>
</Filter>
</Filter>
</Filter>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <at...@us...> - 2007-08-23 23:00:00
|
Revision: 489
http://cadcdev.svn.sourceforge.net/cadcdev/?rev=489&view=rev
Author: atani
Date: 2007-08-23 15:59:57 -0700 (Thu, 23 Aug 2007)
Log Message:
-----------
fixes for POST and uploading file(s).
a few cleanups of RefPtr uses, still have some problems with memory leaks in HttpUserAgent
Modified Paths:
--------------
tiki/examples/net/chatd/src/main.cpp
tiki/examples/net/httpclient/src/main.cpp
tiki/include/Tiki/net/address.h
tiki/include/Tiki/net/buffer.h
tiki/include/Tiki/net/http/request.h
tiki/include/Tiki/net/http/useragent.h
tiki/include/Tiki/net/socket.h
tiki/include/Tiki/net/tcpserversocket.h
tiki/include/Tiki/net/tcpsocket.h
tiki/src/net/http/request.cpp
tiki/src/net/http/useragent.cpp
tiki/src/net/socket.cpp
tiki/src/net/tcpserversocket.cpp
tiki/src/net/tcpsocket.cpp
Modified: tiki/examples/net/chatd/src/main.cpp
===================================================================
--- tiki/examples/net/chatd/src/main.cpp 2007-08-23 18:35:40 UTC (rev 488)
+++ tiki/examples/net/chatd/src/main.cpp 2007-08-23 22:59:57 UTC (rev 489)
@@ -82,7 +82,7 @@
{
uint8 *data = line->getData();
string cmd = "";
- for(int i = 0; i < line->getUsedDataLen(); i++)
+ for(size_t i = 0; i < line->getUsedDataLen(); i++)
{
cmd.push_back(data[i]);
}
Modified: tiki/examples/net/httpclient/src/main.cpp
===================================================================
--- tiki/examples/net/httpclient/src/main.cpp 2007-08-23 18:35:40 UTC (rev 488)
+++ tiki/examples/net/httpclient/src/main.cpp 2007-08-23 22:59:57 UTC (rev 489)
@@ -31,17 +31,12 @@
Tiki::Net::init();
Hid::callbackReg( tkCallback, NULL );
- if(argc < 2) {
- Tiki::Debug::printf("Need to pass request url on commandline\n");
- return -1;
- }
-
RefPtr<HttpUserAgent> useragent = new HttpUserAgent();
//useragent->setProxyHost("proxy.example.com");
//useragent->setProxyPort(80);
RefPtr<Request> request = new Request();
- request->setUrl(argv[1]);
+ request->setUrl("http://www.example.com/");
RefPtr<Response> response = useragent->get(request);
Tiki::Debug::printf("response code: %d\n", response->getResultCode());
@@ -51,12 +46,12 @@
iter != content.end();
++iter)
{
- RefPtr<Buffer> responseBuf = response->getContentPart(*iter);
+ Buffer *responseBuf = response->getContentPart(*iter);
Tiki::Debug::printf("Content Part: %s [%u bytes]\n", (*iter).c_str(), responseBuf->getUsedDataLen());
Tiki::Debug::printf("%s\n", responseBuf->getData());
}
-
Tiki::Net::shutdown();
+
return 0;
}
Modified: tiki/include/Tiki/net/address.h
===================================================================
--- tiki/include/Tiki/net/address.h 2007-08-23 18:35:40 UTC (rev 488)
+++ tiki/include/Tiki/net/address.h 2007-08-23 22:59:57 UTC (rev 489)
@@ -18,6 +18,9 @@
{
public:
Address();
+ Address(std::string hostname, int port) : m_port(port) {
+ setHostName(hostname);
+ }
typedef enum AddressType {
AddressUnknown = 0x00000000,
Modified: tiki/include/Tiki/net/buffer.h
===================================================================
--- tiki/include/Tiki/net/buffer.h 2007-08-23 18:35:40 UTC (rev 488)
+++ tiki/include/Tiki/net/buffer.h 2007-08-23 22:59:57 UTC (rev 489)
@@ -22,14 +22,16 @@
class Buffer : public Object
{
public:
- Buffer(size_t len, std::string contentType = "application/octet-stream") : m_contentType(contentType) {
+ Buffer(size_t len, std::string contentType = "application/octet-stream") :
+ m_contentType(contentType) {
m_data = new uint8[len];
memset(m_data, 0, len);
m_dataLen = len;
m_usedDataLen = 0;
}
- Buffer(size_t len, uint8 *data, std::string contentType = "application/octet-stream") : m_contentType(contentType) {
+ Buffer(size_t len, uint8 *data, std::string contentType = "application/octet-stream") :
+ m_contentType(contentType) {
m_data = new uint8[len];
memset(m_data, 0, len);
m_dataLen = len;
@@ -39,13 +41,9 @@
Buffer(std::string filename, std::string contentType, std::string fieldName = "") :
m_fileName(filename), m_contentType(contentType), m_fieldName(fieldName) {
- std::ifstream stream(filename.c_str(), std::ios::in | std::ios::binary);
- stream.seekg(0, std::ios::end);
- m_dataLen = m_usedDataLen = stream.tellg();
- stream.seekg(0);
- m_data = new uint8[m_dataLen];
- stream.read((char *)m_data, m_dataLen);
- stream.close();
+ File file(filename, "rb");
+ read(file);
+ file.close();
}
Buffer(Tiki::File file, std::string contentType, std::string fieldName = "") :
@@ -58,12 +56,12 @@
m_fileName = file.getFileName();
m_dataLen = m_usedDataLen = file.total();
m_data = new uint8[m_dataLen];
- file.read(m_data, m_dataLen);
+ file.read(m_data, static_cast<int>(m_dataLen));
}
void write(Tiki::File file) {
assert(file.isValid());
- file.write(m_data, m_usedDataLen);
+ file.write(m_data, static_cast<int>(m_usedDataLen));
}
void append(RefPtr<Buffer> buf) {
Modified: tiki/include/Tiki/net/http/request.h
===================================================================
--- tiki/include/Tiki/net/http/request.h 2007-08-23 18:35:40 UTC (rev 488)
+++ tiki/include/Tiki/net/http/request.h 2007-08-23 22:59:57 UTC (rev 489)
@@ -1,61 +1,74 @@
-/*
- Tiki
-
- useragent.h
-
- Copyright (C)2007 Atani Software
-*/
-#ifndef __TIKI_NET_HTTP_REQUEST_H
-#define __TIKI_NET_HTTP_REQUEST_H
-
-#include "Tiki/refcnt.h"
-
-namespace Tiki {
-
-namespace Net {
-
-namespace Http {
-
-extern std::string DEFAULT_CONTENT_PART;
-
-class Request : public RefCnt {
- public:
- Request();
-
- std::string getUrl() const {
- return m_url;
- }
-
- void setUrl(string url) {
- m_url = url;
- }
-
- void removeHeaderParam(std::string param);
- void setHeaderParam(std::string param, std::string value);
- std::string getHeaderParam(std::string param) const;
- std::list<std::string> getHeaderParamNames() const;
-
- void addContentPart(std::string name, RefPtr<Buffer> input);
- std::list<std::string> getContentPartNames() const;
- RefPtr<Buffer> getContentPart(std::string name) const;
-
- std::string getBoundaryMarker() const {
- return m_boundaryMarker;
- }
-
- private:
- std::string m_url;
- std::string m_boundaryMarker;
- typedef std::map<std::string, std::string> StringStringMap;
- typedef std::map<std::string, RefPtr< Buffer > > StringBufferMap;
- StringStringMap m_params;
- StringBufferMap m_parts;
-};
-
-}; // namespace Http
-
-}; // namespace Net
-
-}; // namespace Tiki
-
-#endif // __TIKI_NET_HTTP_REQUEST_H
+/*
+ Tiki
+
+ useragent.h
+
+ Copyright (C)2007 Atani Software
+*/
+#ifndef __TIKI_NET_HTTP_REQUEST_H
+#define __TIKI_NET_HTTP_REQUEST_H
+
+#include "Tiki/refcnt.h"
+
+namespace Tiki {
+
+namespace Net {
+
+namespace Http {
+
+extern std::string DEFAULT_CONTENT_PART;
+
+class Request : public RefCnt {
+ public:
+ Request();
+ /*
+ virtual ~Request() {
+ m_params.clear();
+ if(!m_parts.empty()) {
+ for(StringBufferMap::iterator iter = m_parts.begin();
+ iter != m_parts.end();
+ ++iter) {
+ delete iter->second;
+ }
+ }
+ m_parts.clear();
+ }
+ */
+
+ std::string getUrl() const {
+ return m_url;
+ }
+
+ void setUrl(string url) {
+ m_url = url;
+ }
+
+ void removeHeaderParam(std::string param);
+ void setHeaderParam(std::string param, std::string value);
+ std::string getHeaderParam(std::string param) const;
+ std::list<std::string> getHeaderParamNames() const;
+
+ void addContentPart(Buffer *input, std::string name = "");
+ std::list<std::string> getContentPartNames() const;
+ Buffer *getContentPart(std::string name) const;
+
+ std::string getBoundaryMarker() const {
+ return m_boundaryMarker;
+ }
+
+ private:
+ std::string m_url;
+ std::string m_boundaryMarker;
+ typedef std::map<std::string, std::string> StringStringMap;
+ typedef std::map<std::string, RefPtr<Buffer> > StringBufferMap;
+ StringStringMap m_params;
+ StringBufferMap m_parts;
+};
+
+}; // namespace Http
+
+}; // namespace Net
+
+}; // namespace Tiki
+
+#endif // __TIKI_NET_HTTP_REQUEST_H
Modified: tiki/include/Tiki/net/http/useragent.h
===================================================================
--- tiki/include/Tiki/net/http/useragent.h 2007-08-23 18:35:40 UTC (rev 488)
+++ tiki/include/Tiki/net/http/useragent.h 2007-08-23 22:59:57 UTC (rev 489)
@@ -1,82 +1,89 @@
-/*
- Tiki
-
- useragent.h
-
- Copyright (C)2007 Atani Software
-*/
-#ifndef __TIKI_NET_HTTP_USERAGENT_H
-#define __TIKI_NET_HTTP_USERAGENT_H
-
-#include "Tiki/refcnt.h"
-#include "Tiki/net/tcpsocket.h"
-#include "Tiki/net/http/cookie.h"
-#include "Tiki/net/http/request.h"
-#include "Tiki/net/http/response.h"
-
-namespace Tiki {
-
-namespace Net {
-
-namespace Http {
-
-using Tiki::Net::TCP::TCPSocket;
-
-class HttpUserAgent : public RefCnt {
-
- public:
- HttpUserAgent();
-
- void setUserAgentName(std::string name) {
- m_userAgentName = name;
- }
-
- std::string getUserAgentName() const {
- return m_userAgentName;
- }
-
- void setProxyHost(std::string host) {
- m_proxyHost = host;
- }
-
- std::string getProxyHost() const {
- return m_proxyHost;
- }
-
- void setProxyPort(int port) {
- m_proxyPort = port;
- }
-
- int getProxyPort() const {
- return m_proxyPort;
- }
-
- std::list< RefPtr< Cookie > > getCookies() const {
- return m_cookies;
- }
-
- RefPtr<Response> get(RefPtr<Request> req);
-
- RefPtr<Response> post(RefPtr<Request> req);
-
- private:
- std::string m_userAgentName;
- std::string m_proxyHost;
- int m_proxyPort;
- std::list< RefPtr< Cookie > > m_cookies;
-
- void parseUrl(const std::string url, std::string &host, std::string &resource, int &port);
- void buildRequest(const std::string host, const std::string resource, const int port,
- const std::string mode, RefPtr<Request> request, std::string &requestText,
- RefPtr<Address> address);
- void readResponse(RefPtr<Response> response, RefPtr<TCPSocket> socket);
-
-};
-
-}; // namespace Http
-
-}; // namespace Net
-
-}; // namespace Tiki
-
-#endif // __TIKI_NET_HTTP_USERAGENT_H
+/*
+ Tiki
+
+ useragent.h
+
+ Copyright (C)2007 Atani Software
+*/
+#ifndef __TIKI_NET_HTTP_USERAGENT_H
+#define __TIKI_NET_HTTP_USERAGENT_H
+
+#include "Tiki/refcnt.h"
+#include "Tiki/net/tcpsocket.h"
+#include "Tiki/net/http/cookie.h"
+#include "Tiki/net/http/request.h"
+#include "Tiki/net/http/response.h"
+
+namespace Tiki {
+
+namespace Net {
+
+namespace Http {
+
+using Tiki::Net::TCP::TCPSocket;
+
+class HttpUserAgent : public RefCnt {
+
+ public:
+ HttpUserAgent();
+ virtual ~HttpUserAgent() {
+ for(std::list< RefPtr< Cookie > >::iterator iter = m_cookies.begin();
+ iter != m_cookies.end();
+ ++iter) {
+ delete *iter;
+ }
+ m_cookies.clear();
+ }
+
+ void setUserAgentName(std::string name) {
+ m_userAgentName = name;
+ }
+
+ std::string getUserAgentName() const {
+ return m_userAgentName;
+ }
+
+ void setProxyHost(std::string host) {
+ m_proxyHost = host;
+ }
+
+ std::string getProxyHost() const {
+ return m_proxyHost;
+ }
+
+ void setProxyPort(int port) {
+ m_proxyPort = port;
+ }
+
+ int getProxyPort() const {
+ return m_proxyPort;
+ }
+
+ std::list< RefPtr< Cookie > > getCookies() const {
+ return m_cookies;
+ }
+
+ Response *get(Request *req);
+
+ Response *post(Request *req);
+
+ private:
+ std::string m_userAgentName;
+ std::string m_proxyHost;
+ int m_proxyPort;
+ std::list< RefPtr< Cookie > > m_cookies;
+
+ void parseUrl(const std::string url, std::string &host, std::string &resource, int &port);
+ void buildRequest(const std::string host, const std::string resource, const int port,
+ const std::string mode, Request *request, std::string &requestText);
+ void readResponse(Response *response, TCPSocket *socket);
+
+};
+
+}; // namespace Http
+
+}; // namespace Net
+
+}; // namespace Tiki
+
+#endif // __TIKI_NET_HTTP_USERAGENT_H
Modified: tiki/include/Tiki/net/socket.h
===================================================================
--- tiki/include/Tiki/net/socket.h 2007-08-23 18:35:40 UTC (rev 488)
+++ tiki/include/Tiki/net/socket.h 2007-08-23 22:59:57 UTC (rev 489)
@@ -20,24 +20,24 @@
{
public:
Socket();
- Socket(RefPtr<Address> address);
+ Socket(Address *address);
- RefPtr<Address> getPeerAddress()
+ Address *getPeerAddress()
{
return m_peerAddress;
}
- void setPeerAddress(RefPtr<Address> address)
+ void setPeerAddress(Address *address)
{
m_peerAddress = address;
}
- RefPtr<Address> getLocalAddress()
+ Address *getLocalAddress()
{
return m_localAddress;
}
- void setLocalAddress(RefPtr<Address> address)
+ void setLocalAddress(Address *address)
{
m_localAddress = address;
}
@@ -62,9 +62,9 @@
m_reuse = reuse;
}
- virtual void send(RefPtr<Buffer> data) = 0;
+ virtual void send(Buffer *data) = 0;
- virtual void recv(RefPtr<Buffer> data) = 0;
+ virtual void recv(Buffer *data) = 0;
virtual void open() = 0;
Modified: tiki/include/Tiki/net/tcpserversocket.h
===================================================================
--- tiki/include/Tiki/net/tcpserversocket.h 2007-08-23 18:35:40 UTC (rev 488)
+++ tiki/include/Tiki/net/tcpserversocket.h 2007-08-23 22:59:57 UTC (rev 489)
@@ -20,11 +20,11 @@
{
public:
TCPServerSocket() : TCPSocket() {};
- TCPServerSocket(RefPtr<Address> address) : TCPSocket(address) {};
+ TCPServerSocket(Address *address) : TCPSocket(address) {};
void bind(size_t maxwaiting = 10);
- RefPtr<TCPSocket> accept();
+ TCPSocket *accept();
};
} // namespace TCP
Modified: tiki/include/Tiki/net/tcpsocket.h
===================================================================
--- tiki/include/Tiki/net/tcpsocket.h 2007-08-23 18:35:40 UTC (rev 488)
+++ tiki/include/Tiki/net/tcpsocket.h 2007-08-23 22:59:57 UTC (rev 489)
@@ -32,27 +32,27 @@
#define SOCKET_ERROR -1
#endif
TCPSocket() : Socket(), m_open(false) {};
- TCPSocket(RefPtr<Address> address) : Socket(address), m_open(false) {};
+ TCPSocket(Address *address) : Socket(address), m_open(false) {};
#if TIKI_PLAT == TIKI_WIN32
- TCPSocket(RefPtr<Address> address, SOCKET socket) : Socket(address), m_socket(socket), m_open(true) {setNonBlocking(false);};
+ TCPSocket(Address *address, SOCKET socket) : Socket(address), m_socket(socket), m_open(true) {setNonBlocking(false);};
#else
TCPSocket(RefPtr<Address> address, int socket) : Socket(address), m_socket(socket), m_open(true) {setNonBlocking(false);};
#endif
- virtual void send(RefPtr<Buffer> data);
+ virtual void send(Buffer *data);
- virtual void recv(RefPtr<Buffer> data);
+ virtual void recv(Buffer *data);
virtual bool isOpen() {
return m_open;
}
- uint32 getPort()
+ uint16 getPort()
{
return m_port;
}
- void setPort(uint32 port)
+ void setPort(uint16 port)
{
m_port = port;
}
@@ -63,7 +63,7 @@
virtual void setNonBlocking(bool blocking);
protected:
- uint32 m_port;
+ uint16 m_port;
bool m_open;
#if TIKI_PLAT == TIKI_WIN32
SOCKET m_socket;
Modified: tiki/src/net/http/request.cpp
===================================================================
--- tiki/src/net/http/request.cpp 2007-08-23 18:35:40 UTC (rev 488)
+++ tiki/src/net/http/request.cpp 2007-08-23 22:59:57 UTC (rev 489)
@@ -1,96 +1,100 @@
-/*
- Tiki
-
- request.cpp
-
- Copyright (C)2007 Atani Software
-*/
-
-#include "pch.h"
-#include "Tiki/tiki.h"
-#include "Tiki/net.h"
-#include "Tiki/net/http/request.h"
-
-namespace Tiki {
-
-namespace Net {
-
-namespace Http {
-
-std::string DEFAULT_CONTENT_PART = "__TIKI__DEFAULT__";
-
-Request::Request() {
- setHeaderParam("Connection", "close");
- m_boundaryMarker = "-----------------------09f911019d74e35bd84156c5635688c0";
-
-}
-
-void Request::removeHeaderParam(std::string param) {
- if(m_params.find(param) != m_params.end()) {
- m_params.erase(m_params.find(param));
- }
-}
-
-void Request::setHeaderParam(std::string param, std::string value) {
- if(!param.compare("User-Agent")) {
- Tiki::Debug::printf("Setting User-Agent via Request::setHeaderParam() is not allowed. Use HttpUserAgent::setUserAgentName() instead.\n");
- return;
- }
- m_params.insert(std::make_pair(param, value));
-}
-
-std::string Request::getHeaderParam(std::string param) const {
- if(m_params.find(param) != m_params.end()) {
- return m_params.find(param)->second;
- }
- return "";
-}
-
-std::list<std::string> Request::getHeaderParamNames() const {
- std::list<std::string> params;
-
- for( StringStringMap::const_iterator param = m_params.begin();
- param != m_params.end();
- ++param) {
-
- params.push_back(param->first);
- }
-
- return params;
-}
-
-void Request::addContentPart(std::string name, RefPtr<Buffer> input) {
- //if(m_parts.find(name) != m_parts.end()) {
- // m_parts.erase(m_parts.find(name));
- //}
-
- m_parts.insert(std::make_pair(name, input));
-}
-
-RefPtr<Buffer> Request::getContentPart(std::string name) const {
- if(m_parts.find(name) != m_parts.end()) {
- return m_parts.find(name)->second;
- }
- return NULL;
-}
-
-std::list<std::string> Request::getContentPartNames() const {
- std::list<std::string> parts;
-
- for( StringBufferMap::const_iterator part = m_parts.begin();
- part != m_parts.end();
- ++part) {
-
- parts.push_back(part->first);
- }
-
- return parts;
-}
-
-
-}; // namespace Http
-
-}; // namespace Net
-
-}; // namespace Tiki
-
+/*
+ Tiki
+
+ request.cpp
+
+ Copyright (C)2007 Atani Software
+*/
+
+#include "pch.h"
+#include "Tiki/tiki.h"
+#include "Tiki/net.h"
+#include "Tiki/net/http/request.h"
+
+namespace Tiki {
+
+namespace Net {
+
+namespace Http {
+
+std::string DEFAULT_CONTENT_PART = "__TIKI__DEFAULT__";
+
+Request::Request() {
+ setHeaderParam("Connection", "close");
+ m_boundaryMarker = "-----------------------09f911019d74e35bd84156c5635688c0";
+
+}
+
+void Request::removeHeaderParam(std::string param) {
+ if(m_params.find(param) != m_params.end()) {
+ m_params.erase(m_params.find(param));
+ }
+}
+
+void Request::setHeaderParam(std::string param, std::string value) {
+ if(!param.compare("User-Agent")) {
+ Tiki::Debug::printf("Setting User-Agent via Request::setHeaderParam() is not allowed. Use HttpUserAgent::setUserAgentName() instead.\n");
+ return;
+ }
+ m_params.insert(std::make_pair(param, value));
+}
+
+std::string Request::getHeaderParam(std::string param) const {
+ if(m_params.find(param) != m_params.end()) {
+ return m_params.find(param)->second;
+ }
+ return "";
+}
+
+std::list<std::string> Request::getHeaderParamNames() const {
+ std::list<std::string> params;
+
+ for( StringStringMap::const_iterator param = m_params.begin();
+ param != m_params.end();
+ ++param) {
+
+ params.push_back(param->first);
+ }
+
+ return params;
+}
+
+void Request::addContentPart(Buffer *input, std::string name) {
+ if(!name.empty()) {
+ m_parts.insert(std::make_pair(name, input));
+ }
+ else if(!input->getFileName().empty()) {
+ m_parts.insert(std::make_pair(input->getFileName(), input));
+ }
+ else {
+ m_parts.insert(std::make_pair(DEFAULT_CONTENT_PART, input));
+ }
+}
+
+Buffer *Request::getContentPart(std::string name) const {
+ if(m_parts.find(name) != m_parts.end()) {
+ return m_parts.find(name)->second;
+ }
+ return NULL;
+}
+
+std::list<std::string> Request::getContentPartNames() const {
+ std::list<std::string> parts;
+
+ for( StringBufferMap::const_iterator part = m_parts.begin();
+ part != m_parts.end();
+ ++part) {
+
+ parts.push_back(part->first);
+ }
+
+ return parts;
+}
+
+
+}; // namespace Http
+
+}; // namespace Net
+
+}; // namespace Tiki
+
Modified: tiki/src/net/http/useragent.cpp
===================================================================
--- tiki/src/net/http/useragent.cpp 2007-08-23 18:35:40 UTC (rev 488)
+++ tiki/src/net/http/useragent.cpp 2007-08-23 22:59:57 UTC (rev 489)
@@ -1,397 +1,396 @@
-/*
- Tiki
-
- useragent.cpp
-
- Copyright (C)2007 Atani Software
-*/
-
-#include "pch.h"
-#include "Tiki/tiki.h"
-#include "Tiki/net.h"
-#include "Tiki/net/http/useragent.h"
-
-#include <sstream>
-#include <math.h>
-
-namespace Tiki {
-
-namespace Net {
-
-namespace Http {
-
-using namespace Tiki::Net::TCP;
-
-#define READ_ONE_LINE(res, socket) \
- { \
- RefPtr<Buffer> recvBuf = new Buffer(1); \
- char tbuf[2]; \
- res = ""; \
- while(socket->isOpen()) { \
- recvBuf->reset(); \
- socket->recv(recvBuf); \
- if(recvBuf->getUsedDataLen() > 0) { \
- tbuf[0] = recvBuf->getData()[0]; \
- tbuf[1] = '\0'; \
- if(tbuf[0] != '\n' && tbuf[0] != '\r' ) { \
- res.append((char *)tbuf); \
- } \
- else if(tbuf[0] != '\r' ) { \
- break; \
- } \
- } \
- } \
- }
-
-HttpUserAgent::HttpUserAgent() {
-#if TIKI_PLAT == TIKI_WIN32
- setUserAgentName("Tiki/1.0 (Windows)");
-#elif TIKI_PLAT == TIKI_NDS
- setUserAgentName("Tiki/1.0 (Nintendo DS)");
-#elif TIKI_PLAT == TIKI_SDL
- setUserAgentName("Tiki/1.0 (SDL)");
-#elif TIKI_PLAT == TIKI_OSX
- setUserAgentName("Tiki/1.0 (Mac OS X)");
-#else
- setUserAgentName("Tiki/1.0 (Unknown)");
-#endif
- setProxyHost("");
- setProxyPort(8080);
-}
-
-RefPtr<Response> HttpUserAgent::get(RefPtr<Request> req) {
- RefPtr<TCPSocket> socket = new TCPSocket();
- socket->setNonBlocking(false);
- RefPtr<Response> response = new Response();
- response->setUrl(req->getUrl());
- response->setResultCode(200);
-
- std::string hostname;
- int port;
- std::string resource;
-
- parseUrl(req->getUrl(), hostname, resource, port);
-
- RefPtr<Address> requestAddress = new Address();
-
- std::string requestText;
- buildRequest(hostname, resource, port, "GET", req, requestText, requestAddress);
- socket->setPeerAddress(requestAddress);
- Tiki::Debug::printf("Request:\n%s", requestText.c_str());
-
- socket->open();
- if(socket->isOpen()) {
- Tiki::Debug::printf("Sending request...\n");
- }
- else {
- Tiki::Debug::printf("connect failed\n");
- response->setResultCode(504);
- return response;
- }
-
- RefPtr<Buffer> buf = new Buffer(2048);
- buf->setData((uint8 *)requestText.c_str(), requestText.length());
- socket->send(buf);
-
- readResponse(response, socket);
-
- return response;
-}
-
-RefPtr<Response> HttpUserAgent::post(RefPtr<Request> req) {
- RefPtr<TCPSocket> socket = new TCPSocket();
- socket->setNonBlocking(false);
- RefPtr<Response> response = new Response();
- response->setUrl(req->getUrl());
- response->setResultCode(200);
-
- std::string hostname;
- int port;
- std::string resource;
-
- parseUrl(req->getUrl(), hostname, resource, port);
-
- RefPtr<Address> requestAddress = new Address();
-
- std::string requestText;
- buildRequest(hostname, resource, port, "POST", req, requestText, requestAddress);
- socket->setPeerAddress(requestAddress);
- Tiki::Debug::printf("Request:\n%s", requestText.c_str());
-
- socket->open();
- if(socket->isOpen()) {
- Tiki::Debug::printf("Sending request...\n");
- }
- else {
- Tiki::Debug::printf("connect failed\n");
- response->setResultCode(504);
- return response;
- }
-
- RefPtr<Buffer> buf = new Buffer(2048);
- buf->setData((uint8 *)requestText.c_str(), requestText.length());
- socket->send(buf);
-
- std::list<std::string> content = req->getContentPartNames();
- if(content.size() > 1) {
- for(std::list<std::string>::iterator iter = content.begin();
- iter != content.end();
- ++iter) {
- RefPtr<Buffer> buf = req->getContentPart(*iter);
- std::stringstream temp;
- temp << req->getBoundaryMarker() << "\r\n";
- temp << "Content-Disposition: form-data: name=\"";
- if(!buf->getFieldName().empty()) {
- temp << buf->getFieldName();
- }
- else {
- temp << "File";
- }
- temp << "\"; filename=\"" << buf->getFileNameShort() << "\"\r\nContent-Type: " << buf->getContentType() << "\r\n";
- RefPtr<Buffer> headerBuf = new Buffer(2048);
- std::string headerText = temp.str();
- headerBuf->setData((uint8 *)headerText.c_str(), headerText.length());
- socket->send(headerBuf);
- socket->send(buf);
- }
- std::string footerText = "--";
- footerText.append(req->getBoundaryMarker());
- footerText.append("--\r\n");
- RefPtr<Buffer> footerBuf = new Buffer(2048);
- footerBuf->setData((uint8 *)footerText.c_str(), footerText.length());
- socket->send(footerBuf);
- }
- else if(content.size() == 1) {
- RefPtr<Buffer> buf = req->getContentPart(*content.begin());
- socket->send(buf);
- }
-
- readResponse(response, socket);
-
- return response;
-}
-
-void HttpUserAgent::parseUrl(const std::string url, std::string &host, std::string &resource, int &port) {
- std::string temp_url = url;
-
- // set defaults
- host = "";
- port = 80;
- resource = "/index.html";
-
- if(temp_url.find("http://") == 0) {
- temp_url = temp_url.substr(std::string("http://").length());
- }
- else if(temp_url.find("https://") == 0) {
- temp_url = temp_url.substr(std::string("https://").length());
- }
- host = temp_url.substr(0, temp_url.find("/"));
- if(temp_url.find("/") != std::string::npos) {
- resource = temp_url.substr(temp_url.find("/"));
- }
- if(host.find(":") != std::string::npos) {
- std::string portstr = url.substr(host.find(":"));
- port = atoi(portstr.c_str());
- host = host.substr(0, host.find(":"));
- }
-}
-
-void HttpUserAgent::buildRequest(const std::string host, const std::string resource, const int port,
- const std::string mode, RefPtr<Request> request, std::string &requestText,
- RefPtr<Address> address) {
-
- std::stringstream req;
- if(m_proxyHost.empty()) {
- req << mode << " " << resource << " HTTP/1.1\r\n";
- req << "Host: " << host << "\r\n";
- address->setHostName(host);
- address->setPort(port);
- }
- else {
- // proxy connection
- req << mode << " " << request->getUrl();
- if(port != 80) {
- req << ":" << port;
- }
- req << " HTTP/1.1\r\n";
- req << "Host: " << host << "\r\n";
- address->setHostName(m_proxyHost);
- address->setPort(m_proxyPort);
- }
- std::list<std::string> params = request->getHeaderParamNames();
- for(std::list<string>::const_iterator param = params.begin();
- param != params.end();
- ++param) {
- req << *param << ": " << request->getHeaderParam(*param) << "\r\n";
- }
-
- if(!m_userAgentName.empty()) {
- req << "User-Agent: " << m_userAgentName << "\r\n";
- }
-
- std::list<std::string> content = request->getContentPartNames();
- if(!mode.compare("POST") && content.size() > 1) {
- uint64 totalSize = request->getBoundaryMarker().length() + 6; // add 6 to account for "--<boundary>--\r\n"
- for(std::list<std::string>::iterator iter = content.begin();
- iter != content.end();
- ++iter) {
- RefPtr<Buffer> buf = request->getContentPart(*iter);
- totalSize += buf->getUsedDataLen();
- std::stringstream temp;
- temp << "Content-Disposition: form-data: name=\"";
- if(!buf->getFieldName().empty()) {
- temp << buf->getFieldName();
- }
- else {
- temp << "File";
- }
- temp << "\"; filename=\"" << buf->getFileNameShort() << "\"\r\nContent-Type: " << buf->getContentType() << "\r\n";
-
- // add section header size
- totalSize += temp.str().length();
- }
-
- req << "Content-Length: " << totalSize << "\r\n";
- req << "Expect: 100-continue\r\n";
- req << "Content-Type: multipart/form-data; boundary=" << request->getBoundaryMarker() << "\r\n";
- }
- else if(!mode.compare("POST") && content.size() == 1) {
- RefPtr<Buffer> buf = request->getContentPart(*content.begin());
- req << "Content-Type: " << buf->getContentType() << "\r\n";
- req << "Content-Length: " << buf->getUsedDataLen() << "\r\n";
- }
- req << "\r\n";
-
- requestText = req.str();
-}
-
-void HttpUserAgent::readResponse(RefPtr<Response> response, RefPtr<TCPSocket> socket) {
- std::string status = "";
- READ_ONE_LINE(status, socket)
-
- //Tiki::Debug::printf("Status: %s\n", status.c_str());
- for(int i = 0; i < status.length(); i++) {
- if(status.at(i) == ' ') {
- response->setResultCode(atoi(status.c_str()+i + 1));
- break;
- }
- }
-
- while(1) {
- std::string line = "";
- READ_ONE_LINE(line, socket)
- if(line.size() == 0) {
- // done with headers
- break;
- }
- //Tiki::Debug::printf("HEADER_LINE: %s\n", line.c_str());
- if(line.find(":") != std::string::npos) {
- std::string field = line.substr(0, line.find(":"));
- std::string value = line.substr(line.find(":") + 1);
- while(value.at(0) == ' ') {
- value = value.substr(1);
- }
-
- if(!field.compare("Set-Cookie")) {
-
- }
- else {
- response->setHeaderParam(field, value);
- }
- }
- }
-
- RefPtr<Buffer> fullBuf = new Buffer(1);
-
- if(!response->getHeaderParam("Transfer-Encoding").compare("chunked")) {
- Tiki::Debug::printf("Encoding is chunked\n");
- // evil chunked encoding
- size_t totalSize = 0;
-
- long sizeDecoded = 0;
- do
- {
- sizeDecoded = 0;
- std::string size = "";
- READ_ONE_LINE(size, socket);
- if(size.empty()) {
- sizeDecoded = 1;
- continue;
- }
-
- while(size.find(" ") != std::string::npos) {
- size.erase(size.find(" "), 1);
- }
-
- int base = 1;
- for(int i = 0; i < size.length(); i++ ) {
- char ch = size.at(i);
- if(ch >= 'A' && ch <= 'F') {
- ch -= 'A';
- ch += 10;
- }
- else if(ch >= 'a' && ch <= 'f') {
- ch -= 'a';
- ch += 10;
- }
- else if(ch >= '0' && ch <= '9') {
- ch -= '0';
- }
- else {
- continue;
- }
- sizeDecoded += (ch * static_cast<int>(pow(16.0f, static_cast<int>(size.length() - i - 1))));
- }
- //Tiki::Debug::printf("chunk size: %d [%s]\n", sizeDecoded, size.c_str());
- if(sizeDecoded > 0) {
-
- RefPtr<Buffer> chunkBuf = new Buffer(sizeDecoded);
- socket->recv(chunkBuf);
- if(chunkBuf->getUsedDataLen() < sizeDecoded)
- {
- //Tiki::Debug::printf("Buffer underflow\n");
- int needed = sizeDecoded - chunkBuf->getUsedDataLen();
- while(needed > 0) {
- RefPtr<Buffer> chunkBuf2 = new Buffer(needed);
- socket->recv(chunkBuf2);
- chunkBuf->append(chunkBuf2);
- needed -= chunkBuf2->getUsedDataLen();
- }
- }
- totalSize += chunkBuf->getUsedDataLen();
- fullBuf->append(chunkBuf);
- }
- } while(sizeDecoded > 0);
- //Tiki::Debug::printf("total size: %d %x\n", totalSize, totalSize);
- }
- else if(response->...
[truncated message content] |
|
From: <at...@us...> - 2007-08-24 02:55:11
|
Revision: 491
http://cadcdev.svn.sourceforge.net/cadcdev/?rev=491&view=rev
Author: atani
Date: 2007-08-23 19:55:09 -0700 (Thu, 23 Aug 2007)
Log Message:
-----------
more fixes to uploading files via POST.
Added Request.setForcedMultiPartUpload()
commented many Debug::printf lines
Modified Paths:
--------------
tiki/include/Tiki/net/buffer.h
tiki/include/Tiki/net/http/request.h
tiki/src/net/http/request.cpp
tiki/src/net/http/useragent.cpp
tiki/src/net/tcpsocket.cpp
Modified: tiki/include/Tiki/net/buffer.h
===================================================================
--- tiki/include/Tiki/net/buffer.h 2007-08-23 23:28:54 UTC (rev 490)
+++ tiki/include/Tiki/net/buffer.h 2007-08-24 02:55:09 UTC (rev 491)
@@ -8,7 +8,7 @@
#ifndef __TIKI_NET_BUFFER_H
#define __TIKI_NET_BUFFER_H
-#include "Tiki/object.h"
+#include "Tiki/refcnt.h"
#include "Tiki/file.h"
#include <fstream>
@@ -19,13 +19,15 @@
using Tiki::File;
-class Buffer : public Object
+class Buffer : public RefCnt
{
public:
Buffer(size_t len, std::string contentType = "application/octet-stream") :
m_contentType(contentType) {
- m_data = new uint8[len];
- memset(m_data, 0, len);
+ if(len > 0) {
+ m_data = new uint8[len];
+ memset(m_data, 0, len);
+ }
m_dataLen = len;
m_usedDataLen = 0;
}
@@ -64,9 +66,11 @@
file.write(m_data, static_cast<int>(m_usedDataLen));
}
- void append(RefPtr<Buffer> buf) {
+ void append(Buffer *buf) {
uint8 * newbuf = new uint8[ m_dataLen + buf->getDataLen() ];
- memcpy(newbuf, m_data, m_usedDataLen);
+ if(m_data != NULL) {
+ memcpy(newbuf, m_data, m_usedDataLen);
+ }
memcpy(newbuf + m_usedDataLen, buf->getData(), buf->getUsedDataLen());
delete [] m_data;
m_data = newbuf;
@@ -75,12 +79,16 @@
}
void reset() {
- memset(m_data, 0, m_dataLen);
+ if(m_data != NULL) {
+ memset(m_data, 0, m_dataLen);
+ }
m_usedDataLen = 0;
}
uint8 *getData() const {
- m_data[m_usedDataLen] = '\0';
+ if(m_usedDataLen > 0) {
+ m_data[m_usedDataLen] = '\0';
+ }
return m_data;
}
Modified: tiki/include/Tiki/net/http/request.h
===================================================================
--- tiki/include/Tiki/net/http/request.h 2007-08-23 23:28:54 UTC (rev 490)
+++ tiki/include/Tiki/net/http/request.h 2007-08-24 02:55:09 UTC (rev 491)
@@ -56,6 +56,14 @@
return m_boundaryMarker;
}
+ void setForcedMultiPartUpload(bool mode) {
+ m_forcedMultiPart = mode;
+ }
+
+ bool isForcedMultiPartUpload() const {
+ return m_forcedMultiPart;
+ }
+
private:
std::string m_url;
std::string m_boundaryMarker;
@@ -63,6 +71,7 @@
typedef std::map<std::string, RefPtr<Buffer> > StringBufferMap;
StringStringMap m_params;
StringBufferMap m_parts;
+ bool m_forcedMultiPart;
};
}; // namespace Http
Modified: tiki/src/net/http/request.cpp
===================================================================
--- tiki/src/net/http/request.cpp 2007-08-23 23:28:54 UTC (rev 490)
+++ tiki/src/net/http/request.cpp 2007-08-24 02:55:09 UTC (rev 491)
@@ -21,8 +21,8 @@
Request::Request() {
setHeaderParam("Connection", "close");
- m_boundaryMarker = "-----------------------09f911019d74e35bd84156c5635688c0";
-
+ m_boundaryMarker = "--09f911019d74e35bd84156c5635688c0";
+ m_forcedMultiPart = false;
}
void Request::removeHeaderParam(std::string param) {
Modified: tiki/src/net/http/useragent.cpp
===================================================================
--- tiki/src/net/http/useragent.cpp 2007-08-23 23:28:54 UTC (rev 490)
+++ tiki/src/net/http/useragent.cpp 2007-08-24 02:55:09 UTC (rev 491)
@@ -24,7 +24,7 @@
#define READ_ONE_LINE(res, socket) \
{ \
- RefPtr<Buffer> recvBuf = new Buffer(1); \
+ Buffer *recvBuf = new Buffer(1); \
char tbuf[2]; \
res = ""; \
while(socket->isOpen()) { \
@@ -41,6 +41,7 @@
} \
} \
} \
+ delete recvBuf; \
}
HttpUserAgent::HttpUserAgent() {
@@ -73,9 +74,9 @@
std::string requestText;
buildRequest(hostname, resource, port, "GET", req, requestText);
- Tiki::Debug::printf("Request:\n%s", requestText.c_str());
+ //Tiki::Debug::printf("Request:\n%s", requestText.c_str());
- RefPtr<TCPSocket> socket;
+ TCPSocket *socket;
if(m_proxyHost.empty()) {
socket = new TCPSocket(new Address(hostname, port));
}
@@ -86,24 +87,20 @@
socket->setNonBlocking(false);
socket->open();
- if(socket->isOpen()) {
- Tiki::Debug::printf("Sending request...\n");
- }
- else {
+ if(!socket->isOpen()) {
Tiki::Debug::printf("connect failed\n");
response->setResultCode(504);
return response;
}
- RefPtr<Buffer> buf = new Buffer(2048);
- buf->setData((uint8 *)requestText.c_str(), requestText.length());
- socket->send(buf);
+ Tiki::Debug::printf("Sending request...\n");
+ socket->send(new Buffer(requestText.length(), (uint8 *)requestText.c_str()));
readResponse(response, socket);
socket->close();
- //delete socket;
+ delete socket;
return response;
}
@@ -121,9 +118,9 @@
std::string requestText;
buildRequest(hostname, resource, port, "POST", req, requestText);
- Tiki::Debug::printf("Request:\n%s", requestText.c_str());
+ //Tiki::Debug::printf("Request:\n%s", requestText.c_str());
- RefPtr<TCPSocket> socket;
+ TCPSocket *socket;
if(m_proxyHost.empty()) {
socket = new TCPSocket(new Address(hostname, port));
}
@@ -134,61 +131,59 @@
socket->setNonBlocking(false);
socket->open();
- if(socket->isOpen()) {
- Tiki::Debug::printf("Sending request...\n");
- }
- else {
+ if(!socket->isOpen()) {
Tiki::Debug::printf("connect failed\n");
response->setResultCode(504);
return response;
}
- RefPtr<Buffer> buf = new Buffer(2048);
- buf->setData((uint8 *)requestText.c_str(), requestText.length());
- socket->send(buf);
+ Tiki::Debug::printf("Sending request...\n");
+ socket->send(new Buffer(requestText.length(), (uint8 *)requestText.c_str()));
std::list<std::string> content = req->getContentPartNames();
- if(content.size() > 1) {
+ if(content.size() > 1 || req->isForcedMultiPartUpload()) {
std::string status = "";
READ_ONE_LINE(status, socket)
for(std::list<std::string>::iterator iter = content.begin();
iter != content.end();
++iter) {
- RefPtr<Buffer> buf = req->getContentPart(*iter);
- std::stringstream temp;
- temp << req->getBoundaryMarker() << "\r\n";
- temp << "Content-Disposition: form-data: name=\"";
- if(!buf->getFieldName().empty()) {
- temp << buf->getFieldName();
+ Buffer *buf = req->getContentPart(*iter);
+ if(buf->getUsedDataLen() > 0) {
+ std::stringstream temp;
+ temp << "--" << req->getBoundaryMarker() << "\r\n";
+ temp << "Content-Disposition: form-data: name=\"";
+ if(!buf->getFieldName().empty()) {
+ temp << buf->getFieldName();
+ }
+ else {
+ temp << "File";
+ }
+ temp << "\"; filename=\"" << buf->getFileNameShort() << "\"\r\nContent-Type: " << buf->getContentType() << "\r\n";
+ std::string headerText = temp.str();
+ //Tiki::Debug::printf("CONTENT_HEADER:\n%s", headerText.c_str());
+ socket->send(new Buffer(headerText.length(), (uint8 *)headerText.c_str()));
+ socket->send(buf);
}
- else {
- temp << "File";
- }
- temp << "\"; filename=\"" << buf->getFileNameShort() << "\"\r\nContent-Type: " << buf->getContentType() << "\r\n";
- RefPtr<Buffer> headerBuf = new Buffer(2048);
- std::string headerText = temp.str();
- headerBuf->setData((uint8 *)headerText.c_str(), headerText.length());
- socket->send(headerBuf);
- socket->send(buf);
}
std::string footerText = "--";
footerText.append(req->getBoundaryMarker());
footerText.append("--\r\n");
- RefPtr<Buffer> footerBuf = new Buffer(2048);
- footerBuf->setData((uint8 *)footerText.c_str(), footerText.length());
- socket->send(footerBuf);
+ //Tiki::Debug::printf("CONTENT_FOOTER:\n%s", footerText.c_str());
+ socket->send(new Buffer(footerText.length(), (uint8 *)footerText.c_str()));
}
else if(content.size() == 1) {
- RefPtr<Buffer> buf = req->getContentPart(*content.begin());
- socket->send(buf);
+ Buffer *buf = req->getContentPart(*content.begin());
+ if(buf->getUsedDataLen() > 0) {
+ socket->send(buf);
+ }
}
readResponse(response, socket);
socket->close();
- //delete socket;
+ delete socket;
return response;
}
@@ -247,25 +242,27 @@
}
std::list<std::string> content = request->getContentPartNames();
- if(!mode.compare("POST") && content.size() > 1) {
- uint64 totalSize = request->getBoundaryMarker().length() + 6; // add 6 to account for "--<boundary>--\r\n"
+ if(!mode.compare("POST") && (content.size() > 1 || request->isForcedMultiPartUpload())) {
+ uint64 totalSize = 8; // add 8 to account for "--<boundary>--\r\n"
for(std::list<std::string>::iterator iter = content.begin();
iter != content.end();
++iter) {
- RefPtr<Buffer> buf = request->getContentPart(*iter);
- totalSize += buf->getUsedDataLen();
- std::stringstream temp;
- temp << "Content-Disposition: form-data: name=\"";
- if(!buf->getFieldName().empty()) {
- temp << buf->getFieldName();
+ Buffer *buf = request->getContentPart(*iter);
+ if(buf->getUsedDataLen() > 0) {
+ totalSize += buf->getUsedDataLen();
+ std::stringstream temp;
+ temp << "Content-Disposition: form-data: name=\"";
+ if(!buf->getFieldName().empty()) {
+ temp << buf->getFieldName();
+ }
+ else {
+ temp << "File";
+ }
+ temp << "\"; filename=\"" << buf->getFileNameShort() << "\"\r\nContent-Type: " << buf->getContentType() << "\r\n";
+
+ // add section header size
+ totalSize += temp.str().length();
}
- else {
- temp << "File";
- }
- temp << "\"; filename=\"" << buf->getFileNameShort() << "\"\r\nContent-Type: " << buf->getContentType() << "\r\n";
-
- // add section header size
- totalSize += temp.str().length();
}
req << "Content-Length: " << totalSize << "\r\n";
@@ -273,7 +270,7 @@
req << "Content-Type: multipart/form-data; boundary=" << request->getBoundaryMarker() << "\r\n";
}
else if(!mode.compare("POST") && content.size() == 1) {
- RefPtr<Buffer> buf = request->getContentPart(*content.begin());
+ Buffer *buf = request->getContentPart(*content.begin());
req << "Content-Type: " << buf->getContentType() << "\r\n";
req << "Content-Length: " << buf->getUsedDataLen() << "\r\n";
}
@@ -344,21 +341,23 @@
//Tiki::Debug::printf("chunk size: %d [%s]\n", sizeDecoded, size.c_str());
if(sizeDecoded > 0) {
- RefPtr<Buffer> chunkBuf = new Buffer(sizeDecoded);
+ Buffer *chunkBuf = new Buffer(sizeDecoded);
socket->recv(chunkBuf);
if(chunkBuf->getUsedDataLen() < sizeDecoded)
{
//Tiki::Debug::printf("Buffer underflow\n");
size_t needed = sizeDecoded - chunkBuf->getUsedDataLen();
while(needed > 0) {
- RefPtr<Buffer> chunkBuf2 = new Buffer(needed);
+ Buffer *chunkBuf2 = new Buffer(needed);
socket->recv(chunkBuf2);
chunkBuf->append(chunkBuf2);
needed -= chunkBuf2->getUsedDataLen();
+ delete chunkBuf2;
}
}
totalSize += chunkBuf->getUsedDataLen();
fullBuf->append(chunkBuf);
+ delete chunkBuf;
}
} while(sizeDecoded > 0);
//Tiki::Debug::printf("total size: %d %x\n", totalSize, totalSize);
@@ -368,22 +367,30 @@
size_t sizeDecoded = atoi(response->getHeaderParam("Content-Length").c_str());
//Tiki::Debug::printf("decodedSize: %d\n", sizeDecoded);
- RefPtr<Buffer> chunkBuf = new Buffer(sizeDecoded);
+ Buffer *chunkBuf = new Buffer(sizeDecoded);
socket->recv(chunkBuf);
if(chunkBuf->getUsedDataLen() < sizeDecoded)
{
sizeDecoded -= chunkBuf->getUsedDataLen();
while(sizeDecoded > 0) {
- RefPtr<Buffer> chunkBuf2 = new Buffer(sizeDecoded);
+ Buffer *chunkBuf2 = new Buffer(sizeDecoded);
socket->recv(chunkBuf2);
chunkBuf->append(chunkBuf2);
sizeDecoded -= chunkBuf2->getUsedDataLen();
+ delete chunkBuf2;
}
}
fullBuf->append(chunkBuf);
+ delete chunkBuf;
}
else {
Tiki::Debug::printf("Encoding is unknown\n");
+ Tiki::Debug::printf("Dumping headers\nHEADER NAME -> VALUE");
+ for(std::list<std::string>::iterator iter = response->getHeaderParamNames().begin();
+ iter != response->getHeaderParamNames().end();
+ ++iter) {
+ Tiki::Debug::printf("%s -> %s\n", (*iter).c_str(), response->getHeaderParam(*iter).c_str());
+ }
}
response->addContentPart(fullBuf, DEFAULT_CONTENT_PART);
}
Modified: tiki/src/net/tcpsocket.cpp
===================================================================
--- tiki/src/net/tcpsocket.cpp 2007-08-23 23:28:54 UTC (rev 490)
+++ tiki/src/net/tcpsocket.cpp 2007-08-24 02:55:09 UTC (rev 491)
@@ -24,10 +24,10 @@
int len;
do {
- Tiki::Debug::printf("sending %d bytes\n", dataLen);
+ //Tiki::Debug::printf("sending %d bytes\n", dataLen);
len = ::send(m_socket, (const char *)data, (int)dataLen, 0);
if(len > 0) {
- Tiki::Debug::printf("sent %d bytes\n", len);
+ //Tiki::Debug::printf("sent %d bytes\n", len);
dataLen -= len;
data += len;
}
@@ -71,7 +71,7 @@
int yes = 1;
#if TIKI_PLAT != TIKI_NDS
- Tiki::Debug::printf("setting TCP_NODELAY\n");
+ //Tiki::Debug::printf("setting TCP_NODELAY\n");
setsockopt(m_socket, IPPROTO_TCP, TCP_NODELAY, (char *)&yes, sizeof(yes));
#endif
@@ -91,13 +91,13 @@
sock_addr.sin_family = AF_INET;
sock_addr.sin_addr.s_addr = getPeerAddress()->getIPAddress();
sock_addr.sin_port = htons(getPeerAddress()->getPort());
- Tiki::Debug::printf("connecting to peer [%s->%s]\n", getPeerAddress()->getHostName().c_str(), getPeerAddress()->getIPAddressString().c_str());
+ //Tiki::Debug::printf("connecting to peer [%s->%s]\n", getPeerAddress()->getHostName().c_str(), getPeerAddress()->getIPAddressString().c_str());
if( ::connect( m_socket, (struct sockaddr *)&sock_addr, sizeof(struct sockaddr_in)) == SOCKET_ERROR) {
Tiki::Debug::printf("Error opening socket\n");
close();
return;
}
- Tiki::Debug::printf("Connected..\n");
+ //Tiki::Debug::printf("Connected..\n");
}
m_open = true;
}
@@ -118,7 +118,7 @@
void TCPSocket::setNonBlocking(bool blocking)
{
- Tiki::Debug::printf("%sabling blocking\n", blocking ? "dis" : "en" );
+ //Tiki::Debug::printf("%sabling blocking\n", blocking ? "dis" : "en" );
Socket::setNonBlocking(blocking);
#if TIKI_PLAT == TIKI_WIN32
unsigned long mode = (!blocking);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <at...@us...> - 2007-08-26 11:09:40
|
Revision: 493
http://cadcdev.svn.sourceforge.net/cadcdev/?rev=493&view=rev
Author: atani
Date: 2007-08-24 19:07:26 -0700 (Fri, 24 Aug 2007)
Log Message:
-----------
added Code::Blocks project/workspace for SDL build
added new method: Request::setAuthentication()
added Tiki::Net::Util::Base64 class
fixed pngconf.h comment (astyle mangled it)
removed old Tiki.xcode files (old XCode version)
modified font.cpp to use macros from pch.h instead of TIKI_PLAT==TIKI_WIN32 blocks
Modified Paths:
--------------
tiki/3rdparty/libpng/pngconf.h
tiki/include/Tiki/net/buffer.h
tiki/include/Tiki/net/http/request.h
tiki/include/Tiki/net/tcpsocket.h
tiki/include/Tiki/net.h
tiki/nds/Makefile
tiki/sdl/Makefile
tiki/sdl/src/init_shutdown.cpp
tiki/sdl/src/platgl.cpp
tiki/sdl/src/plathid.cpp
tiki/sdl/src/platnet.cpp
tiki/sdl/src/platthread.cpp
tiki/sdl/src/tikitime.cpp
tiki/src/gl/font.cpp
tiki/src/net/http/request.cpp
Added Paths:
-----------
tiki/include/Tiki/net/util/
tiki/include/Tiki/net/util/base64.h
tiki/sdl/TikiSDL.cbp
tiki/sdl/TikiSDL.workspace
tiki/src/net/util/
tiki/src/net/util/base64.cpp
Removed Paths:
-------------
tiki/osx/Tiki.xcode/
Modified: tiki/3rdparty/libpng/pngconf.h
===================================================================
--- tiki/3rdparty/libpng/pngconf.h 2007-08-25 00:14:06 UTC (rev 492)
+++ tiki/3rdparty/libpng/pngconf.h 2007-08-25 02:07:26 UTC (rev 493)
@@ -29,7 +29,7 @@
/*
* Added at libpng-1.2.8
- *
+ *
* If you create a private DLL you need to define in "pngusr.h" the followings:
* #define PNG_USER_PRIVATEBUILD <Describes by whom and why this version of
* the DLL was built>
@@ -40,8 +40,8 @@
* number and must match your private DLL name>
* e.g. // private DLL "libpng13gx.dll"
* #define PNG_USER_DLLFNAME_POSTFIX "gx"
- *
- * The following macros are also at your disposal if you want to complete the
+ *
+ * The following macros are also at your disposal if you want to complete the
* DLL VERSIONINFO structure.
* - PNG_USER_VERSIONINFO_COMMENTS
* - PNG_USER_VERSIONINFO_COMPANYNAME
@@ -129,9 +129,9 @@
* 'Cygwin' defines/defaults:
* PNG_BUILD_DLL -- (ignored) building the dll
* (no define) -- (ignored) building an application, linking to the dll
- * PNG_STATIC -- (ignored) building the static lib, or building an
+ * PNG_STATIC -- (ignored) building the static lib, or building an
* application that links to the static lib.
- * ALL_STATIC -- (ignored) building various static libs, or building an
+ * ALL_STATIC -- (ignored) building various static libs, or building an
* application that links to the static libs.
* Thus,
* a cygwin user should define either PNG_BUILD_DLL or PNG_STATIC, and
@@ -144,12 +144,12 @@
* PNG_BUILD_DLL
* PNG_STATIC
* (nothing) == PNG_USE_DLL
- *
+ *
* CYGWIN (2002-01-20): The preceding is now obsolete. With the advent
- * of auto-import in binutils, we no longer need to worry about
+ * of auto-import in binutils, we no longer need to worry about
* __declspec(dllexport) / __declspec(dllimport) and friends. Therefore,
* we don't need to worry about PNG_STATIC or ALL_STATIC when it comes
- * to __declspec() stuff. However, we DO need to worry about
+ * to __declspec() stuff. However, we DO need to worry about
* PNG_BUILD_DLL and PNG_STATIC because those change some defaults
* such as CONSOLE_IO and whether GLOBAL_ARRAYS are allowed.
*/
@@ -212,7 +212,7 @@
*/
#if defined(_WIN32_WCE)
-# include <windows.h>
+# include <windows.h>
/* Console I/O functions are not supported on WindowsCE */
# define PNG_NO_CONSOLE_IO
# ifdef PNG_DEBUG
@@ -238,7 +238,7 @@
# endif
# endif
# else
-# if !defined(_WIN32_WCE)
+# if !defined(_WIN32_WCE)
/* "stdio.h" functions are not supported on WindowsCE */
# include <stdio.h>
# endif
@@ -290,7 +290,7 @@
# define PNG_SETJMP_SUPPORTED
#endif
-#ifdef PNG_SETJMP_SUPPORTED
+#ifdef PNG_SETJMP_SUPPORTED
/* This is an attempt to force a single setjmp behaviour on Linux. If
* the X config stuff didn't define _BSD_SOURCE we wouldn't need this.
*/
@@ -300,7 +300,7 @@
# define PNG_SAVE_BSD_SOURCE
# undef _BSD_SOURCE
# endif
-# ifdef _SETJMP_H
+# ifdef _SETJMP_H
/* If you encounter a compiler error here, see the explanation
* near the end of INSTALL.
*/
@@ -345,7 +345,7 @@
*/
#if defined(PNG_FLOATING_POINT_SUPPORTED)
-# if defined(MACOS)
+# if defined(MACOS)
/* We need to check that <math.h> hasn't already been included earlier
* as it seems it doesn't agree with <fp.h>, yet we should really use
* <fp.h> if possible.
@@ -356,7 +356,7 @@
# else
# include <math.h>
# endif
-# if defined(_AMIGA) && defined(__SASC) && defined(_M68881)
+# if defined(_AMIGA) && defined(__SASC) && defined(_M68881)
/* Amiga SAS/C: We must include builtin FPU functions when compiling using
* MATH=68881
*/
@@ -574,7 +574,7 @@
#if !defined(PNG_NO_PROGRESSIVE_READ) && \
!defined(PNG_PROGRESSIVE_READ_NOT_SUPPORTED) /* if you don't do progressive */
# define PNG_PROGRESSIVE_READ_SUPPORTED /* reading. This is not talking */
-#endif /* about interlacing capability! You'll */
+#endif /* about interlacing capability! You'll */
/* still have interlacing unless you change the following line: */
#define PNG_READ_INTERLACING_SUPPORTED /* required for PNG-compliant decoders */
@@ -633,11 +633,8 @@
# endif
#endif /* PNG_WRITE_TRANSFORMS_SUPPORTED */
-#define PNG_WRITE_INTERLACING_SUPPORTED /* not required for PNG-compliant
+#define PNG_WRITE_INTERLACING_SUPPORTED /* not required for PNG-compliant encoders, but can cause trouble if left undefined */
-encoders, but can cause trouble
-if left undefined * /
-
#if !defined(PNG_NO_WRITE_WEIGHTED_FILTER) && \
defined(PNG_FLOATING_POINT_SUPPORTED)
# define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
@@ -1033,7 +1030,7 @@
/* need the time information for reading tIME chunks */
#if defined(PNG_tIME_SUPPORTED)
-# if !defined(_WIN32_WCE)
+# if !defined(_WIN32_WCE)
/* "time.h" functions are not supported on WindowsCE */
# include <time.h>
# endif
@@ -1082,7 +1079,7 @@
# define LDATA 1
# else
# define LDATA 0
-# endif
+# endif
/* GRR: why is Cygwin in here? Cygwin is not Borland C... */
# if !defined(__WIN32__) && !defined(__FLAT__) && !defined(__CYGWIN__)
# define PNG_MAX_MALLOC_64K
@@ -1091,7 +1088,7 @@
# define FAR __far
# endif
# define USE_FAR_KEYWORD
-# endif /* LDATA != 1 */
+# endif /* LDATA != 1 */
/* Possibly useful for moving data out of default segment.
* Uncomment it if you want. Could also define FARDATA as
* const if your compiler supports it. (SJT)
@@ -1168,7 +1165,7 @@
/* Pointers to pointers to pointers; i.e., pointer to array */
typedef char FAR * FAR * FAR * png_charppp;
-#if defined(PNG_1_0_X) || defined(PNG_1_2_X)
+#if defined(PNG_1_0_X) || defined(PNG_1_2_X)
/* SPC - Is this stuff deprecated? */
/* It'll be removed as of libpng-1.3.0 - GR-P */
/* libpng typedefs for types in zlib. If zlib changes
@@ -1200,7 +1197,7 @@
#if !defined(PNG_DLL) && (defined(PNG_BUILD_DLL) || defined(PNG_USE_DLL))
# define PNG_DLL
-#endif
+#endif
/* If CYGWIN, then disallow GLOBAL ARRAYS unless building a static lib.
* When building a static lib, default to no GLOBAL ARRAYS, but allow
* command-line override
@@ -1357,7 +1354,7 @@
(LIBPNG_WAS_COMPILED_WITH__PNG_SETJMP_NOT_SUPPORTED)
#endif
-#if defined(USE_FAR_KEYWORD) /* memory model independent fns */
+#if defined(USE_FAR_KEYWORD) /* memory model independent fns */
/* use this to make far-to-near assignments */
# define CHECK 1
# define NOCHECK 0
@@ -1378,7 +1375,7 @@
# define png_memcmp memcmp /* SJT: added */
# define png_memcpy memcpy
# define png_memset memset
-#endif
+#endif
/* End of memory model independent support */
/* Just a little check that someone hasn't tried to define something
@@ -1389,7 +1386,7 @@
# define PNG_ZBUF_SIZE 65536L
#endif
-#ifdef PNG_READ_SUPPORTED
+#ifdef PNG_READ_SUPPORTED
/* Prior to libpng-1.0.9, this block was in pngasmrd.h */
#if defined(PNG_INTERNAL)
@@ -1424,7 +1421,7 @@
# define PNG_HAVE_ASSEMBLER_COMBINE_ROW
# define PNG_HAVE_ASSEMBLER_READ_INTERLACE
# define PNG_HAVE_ASSEMBLER_READ_FILTER_ROW
-#endif
+#endif
/* - see pnggccrd.c for info about what is currently enabled */
#endif /* PNG_INTERNAL */
Modified: tiki/include/Tiki/net/buffer.h
===================================================================
--- tiki/include/Tiki/net/buffer.h 2007-08-25 00:14:06 UTC (rev 492)
+++ tiki/include/Tiki/net/buffer.h 2007-08-25 02:07:26 UTC (rev 493)
@@ -42,7 +42,7 @@
}
Buffer(std::string filename, std::string contentType, std::string fieldName = "") :
- m_fileName(filename), m_contentType(contentType), m_fieldName(fieldName) {
+ m_contentType(contentType), m_fileName(filename), m_fieldName(fieldName) {
File file(filename, "rb");
read(file);
file.close();
@@ -50,7 +50,7 @@
Buffer(Tiki::File file, std::string contentType, std::string fieldName = "") :
m_contentType(contentType), m_fieldName(fieldName) {
- read(file);
+ read(file);
}
void read(Tiki::File file) {
@@ -86,9 +86,6 @@
}
uint8 *getData() const {
- if(m_usedDataLen > 0) {
- m_data[m_usedDataLen] = '\0';
- }
return m_data;
}
Modified: tiki/include/Tiki/net/http/request.h
===================================================================
--- tiki/include/Tiki/net/http/request.h 2007-08-25 00:14:06 UTC (rev 492)
+++ tiki/include/Tiki/net/http/request.h 2007-08-25 02:07:26 UTC (rev 493)
@@ -8,13 +8,16 @@
#ifndef __TIKI_NET_HTTP_REQUEST_H
#define __TIKI_NET_HTTP_REQUEST_H
-#include "Tiki/refcnt.h"
+#include "Tiki/refcnt.h"
+#include "Tiki/net/util/base64.h"
namespace Tiki {
namespace Net {
-namespace Http {
+namespace Http {
+
+using Tiki::Net::Util::Base64;
extern std::string DEFAULT_CONTENT_PART;
@@ -33,7 +36,20 @@
}
m_parts.clear();
}
- */
+ */
+
+ void setAuthentication(std::string username, std::string password) {
+ std::string param = username + ":" + password;
+ Buffer *inputBuf = new Buffer(param.length(), (uint8 *)param.c_str());
+
+ Base64 b64;
+ Buffer *result = b64.encode(inputBuf);
+
+ setHeaderParam("Authorization", std::string("Basic ") + std::string((char *)result->getData()));
+
+ delete inputBuf;
+ delete result;
+ }
std::string getUrl() const {
return m_url;
Modified: tiki/include/Tiki/net/tcpsocket.h
===================================================================
--- tiki/include/Tiki/net/tcpsocket.h 2007-08-25 00:14:06 UTC (rev 492)
+++ tiki/include/Tiki/net/tcpsocket.h 2007-08-25 02:07:26 UTC (rev 493)
@@ -34,9 +34,9 @@
TCPSocket() : Socket(), m_open(false) {};
TCPSocket(Address *address) : Socket(address), m_open(false) {};
#if TIKI_PLAT == TIKI_WIN32
- TCPSocket(Address *address, SOCKET socket) : Socket(address), m_socket(socket), m_open(true) {setNonBlocking(false);};
+ TCPSocket(Address *address, SOCKET socket) : Socket(address), m_open(true), m_socket(socket) {setNonBlocking(false);};
#else
- TCPSocket(RefPtr<Address> address, int socket) : Socket(address), m_socket(socket), m_open(true) {setNonBlocking(false);};
+ TCPSocket(RefPtr<Address> address, int socket) : Socket(address), m_open(true), m_socket(socket) {setNonBlocking(false);};
#endif
virtual void send(Buffer *data);
Added: tiki/include/Tiki/net/util/base64.h
===================================================================
--- tiki/include/Tiki/net/util/base64.h (rev 0)
+++ tiki/include/Tiki/net/util/base64.h 2007-08-25 02:07:26 UTC (rev 493)
@@ -0,0 +1,36 @@
+/*
+ Tiki
+
+ base64.h
+
+ Copyright (C)2007 Atani Software
+*/
+
+#ifndef __TIKI_BASE64_H
+#define __TIKI_BASE64_H
+
+namespace Tiki {
+ namespace Net {
+ namespace Util {
+
+ class Base64 {
+ public:
+ Buffer *encode(Buffer *source);
+ Buffer *decode(Buffer *source);
+
+ private:
+ void encodeTriplet(uint8 *input, uint8 count, uint8 *output);
+ uint8 decodeQuartet(uint8 *input, uint8 *output);
+ size_t calcEncodeBufferSize(size_t byteCount);
+ size_t calcDecodeBufferSize(uint8 *input, size_t inputByteCount);
+
+ static uint8 BASE64_ALPHABET[64];
+ static uint8 BASE64_DEALPHABET[128];
+ };
+
+ }
+ }
+
+}
+
+#endif // __TIKI_BASE64_H
Modified: tiki/include/Tiki/net.h
===================================================================
--- tiki/include/Tiki/net.h 2007-08-25 00:14:06 UTC (rev 492)
+++ tiki/include/Tiki/net.h 2007-08-25 02:07:26 UTC (rev 493)
@@ -31,3 +31,4 @@
#include "Tiki/net/tcpsocket.h"
#include "Tiki/net/tcpserversocket.h"
#include "Tiki/net/udpsocket.h"
+#include "Tiki/net/util/base64.h"
Modified: tiki/nds/Makefile
===================================================================
--- tiki/nds/Makefile 2007-08-25 00:14:06 UTC (rev 492)
+++ tiki/nds/Makefile 2007-08-25 02:07:26 UTC (rev 493)
@@ -12,6 +12,7 @@
BASE_THREAD_OBJ=$(patsubst %.cpp,%.o,$(wildcard ../src/thread/*.cpp))
BASE_NET_OBJ=$(patsubst %.cpp,%.o,$(wildcard ../src/net/*.cpp))
BASE_NET_OBJ+=$(patsubst %.cpp,%.o,$(wildcard ../src/net/http/*.cpp))
+BASE_NET_OBJ+=$(patsubst %.cpp,%.o,$(wildcard ../src/net/util/*.cpp))
JPEG_OBJ=$(patsubst %.c,%.o,$(wildcard ../3rdparty/libjpeg/*.c))
PNG_OBJ=$(patsubst %.c,%.o,$(wildcard ../3rdparty/libpng/*.c))
Modified: tiki/sdl/Makefile
===================================================================
--- tiki/sdl/Makefile 2007-08-25 00:14:06 UTC (rev 492)
+++ tiki/sdl/Makefile 2007-08-25 02:07:26 UTC (rev 493)
@@ -12,6 +12,7 @@
BASE_THREAD_OBJ=$(patsubst %.cpp,%.o,$(wildcard ../src/thread/*.cpp))
BASE_NET_OBJ=$(patsubst %.cpp,%.o,$(wildcard ../src/net/*.cpp))
BASE_NET_OBJ+=$(patsubst %.cpp,%.o,$(wildcard ../src/net/http/*.cpp))
+BASE_NET_OBJ+=$(patsubst %.cpp,%.o,$(wildcard ../src/net/util/*.cpp))
JPEG_OBJ=$(patsubst %.c,%.o,$(wildcard ../3rdparty/libjpeg/*.c))
PNG_OBJ=$(patsubst %.c,%.o,$(wildcard ../3rdparty/libpng/*.c))
Added: tiki/sdl/TikiSDL.cbp
===================================================================
--- tiki/sdl/TikiSDL.cbp (rev 0)
+++ tiki/sdl/TikiSDL.cbp 2007-08-25 02:07:26 UTC (rev 493)
@@ -0,0 +1,548 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
+<CodeBlocks_project_file>
+ <FileVersion major="1" minor="6" />
+ <Project>
+ <Option title="TikiSDL" />
+ <Option pch_mode="2" />
+ <Option compiler="gcc" />
+ <Build>
+ <Target title="Debug">
+ <Option output="bin/Debug/libTikiSDL" prefix_auto="1" extension_auto="1" />
+ <Option working_dir="" />
+ <Option object_output="obj/Debug/" />
+ <Option type="2" />
+ <Option compiler="gcc" />
+ <Option createDefFile="1" />
+ <Compiler>
+ <Add option="-g" />
+ </Compiler>
+ </Target>
+ <Target title="Release">
+ <Option output="bin/Release/libTikiSDL" prefix_auto="1" extension_auto="1" />
+ <Option working_dir="" />
+ <Option object_output="obj/Release/" />
+ <Option type="2" />
+ <Option compiler="gcc" />
+ <Option createDefFile="1" />
+ <Compiler>
+ <Add option="-O2" />
+ </Compiler>
+ <Linker>
+ <Add option="-s" />
+ </Linker>
+ </Target>
+ </Build>
+ <Compiler>
+ <Add option="-Wall" />
+ <Add option="`sdl-config --cflags`" />
+ <Add directory="include" />
+ <Add directory="../include" />
+ <Add directory="../3rdparty/libjpeg" />
+ <Add directory="../3rdparty/libogg/include" />
+ <Add directory="../3rdparty/libpng" />
+ <Add directory="../3rdparty/libvorbis/include" />
+ <Add directory="../3rdparty/zlib" />
+ <Add directory="../3rdparty/libvorbis/lib" />
+ </Compiler>
+ <Unit filename="../3rdparty/libjpeg/jcapimin.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libjpeg/jcapistd.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libjpeg/jccoefct.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libjpeg/jccolor.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libjpeg/jcdctmgr.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libjpeg/jchuff.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libjpeg/jchuff.h" />
+ <Unit filename="../3rdparty/libjpeg/jcinit.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libjpeg/jcmainct.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libjpeg/jcmarker.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libjpeg/jcmaster.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libjpeg/jcomapi.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libjpeg/jconfig.h" />
+ <Unit filename="../3rdparty/libjpeg/jcparam.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libjpeg/jcphuff.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libjpeg/jcprepct.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libjpeg/jcsample.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libjpeg/jctrans.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libjpeg/jdapimin.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libjpeg/jdapistd.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libjpeg/jdatadst.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libjpeg/jdatasrc.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libjpeg/jdcoefct.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libjpeg/jdcolor.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libjpeg/jdct.h" />
+ <Unit filename="../3rdparty/libjpeg/jddctmgr.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libjpeg/jdhuff.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libjpeg/jdhuff.h" />
+ <Unit filename="../3rdparty/libjpeg/jdinput.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libjpeg/jdmainct.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libjpeg/jdmarker.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libjpeg/jdmaster.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libjpeg/jdmerge.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libjpeg/jdphuff.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libjpeg/jdpostct.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libjpeg/jdsample.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libjpeg/jdtrans.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libjpeg/jerror.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libjpeg/jerror.h" />
+ <Unit filename="../3rdparty/libjpeg/jfdctflt.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libjpeg/jfdctfst.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libjpeg/jfdctint.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libjpeg/jidctflt.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libjpeg/jidctfst.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libjpeg/jidctint.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libjpeg/jidctred.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libjpeg/jinclude.h" />
+ <Unit filename="../3rdparty/libjpeg/jmemmgr.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libjpeg/jmemnobs.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libjpeg/jmemsys.h" />
+ <Unit filename="../3rdparty/libjpeg/jmorecfg.h" />
+ <Unit filename="../3rdparty/libjpeg/jpegint.h" />
+ <Unit filename="../3rdparty/libjpeg/jpeglib.h" />
+ <Unit filename="../3rdparty/libjpeg/jquant1.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libjpeg/jquant2.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libjpeg/jutils.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libjpeg/jversion.h" />
+ <Unit filename="../3rdparty/libogg/include/ogg/ogg.h" />
+ <Unit filename="../3rdparty/libogg/include/ogg/os_types.h" />
+ <Unit filename="../3rdparty/libogg/src/bitwise.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libogg/src/framing.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libpng/png.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libpng/png.h" />
+ <Unit filename="../3rdparty/libpng/pngconf.h" />
+ <Unit filename="../3rdparty/libpng/pngerror.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libpng/pnggccrd.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libpng/pngget.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libpng/pngmem.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libpng/pngpread.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libpng/pngread.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libpng/pngrio.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libpng/pngrtran.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libpng/pngrutil.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libpng/pngset.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libpng/pngtrans.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libpng/pngvcrd.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libpng/pngwio.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libpng/pngwrite.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libpng/pngwtran.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libpng/pngwutil.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libvorbis/include/vorbis/codec.h" />
+ <Unit filename="../3rdparty/libvorbis/include/vorbis/vorbisenc.h" />
+ <Unit filename="../3rdparty/libvorbis/include/vorbis/vorbisfile.h" />
+ <Unit filename="../3rdparty/libvorbis/lib/analysis.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libvorbis/lib/backends.h" />
+ <Unit filename="../3rdparty/libvorbis/lib/barkmel.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libvorbis/lib/bitrate.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libvorbis/lib/bitrate.h" />
+ <Unit filename="../3rdparty/libvorbis/lib/block.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libvorbis/lib/books/coupled/res_books_stereo.h" />
+ <Unit filename="../3rdparty/libvorbis/lib/books/floor/floor_books.h" />
+ <Unit filename="../3rdparty/libvorbis/lib/books/uncoupled/res_books_uncoupled.h" />
+ <Unit filename="../3rdparty/libvorbis/lib/codebook.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libvorbis/lib/codebook.h" />
+ <Unit filename="../3rdparty/libvorbis/lib/codec_internal.h" />
+ <Unit filename="../3rdparty/libvorbis/lib/envelope.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libvorbis/lib/envelope.h" />
+ <Unit filename="../3rdparty/libvorbis/lib/floor0.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libvorbis/lib/floor1.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libvorbis/lib/highlevel.h" />
+ <Unit filename="../3rdparty/libvorbis/lib/info.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libvorbis/lib/lookup.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libvorbis/lib/lookup.h" />
+ <Unit filename="../3rdparty/libvorbis/lib/lookup_data.h" />
+ <Unit filename="../3rdparty/libvorbis/lib/lpc.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libvorbis/lib/lpc.h" />
+ <Unit filename="../3rdparty/libvorbis/lib/lsp.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libvorbis/lib/lsp.h" />
+ <Unit filename="../3rdparty/libvorbis/lib/mapping0.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libvorbis/lib/masking.h" />
+ <Unit filename="../3rdparty/libvorbis/lib/mdct.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libvorbis/lib/mdct.h" />
+ <Unit filename="../3rdparty/libvorbis/lib/misc.h" />
+ <Unit filename="../3rdparty/libvorbis/lib/modes/floor_all.h" />
+ <Unit filename="../3rdparty/libvorbis/lib/modes/psych_11.h" />
+ <Unit filename="../3rdparty/libvorbis/lib/modes/psych_16.h" />
+ <Unit filename="../3rdparty/libvorbis/lib/modes/psych_44.h" />
+ <Unit filename="../3rdparty/libvorbis/lib/modes/psych_8.h" />
+ <Unit filename="../3rdparty/libvorbis/lib/modes/residue_16.h" />
+ <Unit filename="../3rdparty/libvorbis/lib/modes/residue_44.h" />
+ <Unit filename="../3rdparty/libvorbis/lib/modes/residue_44u.h" />
+ <Unit filename="../3rdparty/libvorbis/lib/modes/residue_8.h" />
+ <Unit filename="../3rdparty/libvorbis/lib/modes/setup_11.h" />
+ <Unit filename="../3rdparty/libvorbis/lib/modes/setup_16.h" />
+ <Unit filename="../3rdparty/libvorbis/lib/modes/setup_22.h" />
+ <Unit filename="../3rdparty/libvorbis/lib/modes/setup_32.h" />
+ <Unit filename="../3rdparty/libvorbis/lib/modes/setup_44.h" />
+ <Unit filename="../3rdparty/libvorbis/lib/modes/setup_44u.h" />
+ <Unit filename="../3rdparty/libvorbis/lib/modes/setup_8.h" />
+ <Unit filename="../3rdparty/libvorbis/lib/modes/setup_X.h" />
+ <Unit filename="../3rdparty/libvorbis/lib/os.h" />
+ <Unit filename="../3rdparty/libvorbis/lib/psy.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libvorbis/lib/psy.h" />
+ <Unit filename="../3rdparty/libvorbis/lib/registry.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libvorbis/lib/registry.h" />
+ <Unit filename="../3rdparty/libvorbis/lib/res0.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libvorbis/lib/scales.h" />
+ <Unit filename="../3rdparty/libvorbis/lib/sharedbook.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libvorbis/lib/smallft.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libvorbis/lib/smallft.h" />
+ <Unit filename="../3rdparty/libvorbis/lib/synthesis.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libvorbis/lib/vorbisenc.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libvorbis/lib/vorbisfile.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libvorbis/lib/window.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/libvorbis/lib/window.h" />
+ <Unit filename="../3rdparty/zlib/adler32.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/zlib/compress.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/zlib/crc32.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/zlib/crc32.h" />
+ <Unit filename="../3rdparty/zlib/deflate.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/zlib/deflate.h" />
+ <Unit filename="../3rdparty/zlib/gzio.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/zlib/infback.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/zlib/inffast.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/zlib/inffast.h" />
+ <Unit filename="../3rdparty/zlib/inffixed.h" />
+ <Unit filename="../3rdparty/zlib/inflate.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/zlib/inflate.h" />
+ <Unit filename="../3rdparty/zlib/inftrees.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/zlib/inftrees.h" />
+ <Unit filename="../3rdparty/zlib/trees.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/zlib/trees.h" />
+ <Unit filename="../3rdparty/zlib/uncompr.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/zlib/zconf.h" />
+ <Unit filename="../3rdparty/zlib/zlib.h" />
+ <Unit filename="../3rdparty/zlib/zutil.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../3rdparty/zlib/zutil.h" />
+ <Unit filename="../include/Tiki/TikiAll.h" />
+ <Unit filename="../include/Tiki/animation.h" />
+ <Unit filename="../include/Tiki/anims/alphafader.h" />
+ <Unit filename="../include/Tiki/anims/alpharotate.h" />
+ <Unit filename="../include/Tiki/anims/expxymover.h" />
+ <Unit filename="../include/Tiki/anims/logxymover.h" />
+ <Unit filename="../include/Tiki/anims/sleep.h" />
+ <Unit filename="../include/Tiki/anims/tintfader.h" />
+ <Unit filename="../include/Tiki/bspline.h" />
+ <Unit filename="../include/Tiki/color.h" />
+ <Unit filename="../include/Tiki/color3.h" />
+ <Unit filename="../include/Tiki/debug.h" />
+ <Unit f...
[truncated message content] |
|
From: <at...@us...> - 2007-08-26 12:07:51
|
Revision: 495
http://cadcdev.svn.sourceforge.net/cadcdev/?rev=495&view=rev
Author: atani
Date: 2007-08-25 10:30:20 -0700 (Sat, 25 Aug 2007)
Log Message:
-----------
fixing path in win32/Makefile to project/solution files
use google.com for httpclient example (sets a cookie)
Modified Paths:
--------------
tiki/examples/net/httpclient/src/main.cpp
tiki/win32/Makefile
Modified: tiki/examples/net/httpclient/src/main.cpp
===================================================================
--- tiki/examples/net/httpclient/src/main.cpp 2007-08-25 08:48:53 UTC (rev 494)
+++ tiki/examples/net/httpclient/src/main.cpp 2007-08-25 17:30:20 UTC (rev 495)
@@ -36,7 +36,7 @@
//useragent->setProxyPort(80);
Request *request = new Request();
- request->setUrl("http://www.oracle.com/");
+ request->setUrl("http://www.google.com/");
Response *response = useragent->get(request);
Tiki::Debug::printf("response code: %d\n", response->getResultCode());
@@ -57,7 +57,7 @@
{
Buffer *responseBuf = response->getContentPart(*iter);
Tiki::Debug::printf("Content Part: %s [%u bytes]\n", (*iter).c_str(), responseBuf->getUsedDataLen());
- Tiki::Debug::printf("%s\n", responseBuf->getData());
+ //Tiki::Debug::printf("%s\n", responseBuf->getData());
}
delete response;
Modified: tiki/win32/Makefile
===================================================================
--- tiki/win32/Makefile 2007-08-25 08:48:53 UTC (rev 494)
+++ tiki/win32/Makefile 2007-08-25 17:30:20 UTC (rev 495)
@@ -1,14 +1,17 @@
all:
- vcbuild /nocolor /rebuild tiki_vs80.vcproj $$ALL
+ vcbuild /nocolor /rebuild tiki.vcproj $$ALL
clean:
- -vcbuild /nocolor /clean tiki_vc80.sln $$ALL
+ -vcbuild /nocolor /clean tiki.sln $$ALL
examples:
- vcbuild /nocolor /rebuild ..\\examples\\TikiTest\\TikiTest_vc80.vcproj $$ALL
+ vcbuild /nocolor /rebuild ..\\examples\\TikiTest\\TikiTest.vcproj $$ALL
vcbuild /nocolor /rebuild ..\\examples\\console\\TikiSnake\\TikiSnake.vcproj $$ALL
vcbuild /nocolor /rebuild ..\\examples\\net\\basic\\basic.vcproj $$ALL
+ vcbuild /nocolor /rebuild ..\\examples\\net\\chat\\chat.vcproj $$ALL
+ vcbuild /nocolor /rebuild ..\\examples\\net\\chatd\\chatd.vcproj $$ALL
+ vcbuild /nocolor /rebuild ..\\examples\\net\\httpclient\\httpclient.vcproj $$ALL
package:
zip -9r ../dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-win32-Debug.zip Debug/tiki.lib
@@ -18,6 +21,9 @@
win32/include \
examples/TikiTest/Debug/tikitest.exe \
examples/net/basic/Debug/BasicNet.exe \
+ examples/net/httpclient/Debug/BasicNet.exe \
+ examples/net/chat/Debug/BasicNet.exe \
+ examples/net/chatd/Debug/BasicNet.exe \
examples/console/TikiSnake/Debug/tikisnake.exe \
examples/console/TikiSnake/Debug/pc-ascii.png \
-x "*/.svn/*"
@@ -28,6 +34,9 @@
win32/include \
examples/TikiTest/Release/tikitest.exe \
examples/net/basic/Release/BasicNet.exe \
+ examples/net/httpclient/Release/BasicNet.exe \
+ examples/net/chat/Release/BasicNet.exe \
+ examples/net/chatd/Release/BasicNet.exe \
examples/console/TikiSnake/Release/tikisnake.exe \
examples/console/TikiSnake/Release/pc-ascii.png \
-x "*/.svn/*"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <at...@us...> - 2007-08-27 16:13:06
|
Revision: 494
http://cadcdev.svn.sourceforge.net/cadcdev/?rev=494&view=rev
Author: atani
Date: 2007-08-25 01:48:53 -0700 (Sat, 25 Aug 2007)
Log Message:
-----------
various updates, added parsing of Set-Cookie header param, need to add support
for sending Cookie back to server
Modified Paths:
--------------
tiki/examples/net/httpclient/src/main.cpp
tiki/include/Tiki/net/buffer.h
tiki/include/Tiki/net/http/cookie.h
tiki/include/Tiki/net/http/request.h
tiki/include/Tiki/net/http/useragent.h
tiki/include/Tiki/net/socket.h
tiki/include/Tiki/net/tcpserversocket.h
tiki/include/Tiki/net/tcpsocket.h
tiki/include/Tiki/net/udpsocket.h
tiki/include/Tiki/net/util/base64.h
tiki/src/audio/stream.cpp
tiki/src/net/address.cpp
tiki/src/net/http/useragent.cpp
tiki/src/net/util/base64.cpp
tiki/win32/include/pch.h
tiki/win32/tiki.cbp
tiki/win32/tiki.layout
tiki/win32/tiki.sln
tiki/win32/tiki.vcproj
Added Paths:
-----------
tiki/examples/TikiTest/TikiTest.vcproj
Removed Paths:
-------------
tiki/examples/TikiTest/TikiTest_vc80.vcproj
tiki/win32/tiki_vc80.sln
tiki/win32/tiki_vs80.vcproj
Copied: tiki/examples/TikiTest/TikiTest.vcproj (from rev 493, tiki/examples/TikiTest/TikiTest_vc80.vcproj)
===================================================================
--- tiki/examples/TikiTest/TikiTest.vcproj (rev 0)
+++ tiki/examples/TikiTest/TikiTest.vcproj 2007-08-25 08:48:53 UTC (rev 494)
@@ -0,0 +1,213 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="TikiTest"
+ ProjectGUID="{7B823C96-860C-4578-95BB-1087A45AF1AA}"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(ProjectDir)..\..\win32\include;$(ProjectDir)\..\..\include;"C:\Program Files\OpenAL 1.1 SDK\include""
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;"
+ 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="gdi32.lib kernel32.lib user32.lib opengl32.lib glu32.lib comdlg32.lib ws2_32.lib"
+ LinkIncremental="2"
+ AdditionalLibraryDirectories="$(ProjectDir)\..\..\win32\Debug;"C:\Program Files\OpenAL 1.1 SDK\libs\Win32""
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="$(ProjectDir)..\..\win32\include;$(ProjectDir)\..\..\include;"C:\Program Files\OpenAL 1.1 SDK\include""
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;"
+ RuntimeLibrary="0"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="gdi32.lib kernel32.lib user32.lib opengl32.lib glu32.lib comdlg32.lib ws2_32.lib"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories="$(ProjectDir)\..\..\win32\Release;C:\Program Files\OpenAL 1.1 SDK\libs\Win32"
+ IgnoreDefaultLibraryNames=""
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ <File
+ RelativePath=".\src\testobj.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+ >
+ </Filter>
+ <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\test.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\src\testobj.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\src\TikiTest.cpp"
+ >
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
Deleted: tiki/examples/TikiTest/TikiTest_vc80.vcproj
===================================================================
--- tiki/examples/TikiTest/TikiTest_vc80.vcproj 2007-08-25 02:07:26 UTC (rev 493)
+++ tiki/examples/TikiTest/TikiTest_vc80.vcproj 2007-08-25 08:48:53 UTC (rev 494)
@@ -1,213 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="TikiTest"
- ProjectGUID="{7B823C96-860C-4578-95BB-1087A45AF1AA}"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="Debug"
- IntermediateDirectory="Debug"
- ConfigurationType="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="$(ProjectDir)..\..\win32\include;$(ProjectDir)\..\..\include;"C:\Program Files\OpenAL 1.1 SDK\include""
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;"
- 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="gdi32.lib kernel32.lib user32.lib opengl32.lib glu32.lib comdlg32.lib ws2_32.lib"
- LinkIncremental="2"
- AdditionalLibraryDirectories="$(ProjectDir)\..\..\win32\Debug;"C:\Program Files\OpenAL 1.1 SDK\libs\Win32""
- GenerateDebugInformation="true"
- SubSystem="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="Release"
- IntermediateDirectory="Release"
- ConfigurationType="1"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="$(ProjectDir)..\..\win32\include;$(ProjectDir)\..\..\include;"C:\Program Files\OpenAL 1.1 SDK\include""
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;"
- RuntimeLibrary="0"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="gdi32.lib kernel32.lib user32.lib opengl32.lib glu32.lib comdlg32.lib ws2_32.lib"
- LinkIncremental="1"
- AdditionalLibraryDirectories="$(ProjectDir)\..\..\win32\Release;C:\Program Files\OpenAL 1.1 SDK\libs\Win32"
- IgnoreDefaultLibraryNames=""
- GenerateDebugInformation="true"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- <File
- RelativePath=".\src\testobj.h"
- >
- </File>
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
- >
- </Filter>
- <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\test.cpp"
- >
- </File>
- <File
- RelativePath=".\src\testobj.cpp"
- >
- </File>
- <File
- RelativePath=".\src\TikiTest.cpp"
- >
- </File>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
Modified: tiki/examples/net/httpclient/src/main.cpp
===================================================================
--- tiki/examples/net/httpclient/src/main.cpp 2007-08-25 02:07:26 UTC (rev 493)
+++ tiki/examples/net/httpclient/src/main.cpp 2007-08-25 08:48:53 UTC (rev 494)
@@ -31,15 +31,24 @@
Tiki::Net::init();
Hid::callbackReg( tkCallback, NULL );
- RefPtr<HttpUserAgent> useragent = new HttpUserAgent();
+ HttpUserAgent *useragent = new HttpUserAgent();
//useragent->setProxyHost("proxy.example.com");
//useragent->setProxyPort(80);
- RefPtr<Request> request = new Request();
- request->setUrl("http://www.example.com/");
+ Request *request = new Request();
+ request->setUrl("http://www.oracle.com/");
- RefPtr<Response> response = useragent->get(request);
+ Response *response = useragent->get(request);
Tiki::Debug::printf("response code: %d\n", response->getResultCode());
+ std::list<Cookie *> cookies = useragent->getCookies();
+ for(std::list<Cookie *>::iterator iter = cookies.begin();
+ iter != cookies.end();
+ ++iter) {
+ Cookie *cookie = (*iter);
+ Tiki::Debug::printf("COOKIE: %s (value->%s,path->%s,max-age->%d,domain->%s,secure->%s)\n",
+ cookie->getName().c_str(), cookie->getValue().c_str(), cookie->getPath().c_str(), cookie->getMaxAge(),
+ cookie->getDomain().c_str(), cookie->isSecure() ? "true" : "false");
+ }
std::list<std::string> content = response->getContentPartNames();
for(std::list<std::string>::iterator iter = content.begin();
@@ -51,6 +60,10 @@
Tiki::Debug::printf("%s\n", responseBuf->getData());
}
+ delete response;
+ delete request;
+ delete useragent;
+
Tiki::Net::shutdown();
return 0;
Modified: tiki/include/Tiki/net/buffer.h
===================================================================
--- tiki/include/Tiki/net/buffer.h 2007-08-25 02:07:26 UTC (rev 493)
+++ tiki/include/Tiki/net/buffer.h 2007-08-25 08:48:53 UTC (rev 494)
@@ -24,19 +24,19 @@
public:
Buffer(size_t len, std::string contentType = "application/octet-stream") :
m_contentType(contentType) {
- if(len > 0) {
- m_data = new uint8[len];
- memset(m_data, 0, len);
+ m_dataLen = len + 1;
+ if(m_dataLen > 0) {
+ m_data = new uint8[m_dataLen];
+ memset(m_data, '\0', m_dataLen);
}
- m_dataLen = len;
m_usedDataLen = 0;
}
Buffer(size_t len, uint8 *data, std::string contentType = "application/octet-stream") :
m_contentType(contentType) {
- m_data = new uint8[len];
- memset(m_data, 0, len);
- m_dataLen = len;
+ m_dataLen = len + 1;
+ m_data = new uint8[m_dataLen];
+ memset(m_data, '\0', m_dataLen);
m_usedDataLen = len;
memcpy(m_data, data, len);
}
@@ -56,9 +56,11 @@
void read(Tiki::File file) {
assert(file.isValid());
m_fileName = file.getFileName();
- m_dataLen = m_usedDataLen = file.total();
+ m_usedDataLen = file.total();
+ m_dataLen = m_usedDataLen + 1;
m_data = new uint8[m_dataLen];
- file.read(m_data, static_cast<int>(m_dataLen));
+ memset(m_data, '\0', m_dataLen);
+ file.read(m_data, static_cast<int>(m_usedDataLen));
}
void write(Tiki::File file) {
@@ -68,6 +70,7 @@
void append(Buffer *buf) {
uint8 * newbuf = new uint8[ m_dataLen + buf->getDataLen() ];
+ memset(newbuf, '\0', m_dataLen + buf->getDataLen());
if(m_data != NULL) {
memcpy(newbuf, m_data, m_usedDataLen);
}
@@ -80,7 +83,7 @@
void reset() {
if(m_data != NULL) {
- memset(m_data, 0, m_dataLen);
+ memset(m_data, '\0', m_dataLen);
}
m_usedDataLen = 0;
}
@@ -113,7 +116,7 @@
}
size_t getDataLen() const {
- return m_dataLen;
+ return m_dataLen - 1;
}
size_t getUsedDataLen() const {
@@ -121,7 +124,7 @@
}
void setData(uint8 *data, size_t len) {
- memset(m_data, 0, m_dataLen);
+ memset(m_data, '\0', m_dataLen);
if(len > m_dataLen)
{
memcpy(m_data, data, m_dataLen);
Modified: tiki/include/Tiki/net/http/cookie.h
===================================================================
--- tiki/include/Tiki/net/http/cookie.h 2007-08-25 02:07:26 UTC (rev 493)
+++ tiki/include/Tiki/net/http/cookie.h 2007-08-25 08:48:53 UTC (rev 494)
@@ -8,22 +8,17 @@
#ifndef __TIKI_NET_HTTP_COOKIE_H
#define __TIKI_NET_HTTP_COOKIE_H
-#include "Tiki/refcnt.h"
-
namespace Tiki {
namespace Net {
namespace Http {
-class Cookie : public RefCnt {
+class Cookie {
public:
- Cookie( std::string name, std::string value, std::string version,
- std::string comment = "", long maxage = 0, std::string path = "",
- bool secure = false) :
- m_name(name), m_value(value), m_version(version), m_comment(comment),
- m_maxage(maxage), m_path(path), m_secure(secure) {};
+ Cookie( std::string name, std::string value) :
+ m_name(name), m_value(value), m_maxage(0) {};
std::string getName() const {
return m_name;
@@ -37,25 +32,54 @@
return m_version;
}
+ void setVersion(std::string version) {
+ m_version = version;
+ }
+
+ std::string getDomain() const {
+ return m_domain;
+ }
+
+ void setDomain(std::string domain) {
+ m_domain = domain;
+ }
+
std::string getComment() const {
return m_comment;
}
+ void setComment(std::string comment) {
+ m_comment = comment;
+ }
+
std::string getPath() const {
return m_path;
}
+ void setPath(std::string path) {
+ m_path = path;
+ }
+
long getMaxAge() const {
return m_maxage;
}
+ void setMaxAge(long age) {
+ m_maxage = age;
+ }
+
bool isSecure() {
return m_secure;
}
+
+ void setSecure(bool secure) {
+ m_secure = secure;
+ }
private:
std::string m_name;
std::string m_value;
std::string m_version;
+ std::string m_domain;
std::string m_comment;
long m_maxage;
std::string m_path;
Modified: tiki/include/Tiki/net/http/request.h
===================================================================
--- tiki/include/Tiki/net/http/request.h 2007-08-25 02:07:26 UTC (rev 493)
+++ tiki/include/Tiki/net/http/request.h 2007-08-25 08:48:53 UTC (rev 494)
@@ -8,15 +8,15 @@
#ifndef __TIKI_NET_HTTP_REQUEST_H
#define __TIKI_NET_HTTP_REQUEST_H
-#include "Tiki/refcnt.h"
+#include "Tiki/refcnt.h"
#include "Tiki/net/util/base64.h"
namespace Tiki {
namespace Net {
-namespace Http {
-
+namespace Http {
+
using Tiki::Net::Util::Base64;
extern std::string DEFAULT_CONTENT_PART;
@@ -24,7 +24,7 @@
class Request : public RefCnt {
public:
Request();
- /*
+
virtual ~Request() {
m_params.clear();
if(!m_parts.empty()) {
@@ -36,19 +36,19 @@
}
m_parts.clear();
}
- */
-
- void setAuthentication(std::string username, std::string password) {
- std::string param = username + ":" + password;
- Buffer *inputBuf = new Buffer(param.length(), (uint8 *)param.c_str());
-
- Base64 b64;
- Buffer *result = b64.encode(inputBuf);
-
- setHeaderParam("Authorization", std::string("Basic ") + std::string((char *)result->getData()));
-
- delete inputBuf;
- delete result;
+
+
+ void setAuthentication(std::string username, std::string password) {
+ std::string param = username + ":" + password;
+ Buffer *inputBuf = new Buffer(param.length(), (uint8 *)param.c_str());
+
+ Base64 b64;
+ Buffer *result = b64.encode(inputBuf);
+
+ setHeaderParam("Authorization", std::string("Basic ") + std::string((char *)result->getData()));
+
+ delete inputBuf;
+ delete result;
}
std::string getUrl() const {
@@ -84,7 +84,7 @@
std::string m_url;
std::string m_boundaryMarker;
typedef std::map<std::string, std::string> StringStringMap;
- typedef std::map<std::string, RefPtr<Buffer> > StringBufferMap;
+ typedef std::map<std::string, Buffer * > StringBufferMap;
StringStringMap m_params;
StringBufferMap m_parts;
bool m_forcedMultiPart;
Modified: tiki/include/Tiki/net/http/useragent.h
===================================================================
--- tiki/include/Tiki/net/http/useragent.h 2007-08-25 02:07:26 UTC (rev 493)
+++ tiki/include/Tiki/net/http/useragent.h 2007-08-25 08:48:53 UTC (rev 494)
@@ -27,7 +27,7 @@
public:
HttpUserAgent();
virtual ~HttpUserAgent() {
- for(std::list< RefPtr< Cookie > >::iterator iter = m_cookies.begin();
+ for(std::list< Cookie * >::iterator iter = m_cookies.begin();
iter != m_cookies.end();
++iter) {
delete *iter;
@@ -59,7 +59,7 @@
return m_proxyPort;
}
- std::list< RefPtr< Cookie > > getCookies() const {
+ std::list< Cookie * > getCookies() const {
return m_cookies;
}
@@ -71,7 +71,7 @@
std::string m_userAgentName;
std::string m_proxyHost;
int m_proxyPort;
- std::list< RefPtr< Cookie > > m_cookies;
+ std::list< Cookie * > m_cookies;
void parseUrl(const std::string url, std::string &host, std::string &resource, int &port);
void buildRequest(const std::string host, const std::string resource, const int port,
Modified: tiki/include/Tiki/net/socket.h
===================================================================
--- tiki/include/Tiki/net/socket.h 2007-08-25 02:07:26 UTC (rev 493)
+++ tiki/include/Tiki/net/socket.h 2007-08-25 08:48:53 UTC (rev 494)
@@ -8,7 +8,7 @@
#ifndef __TIKI_NET_SOCKET_H
#define __TIKI_NET_SOCKET_H
-#include "Tiki/object.h"
+#include "Tiki/refcnt.h"
#include "Tiki/net/address.h"
#include "Tiki/net/buffer.h"
@@ -16,11 +16,12 @@
namespace Net {
-class Socket : public Object
+class Socket : public RefCnt
{
public:
Socket();
Socket(Address *address);
+ virtual ~Socket() {}
Address *getPeerAddress()
{
Modified: tiki/include/Tiki/net/tcpserversocket.h
===================================================================
--- tiki/include/Tiki/net/tcpserversocket.h 2007-08-25 02:07:26 UTC (rev 493)
+++ tiki/include/Tiki/net/tcpserversocket.h 2007-08-25 08:48:53 UTC (rev 494)
@@ -21,6 +21,7 @@
public:
TCPServerSocket() : TCPSocket() {};
TCPServerSocket(Address *address) : TCPSocket(address) {};
+ virtual ~TCPServerSocket() {}
void bind(size_t maxwaiting = 10);
Modified: tiki/include/Tiki/net/tcpsocket.h
===================================================================
--- tiki/include/Tiki/net/tcpsocket.h 2007-08-25 02:07:26 UTC (rev 493)
+++ tiki/include/Tiki/net/tcpsocket.h 2007-08-25 08:48:53 UTC (rev 494)
@@ -19,11 +19,8 @@
namespace TCP {
using Tiki::Net::Buffer;
+using Tiki::Net::Socket;
-class TCPSocket : public Tiki::Net::Socket
-{
- public:
-
#ifndef INVALID_SOCKET
#define INVALID_SOCKET -1
#endif
@@ -31,13 +28,18 @@
#ifndef SOCKET_ERROR
#define SOCKET_ERROR -1
#endif
- TCPSocket() : Socket(), m_open(false) {};
+
+class TCPSocket : public Socket
+{
+ public:
+ TCPSocket() : m_open(false) {};
TCPSocket(Address *address) : Socket(address), m_open(false) {};
#if TIKI_PLAT == TIKI_WIN32
TCPSocket(Address *address, SOCKET socket) : Socket(address), m_open(true), m_socket(socket) {setNonBlocking(false);};
#else
TCPSocket(RefPtr<Address> address, int socket) : Socket(address), m_open(true), m_socket(socket) {setNonBlocking(false);};
#endif
+ virtual ~TCPSocket() {}
virtual void send(Buffer *data);
Modified: tiki/include/Tiki/net/udpsocket.h
===================================================================
--- tiki/include/Tiki/net/udpsocket.h 2007-08-25 02:07:26 UTC (rev 493)
+++ tiki/include/Tiki/net/udpsocket.h 2007-08-25 08:48:53 UTC (rev 494)
@@ -19,6 +19,7 @@
class UDPSocket : public Tiki::Net::Socket
{
public:
+ virtual ~UDPSocket() {}
virtual void send(RefPtr<Buffer> data);
virtual void recv(RefPtr<Buffer> data);
Modified: tiki/include/Tiki/net/util/base64.h
===================================================================
--- tiki/include/Tiki/net/util/base64.h 2007-08-25 02:07:26 UTC (rev 493)
+++ tiki/include/Tiki/net/util/base64.h 2007-08-25 08:48:53 UTC (rev 494)
@@ -20,7 +20,7 @@
private:
void encodeTriplet(uint8 *input, uint8 count, uint8 *output);
- uint8 decodeQuartet(uint8 *input, uint8 *output);
+ int8 decodeQuartet(uint8 *input, uint8 *output);
size_t calcEncodeBufferSize(size_t byteCount);
size_t calcDecodeBufferSize(uint8 *input, size_t inputByteCount);
Modified: tiki/src/audio/stream.cpp
===================================================================
--- tiki/src/audio/stream.cpp 2007-08-25 02:07:26 UTC (rev 493)
+++ tiki/src/audio/stream.cpp 2007-08-25 08:48:53 UTC (rev 494)
@@ -22,10 +22,10 @@
TIKI_OBJECT_END( Stream )
/*
-
+
This module uses CoreAudio to stream data out to the sound output
device. It's based loosely on the KOS snd_stream module.
-
+
*/
bool Stream::initGlobal() {
@@ -276,9 +276,11 @@
}
#if TIKI_PLAT == TIKI_WIN32
-# include <malloc.h>
-# define alloca _alloca
+# include <malloc.h>
+#ifndef alloca
+# define alloca _alloca
#endif
+#endif
bool Stream::fillBuffer( ALuint buffer ) {
// Thanks to VC++ we have to do this with alloca.
Modified: tiki/src/net/address.cpp
===================================================================
--- tiki/src/net/address.cpp 2007-08-25 02:07:26 UTC (rev 493)
+++ tiki/src/net/address.cpp 2007-08-25 08:48:53 UTC (rev 494)
@@ -53,7 +53,7 @@
{
if(m_ip == AddressUnknown)
{
- Tiki::Debug::printf("resolving host: %s\n", m_hostname.c_str());
+ Tiki::Debug::printf("resolving host: %s", m_hostname.c_str());
struct hostent *hp = gethostbyname(m_hostname.c_str());
if(hp != NULL)
{
@@ -62,6 +62,7 @@
#else
memcpy(&m_ip, hp->h_addr, hp->h_length);
#endif
+ Tiki::Debug::printf("...Resolved: %s\n", getIPAddressString().c_str());
}
}
return m_ip;
Modified: tiki/src/net/http/useragent.cpp
===================================================================
--- tiki/src/net/http/useragent.cpp 2007-08-25 02:07:26 UTC (rev 493)
+++ tiki/src/net/http/useragent.cpp 2007-08-25 08:48:53 UTC (rev 494)
@@ -25,18 +25,15 @@
#define READ_ONE_LINE(res, socket) \
{ \
Buffer *recvBuf = new Buffer(1); \
- char tbuf[2]; \
res = ""; \
while(socket->isOpen()) { \
recvBuf->reset(); \
socket->recv(recvBuf); \
if(recvBuf->getUsedDataLen() > 0) { \
- tbuf[0] = recvBuf->getData()[0]; \
- tbuf[1] = '\0'; \
- if(tbuf[0] != '\n' && tbuf[0] != '\r' ) { \
- res.append((char *)tbuf); \
+ if(recvBuf->getData()[0] != '\n' && recvBuf->getData()[0] != '\r' ) { \
+ res.append((char *)recvBuf->getData()); \
} \
- else if(tbuf[0] != '\r' ) { \
+ else if(recvBuf->getData()[0] != '\r' ) { \
break; \
} \
} \
@@ -46,18 +43,18 @@
HttpUserAgent::HttpUserAgent() {
#if TIKI_PLAT == TIKI_WIN32
- setUserAgentName("Tiki/1.0 (Windows)");
+ m_userAgentName = "Tiki/1.0 (Windows)";
#elif TIKI_PLAT == TIKI_NDS
- setUserAgentName("Tiki/1.0 (Nintendo DS)");
+ m_userAgentName = "Tiki/1.0 (Nintendo DS)";
#elif TIKI_PLAT == TIKI_SDL
- setUserAgentName("Tiki/1.0 (SDL)");
+ m_userAgentName = "Tiki/1.0 (SDL)";
#elif TIKI_PLAT == TIKI_OSX
- setUserAgentName("Tiki/1.0 (Mac OS X)");
+ m_userAgentName = "Tiki/1.0 (Mac OS X)";
#else
- setUserAgentName("Tiki/1.0 (Unknown)");
+ m_userAgentName = "Tiki/1.0 (Unknown)";
#endif
- setProxyHost("");
- setProxyPort(8080);
+ m_proxyHost = "";
+ m_proxyPort = 8080;
}
Response *HttpUserAgent::get(Request *req) {
@@ -94,6 +91,7 @@
}
Tiki::Debug::printf("Sending request...\n");
+ Tiki::Debug::printf(requestText.c_str());
socket->send(new Buffer(requestText.length(), (uint8 *)requestText.c_str()));
readResponse(response, socket);
@@ -284,6 +282,8 @@
std::string status = "";
READ_ONE_LINE(status, socket)
+ Tiki::Debug::printf("%s\n", status.c_str());
+
//Tiki::Debug::printf("Status: %s\n", status.c_str());
for(std::string::size_type i = 0; i < status.length(); i++) {
if(status.at(i) == ' ') {
@@ -308,7 +308,65 @@
}
if(!field.compare("Set-Cookie")) {
+ Cookie *cookie;
+ std::string extras = "";
+
+ std::string cookieName, cookieValue;
+ if(value.find(";") != std::string::npos) {
+ extras = value.substr(value.find(";")+1);
+ value = value.substr(0, value.find(";"));
+ }
+ cookieName = value.substr(0, value.find("="));
+ cookieValue = value.substr(value.find("=") + 1);
+ cookie = new Cookie(cookieName, cookieValue);
+
+ while(!extras.empty()) {
+ std::string param = extras;
+ if(extras.find(";") != std::string::npos) {
+ param = extras.substr(0, extras.find(";"));
+ extras = extras.substr(extras.find(";") + 1);
+ }
+ else {
+ extras = "";
+ }
+ while(param.at(0) == ' ') {
+ param = param.substr(1);
+ }
+ std::string paramName = param, paramValue;
+ if(param.find("=") != std::string::npos) {
+ paramName = param.substr(0, param.find("="));
+ paramValue = param.substr(param.find("=") + 1);
+ }
+ if(!paramName.compare("path")) {
+ cookie->setPath(paramValue);
+ }
+ else if(!paramName.compare("expires")) {
+ //cookie->
+ }
+ else if(!paramName.compare("domain")) {
+ cookie->setDomain(paramValue);
+ }
+ else if(!paramName.compare("max-age")) {
+ cookie->setMaxAge(atol(paramValue.c_str()));
+ }
+ else if(!paramName.compare("secure")) {
+ cookie->setSecure(true);
+ }
+ else if(!paramName.compare("version")) {
+ cookie->setVersion(paramValue);
+ }
+ }
+
+ for(std::list<Cookie *>::iterator iter = m_cookies.begin();
+ iter != m_cookies.end();
+ ++iter) {
+ if(!(*iter)->getName().compare(cookieName)) {
+ m_cookies.erase(iter);
+ }
+ }
+
+ m_cookies.push_back(cookie);
}
else {
response->setHeaderParam(field, value);
@@ -316,7 +374,7 @@
}
}
- RefPtr<Buffer> fullBuf = new Buffer(1);
+ Buffer *fullBuf = new Buffer(1);
if(!response->getHeaderParam("Transfer-Encoding").compare("chunked")) {
Tiki::Debug::printf("Encoding is chunked\n");
Modified: tiki/src/net/util/base64.cpp
===================================================================
--- tiki/src/net/util/base64.cpp 2007-08-25 02:07:26 UTC (rev 493)
+++ tiki/src/net/util/base64.cpp 2007-08-25 08:48:53 UTC (rev 494)
@@ -156,7 +156,7 @@
}
- uint8 Base64::decodeQuartet(uint8 *input, uint8 *output) {
+ int8 Base64::decodeQuartet(uint8 *input, uint8 *output) {
uint32 buffer = 0;
if (input[3] == '=') {
@@ -165,8 +165,8 @@
buffer = (buffer | BASE64_DEALPHABET[input[1]]) << 6;
buffer = buffer << 14;
- uint* temp = (uint*) &buffer;
- output [0] = temp[3];
+ uint8* temp = (uint8*) &buffer;
+ output[0] = temp[3];
return 1;
} el...
[truncated message content] |
|
From: <at...@us...> - 2007-08-28 05:22:53
|
Revision: 497
http://cadcdev.svn.sourceforge.net/cadcdev/?rev=497&view=rev
Author: atani
Date: 2007-08-27 22:22:39 -0700 (Mon, 27 Aug 2007)
Log Message:
-----------
added svn:ignore to various directories to ignore *.user, Release and Debug trees
added TinyXML files to 3rdparty tree, will be used in Tiki::Net::Http::CookieJar class
for load/store
Added Tiki::Net::Util::Date methods (not fully implemented or tested)
added "using std::???" lines to Tiki::Net::* classes/headers
Reworked Cookies to be stored in the CookieJar class and sent back to the requesting
server via the UserAgent (currently does not handle expired cookies, that is dependent on the Date
methods above)
Modified Paths:
--------------
tiki/examples/net/httpclient/src/main.cpp
tiki/include/Tiki/net/address.h
tiki/include/Tiki/net/buffer.h
tiki/include/Tiki/net/http/cookie.h
tiki/include/Tiki/net/http/request.h
tiki/include/Tiki/net/http/useragent.h
tiki/nds/Makefile
tiki/sdl/Makefile
tiki/src/net/address.cpp
tiki/src/net/http/request.cpp
tiki/src/net/http/useragent.cpp
tiki/src/net/tcpsocket.cpp
tiki/win32/tiki.cbp
tiki/win32/tiki.layout
tiki/win32/tiki.vcproj
Added Paths:
-----------
tiki/3rdparty/tinyxml/
tiki/3rdparty/tinyxml/changes.txt
tiki/3rdparty/tinyxml/readme.txt
tiki/3rdparty/tinyxml/tinyxml.cpp
tiki/3rdparty/tinyxml/tinyxml.h
tiki/3rdparty/tinyxml/tinyxmlerror.cpp
tiki/3rdparty/tinyxml/tinyxmlparser.cpp
tiki/include/Tiki/net/http/cookiejar.h
tiki/include/Tiki/net/util/date.h
tiki/src/net/http/cookiejar.cpp
tiki/src/net/util/date.cpp
Property Changed:
----------------
tiki/examples/TikiTest/
tiki/examples/console/TikiSnake/
tiki/examples/net/basic/
tiki/examples/net/chat/
tiki/examples/net/chatd/
tiki/examples/net/httpclient/
tiki/win32/
Added: tiki/3rdparty/tinyxml/changes.txt
===================================================================
--- tiki/3rdparty/tinyxml/changes.txt (rev 0)
+++ tiki/3rdparty/tinyxml/changes.txt 2007-08-28 05:22:39 UTC (rev 497)
@@ -0,0 +1,269 @@
+Changes in version 1.0.1:
+- Fixed comment tags which were outputing as '<?--' instead of
+ the correct '<!--'.
+- Implemented the Next and Prev methods of the TiXmlAttribute class.
+- Renamed 'LastAttribtute' to 'LastAttribute'
+- Fixed bad pointer to 'isspace' that could occur while parsing text.
+- Errors finding beginning and end of tags no longer throw it into an
+ infinite loop. (Hopefully.)
+
+Changes in version 1.0.2
+- Minor documentation fixes.
+
+Changes in version 1.0.3
+- After nodes are added to a document, they return a pointer
+ to the new node instead of a bool for success.
+- Elements can be constructed with a value, which is the
+ element name. Every element must have a value or it will be
+ invalid, but the code changes to enforce this are not fully
+ in place.
+
+Changes in version 1.1.0
+- Added the TiXmlAttributeSet class to pull the attributes into
+ a seperate container.
+- Moved the doubly liked list out of XmlBase. Now XmlBase only
+ requires the Print() function and defines some utility functions.
+- Moved errors into a seperate file. (With the idea of internationalization
+ to the other latin-1 languages.)
+- Added the "NodeType"
+- Fixed white space parsing in text to conform with the standard.
+ Basically, all white space becomes just one space.
+- Added the TiXmlDeclaration class to read xml declarations.
+
+Changes in version 1.2.0
+- Removed the factory. The factory was not really in the spirit
+ of small and simple, confused the code, and was of limited value.
+- Added FirstChildElement and NextSiblingElement, because they
+ are such common functions.
+- Re-wrote the example to test and demonstrate more functionality.
+
+Changes in version 1.2.1
+- Fixed a bug where comments couldn't be inside elements.
+- Loading now clears out existing XML rather than appending.
+- Added the "Clear" method on a node to delete all its children.
+
+Changes in version 1.2.2
+- Fixed TiXmlAttribute::Previous actually returning "next." Thanks
+ to Rickard Troedsson for the bug fix.
+
+Changes in version 1.2.3
+- Added the TIXML prefix to the error strings to resolve conflicts
+ with #defines in OS headers. Thanks to Steve Lhomme.
+- Fixed a delete buf that should be a delete [] buf.
+ Thanks to Ephi Sinowitz.
+
+Changes in version 1.2.4
+- ReplaceChild() was almost guarenteed to fail. Should be fixed,
+ thanks to Joe Smith. Joe also pointed out that the Print() functions
+ should take stream references: I agree, and would like to overload
+ the Print() method to take either format, but I don't want to do
+ this in a dot release.
+- Some compilers seem to need an extra <ctype.h> include. Thanks
+ to Steve Lhomme for that.
+
+Changes in version 2.0.0 BETA
+- Made the ToXXX() casts safe if 'this' is null.
+ When "LoadFile" is called with a filename, the value will correctly get set.
+ Thanks to Brian Yoder.
+- Fixed bug where isalpha() and isalnum() would get called with a negative value for
+ high ascii numbers. Thanks to Alesky Aksenov.
+- Fixed some errors codes that were not getting set.
+- Made methods "const" that were not.
+- Added a switch to enable or disable the ignoring of white space. ( TiXmlDocument::SetIgnoreWhiteSpace() )
+- Greater standardization and code re-use in the parser.
+- Added a stream out operator.
+- Added a stream in operator.
+- Entity support, of predefined entites. &#x entities are untouched by input or output.
+- Improved text out formatting.
+- Fixed ReplaceChild bug, thanks to Tao Chen.
+
+Changes in version 2.0.1
+- Fixed hanging on loading a 0 length file. Thanks to Jeff Scozzafava.
+- Fixed crashing on InsertBeforeChild and InsertAfterChild. Also possibility of bad links being
+ created by same function. Thanks to Frank De prins.
+- Added missing licence text. Thanks to Lars Willemsens.
+- Added <ctype.h> include, at the suggestion of Steve Walters.
+
+Changes in version 2.1.0
+- Yves Berquin brings us the STL switch. The forum on SourceForge, and various emails to
+ me, have long debated all out STL vs. no STL at all. And now you can have it both ways.
+ TinyXml will compile either way.
+
+Changes in version 2.1.1
+- Compilation warnings.
+
+Changes in version 2.1.2
+- Uneeded code is not compiled in the STL case.
+- Changed headers so that STL can be turned on or off in tinyxml.h
+
+Changes in version 2.1.3
+- Fixed non-const reference in API; now uses a pointer.
+- Copy constructor of TiXmlString not checking for assignment to self.
+- Nimrod Cohen found a truly evil bug in the STL implementation that occurs
+ when a string is converted to a c_str and then assigned to self. Search for
+ STL_STRING_BUG for a full description. I'm asserting this is a Microsoft STL
+ bug, since &string and string.c_str() should never be the same. Nevertheless,
+ the code works around it.
+- Urivan Saaib pointed out a compiler conflict, where the C headers define
+ the isblank macro, which was wiping out the TiXmlString::isblank() method.
+ The method was unused and has been removed.
+
+Changes in version 2.1.4
+- Reworked the entity code. Entities were not correctly surving round trip input and output.
+ Will now automatically create entities for high ascii in output.
+
+Changes in version 2.1.5
+- Bug fix by kylotan : infinite loop on some input (tinyxmlparser.cpp rev 1.27)
+- Contributed by Ivica Aracic (bytelord) : 1 new VC++ project to compile versions as static libraries (tinyxml_lib.dsp),
+ and an example usage in xmltest.dsp
+ (Patch request ID 678605)
+- A suggestion by Ronald Fenner Jr (dormlock) to add #include <istream> and <ostream> for Apple's Project Builder
+ (Patch request ID 697642)
+- A patch from ohommes that allows to parse correctly dots in element names and attribute names
+ (Patch request 602600 and kylotan 701728)
+- A patch from hermitgeek ( James ) and wasteland for improper error reporting
+- Reviewed by Lee, with the following changes:
+ - Got sick of fighting the STL/non-STL thing in the windows build. Broke
+ them out as seperate projects.
+ - I have too long not included the dsw. Added.
+ - TinyXmlText had a protected Print. Odd.
+ - Made LinkEndChild public, with docs and appropriate warnings.
+ - Updated the docs.
+
+2.2.0
+- Fixed an uninitialized pointer in the TiXmlAttributes
+- Fixed STL compilation problem in MinGW (and gcc 3?) - thanks Brian Yoder for finding this one
+- Fixed a syntax error in TiXmlDeclaration - thanks Brian Yoder
+- Fletcher Dunn proposed and submitted new error handling that tracked the row and column. Lee
+ modified it to not have performance impact.
+- General cleanup suggestions from Fletcher Dunn.
+- In error handling, general errors will no longer clear the error state of specific ones.
+- Fix error in documentation : comments starting with "<?--" instead of "<!--" (thanks ion_pulse)
+- Added the TiXmlHandle. An easy, safe way to browse XML DOMs with less code.
+- Added QueryAttribute calls which have better error messaging. (Proposed by Fletcher Dunn)
+- Nodes and attributes can now print themselves to strings. (Yves suggestion)
+- Fixed bug where entities with one character would confuse parser. (Thanks Roman)
+
+2.2.1
+- Additional testing (no more bugs found to be fixed in this release)
+- Significant performance improvement to the cursor code.
+
+2.3.0
+- User Data are now defined in TiXmlBase instead of TiXmlNode
+- Character Entities are now UCS-2
+- Character Entities can be decimal or hexadecimal
+- UTF-8 conversion.
+- Fixed many, many bugs.
+
+2.3.1
+- Fixed bug in handling nulls embedded in the input.
+- Make UTF-8 parser tolerant of bad text encoding.
+- Added encoding detection.
+- Many fixes and input from John-Philip Leonard Johansson (JP) and Ellers,
+ including UTF-8 feedback, bug reports, and patches. Thanks!
+- Added version # constants - a suggestion from JP and Ellers.
+- [ 979180 ] Missing ; in entity reference, fix from Rob Laveaux.
+- Copy constructors and assignment have been a long time coming. Thanks to
+ Fokke and JP.
+
+2.3.2
+- Made the IsAlpha and IsAlphaNum much more tolerant of non-UTF-8 encodings. Thanks
+ Volker Boerchers for finding the issue.
+- Ran the program though the magnificent Valgrind - http://valgrind.kde.org - to check
+ for memory errors. Fixed some minor issues.
+
+2.3.3
+- Fixed crash when test program was run from incorrect directory.
+- Fixed bug 1070717 - empty document not returned correctly - thanks Katsuhisa Yuasa.
+- Bug 1079301 resolved - deprecated stdlib calls. Thanks Adrian Boeing.
+- Bug 1035218 fixed - documentation errors. Xunji Luo
+- Other bug fixes have accumulated and been fixed on the way as well; my apologies to
+ authors not credited!
+- Big fix / addition is to correctly return const values. TinyXml could basically
+ remove const in a method like this: TiXmlElement* Foo() const, where the returned element
+ was a pointer to internal data. That is now: const TiXmlElement* Foo() const and
+ TiXmlElement* Foo().
+
+2.3.4
+- Fixed additional const errors, thanks Kent Gibson.
+- Correctly re-enable warnings after tinyxml header. Thanks Cory Nelson.
+- Variety of type cleanup and warning fixes. Thanks Warren Stevens.
+- Cleaned up unneeded constructor calls in TinyString - thanks to Geoff Carlton and
+ the discussion group on sourceforge.
+
+2.4.0
+- Improved string class, thanks Tyge Lovset (whose name gets mangled in English - sorry)
+- Type cast compiler warning, thanks Rob van den Bogaard
+- Added GetText() convenience function. Thanks Ilya Parniuk & Andrew Ellers for input.
+- Many thanks to marlonism for finding an infinite loop in bad xml.
+- A patch to cleanup warnings from Robert Gebis.
+- Added ValueStr() to get the value of a node as a string.
+- TiXmlText can now parse and output as CDATA
+- Additional string improvement from James (z2895)
+- Removed extraneous 'const', thanks David Aldrich
+- First pass at switching to the "safe" stdlib functions. Many people have suggested and
+ pushed on this, but Warren Stevens put together the first proposal.
+- TinyXml now will do EOL normalization before parsing, consistent with the W3C XML spec.
+- Documents loaded with the UTF-8 BOM will now save with the UTF-8 BOM. Good suggestion
+ from 'instructor_'
+- Ellers submitted his very popular tutorials, which have been added to the distribution.
+
+2.4.1
+- Fixed CDATA output formatting
+- Fixed memory allocators in TinyString to work with overloaded new/delete
+
+2.4.2
+- solosnake pointed out that TIXML_LOG causes problems on an XBOX. The definition in the header
+ was superflous and was moved inside of DEBUG_PARSING
+
+2.4.3
+- Fixed a test bug that caused a crash in 'xmltest'. TinyXML was fine, but it isn't good
+ to ship with a broken test suite.
+- Started converting some functions to not cast between std::string and const char*
+ quite as often.
+- Added FILE* versions of the document loads - good suggestion from Wade Brainerd
+- Empty documents might not always return the errors they should. [1398915] Thanks to igor v.
+- Added some asserts for multiply adding a node, regardng bug [1391937] suggested by Paco Arjonilla.
+
+2.4.4
+- Bug find thanks to andre-gross found a memory leak that occured when a document failed to load.
+- Bug find (and good analysis) by VirtualJim who found a case where attribute parsing
+ should be throwing an error and wasn't.
+- Steve Hyatt suggested the QueryValueAttribute method, which is now implemented.
+- DavidA identified a chunk of dead code.
+- Andrew Baxter sent in some compiler warnings that were good clean up points.
+
+2.5
+- Added the Visit() API. Many thanks to both Andrew Ellerton and John-Philip for all their
+ work, code, suggestion, and just general pushing that it should be done.
+- Removed existing streaming code and use TiXmlPrinter instead.
+- [ tinyxml-Bugs-1527079 ] Compile error in tinystr.cpp fixed, thanks to Paul Suggs
+- [ tinyxml-Bugs-1522890 ] SaveFile has no error checks fixed, thanks to Ivan Dobrokotov
+- Ivan Dobrokotov also reported redundant memory allocation in the Attribute() method, which
+ upon investigation was a mess. The attribute should now be fixed for both const char* and
+ std::string, and the return types match the input parameters.
+- Feature [ 1511105 ] Make TiXmlComment constructor accept a string / char*, implemented.
+ Thanks to Karl Itschen for the feedback.
+- [ 1480108 ] Stream parsing fails when CDATA contains tags was found by Tobias Grimm, who also
+ submitted a test case and patch. A significant bug in CDATA streaming (operator>>) has now
+ been fixed.
+
+2.5.2
+- Lieven, and others, pointed out a missing const-cast that upset the Open Watcom compiler.
+ Should now be fixed.
+- ErrorRow and ErrorCol should have been const, and weren't. Fixed thanks to Dmitry Polutov.
+
+2.5.3
+- zloe_zlo identified a missing string specialization for QueryValueAttribute() [ 1695429 ]. Worked
+ on this bug, but not sure how to fix it in a safe, cross-compiler way.
+- increased warning level to 4 and turned on detect 64 bit portability issues for VC2005.
+ May address [ 1677737 ] VS2005: /Wp64 warnings
+- grosheck identified several problems with the Document copy. Many thanks for [ 1660367 ]
+- Nice catch, and suggested fix, be Gilad Novik on the Printer dropping entities.
+ "[ 1600650 ] Bug when printing xml text" is now fixed.
+- A subtle fix from Nicos Gollan in the tinystring initializer:
+ [ 1581449 ] Fix initialiser of TiXmlString::nullrep_
+- Great catch, although there isn't a submitter for the bug. [ 1475201 ] TinyXML parses entities in comments.
+ Comments should not, in fact, parse entities. Fixed the code path and added tests.
+- We were not catching all the returns from ftell. Thanks to Bernard for catching that.
+
Added: tiki/3rdparty/tinyxml/readme.txt
===================================================================
--- tiki/3rdparty/tinyxml/readme.txt (rev 0)
+++ tiki/3rdparty/tinyxml/readme.txt 2007-08-28 05:22:39 UTC (rev 497)
@@ -0,0 +1,530 @@
+/** @mainpage
+
+<h1> TinyXML </h1>
+
+TinyXML is a simple, small, C++ XML parser that can be easily
+integrated into other programs.
+
+<h2> What it does. </h2>
+
+In brief, TinyXML parses an XML document, and builds from that a
+Document Object Model (DOM) that can be read, modified, and saved.
+
+XML stands for "eXtensible Markup Language." It allows you to create
+your own document markups. Where HTML does a very good job of marking
+documents for browsers, XML allows you to define any kind of document
+markup, for example a document that describes a "to do" list for an
+organizer application. XML is a very structured and convenient format.
+All those random file formats created to store application data can
+all be replaced with XML. One parser for everything.
+
+The best place for the complete, correct, and quite frankly hard to
+read spec is at <a href="http://www.w3.org/TR/2004/REC-xml-20040204/">
+http://www.w3.org/TR/2004/REC-xml-20040204/</a>. An intro to XML
+(that I really like) can be found at
+<a href="http://skew.org/xml/tutorial/">http://skew.org/xml/tutorial</a>.
+
+There are different ways to access and interact with XML data.
+TinyXML uses a Document Object Model (DOM), meaning the XML data is parsed
+into a C++ objects that can be browsed and manipulated, and then
+written to disk or another output stream. You can also construct an XML document
+from scratch with C++ objects and write this to disk or another output
+stream.
+
+TinyXML is designed to be easy and fast to learn. It is two headers
+and four cpp files. Simply add these to your project and off you go.
+There is an example file - xmltest.cpp - to get you started.
+
+TinyXML is released under the ZLib license,
+so you can use it in open source or commercial code. The details
+of the license are at the top of every source file.
+
+TinyXML attempts to be a flexible parser, but with truly correct and
+compliant XML output. TinyXML should compile on any reasonably C++
+compliant system. It does not rely on exceptions or RTTI. It can be
+compiled with or without STL support. TinyXML fully supports
+the UTF-8 encoding, and the first 64k character entities.
+
+
+<h2> What it doesn't do. </h2>
+
+TinyXML doesn't parse or use DTDs (Document Type Definitions) or XSLs
+(eXtensible Stylesheet Language.) There are other parsers out there
+(check out www.sourceforge.org, search for XML) that are much more fully
+featured. But they are also much bigger, take longer to set up in
+your project, have a higher learning curve, and often have a more
+restrictive license. If you are working with browsers or have more
+complete XML needs, TinyXML is not the parser for you.
+
+The following DTD syntax will not parse at this time in TinyXML:
+
+@verbatim
+ <!DOCTYPE Archiv [
+ <!ELEMENT Comment (#PCDATA)>
+ ]>
+@endverbatim
+
+because TinyXML sees this as a !DOCTYPE node with an illegally
+embedded !ELEMENT node. This may be addressed in the future.
+
+<h2> Tutorials. </h2>
+
+For the impatient, here is a tutorial to get you going. A great way to get started,
+but it is worth your time to read this (very short) manual completely.
+
+- @subpage tutorial0
+
+<h2> Code Status. </h2>
+
+TinyXML is mature, tested code. It is very stable. If you find
+bugs, please file a bug report on the sourceforge web site
+(www.sourceforge.net/projects/tinyxml). We'll get them straightened
+out as soon as possible.
+
+There are some areas of improvement; please check sourceforge if you are
+interested in working on TinyXML.
+
+<h2> Related Projects </h2>
+
+TinyXML projects you may find useful! (Descriptions provided by the projects.)
+
+<ul>
+<li> <b>TinyXPath</b> (http://tinyxpath.sourceforge.net). TinyXPath is a small footprint
+ XPath syntax decoder, written in C++.</li>
+<li> <b>TinyXML++</b> (http://code.google.com/p/ticpp/). TinyXML++ is a completely new
+ interface to TinyXML that uses MANY of the C++ strengths. Templates,
+ exceptions, and much better error handling.</li>
+</ul>
+
+<h2> Features </h2>
+
+<h3> Using STL </h3>
+
+TinyXML can be compiled to use or not use STL. When using STL, TinyXML
+uses the std::string class, and fully supports std::istream, std::ostream,
+operator<<, and operator>>. Many API methods have both 'const char*' and
+'const std::string&' forms.
+
+When STL support is compiled out, no STL files are included whatsoever. All
+the string classes are implemented by TinyXML itself. API methods
+all use the 'const char*' form for input.
+
+Use the compile time #define:
+
+ TIXML_USE_STL
+
+to compile one version or the other. This can be passed by the compiler,
+or set as the first line of "tinyxml.h".
+
+Note: If compiling the test code in Linux, setting the environment
+variable TINYXML_USE_STL=YES/NO will control STL compilation. In the
+Windows project file, STL and non STL targets are provided. In your project,
+It's probably easiest to add the line "#define TIXML_USE_STL" as the first
+line of tinyxml.h.
+
+<h3> UTF-8 </h3>
+
+TinyXML supports UTF-8 allowing to manipulate XML files in any language. TinyXML
+also supports "legacy mode" - the encoding used before UTF-8 support and
+probably best described as "extended ascii".
+
+Normally, TinyXML will try to detect the correct encoding and use it. However,
+by setting the value of TIXML_DEFAULT_ENCODING in the header file, TinyXML
+can be forced to always use one encoding.
+
+TinyXML will assume Legacy Mode until one of the following occurs:
+<ol>
+ <li> If the non-standard but common "UTF-8 lead bytes" (0xef 0xbb 0xbf)
+ begin the file or data stream, TinyXML will read it as UTF-8. </li>
+ <li> If the declaration tag is read, and it has an encoding="UTF-8", then
+ TinyXML will read it as UTF-8. </li>
+ <li> If the declaration tag is read, and it has no encoding specified, then TinyXML will
+ read it as UTF-8. </li>
+ <li> If the declaration tag is read, and it has an encoding="something else", then TinyXML
+ will read it as Legacy Mode. In legacy mode, TinyXML will work as it did before. It's
+ not clear what that mode does exactly, but old content should keep working.</li>
+ <li> Until one of the above criteria is met, TinyXML runs in Legacy Mode.</li>
+</ol>
+
+What happens if the encoding is incorrectly set or detected? TinyXML will try
+to read and pass through text seen as improperly encoded. You may get some strange results or
+mangled characters. You may want to force TinyXML to the correct mode.
+
+You may force TinyXML to Legacy Mode by using LoadFile( TIXML_ENCODING_LEGACY ) or
+LoadFile( filename, TIXML_ENCODING_LEGACY ). You may force it to use legacy mode all
+the time by setting TIXML_DEFAULT_ENCODING = TIXML_ENCODING_LEGACY. Likewise, you may
+force it to TIXML_ENCODING_UTF8 with the same technique.
+
+For English users, using English XML, UTF-8 is the same as low-ASCII. You
+don't need to be aware of UTF-8 or change your code in any way. You can think
+of UTF-8 as a "superset" of ASCII.
+
+UTF-8 is not a double byte format - but it is a standard encoding of Unicode!
+TinyXML does not use or directly support wchar, TCHAR, or Microsoft's _UNICODE at this time.
+It is common to see the term "Unicode" improperly refer to UTF-16, a wide byte encoding
+of unicode. This is a source of confusion.
+
+For "high-ascii" languages - everything not English, pretty much - TinyXML can
+handle all languages, at the same time, as long as the XML is encoded
+in UTF-8. That can be a little tricky, older programs and operating systems
+tend to use the "default" or "traditional" code page. Many apps (and almost all
+modern ones) can output UTF-8, but older or stubborn (or just broken) ones
+still output text in the default code page.
+
+For example, Japanese systems traditionally use SHIFT-JIS encoding.
+Text encoded as SHIFT-JIS can not be read by TinyXML.
+A good text editor can import SHIFT-JIS and then save as UTF-8.
+
+The <a href="http://skew.org/xml/tutorial/">Skew.org link</a> does a great
+job covering the encoding issue.
+
+The test file "utf8test.xml" is an XML containing English, Spanish, Russian,
+and Simplified Chinese. (Hopefully they are translated correctly). The file
+"utf8test.gif" is a screen capture of the XML file, rendered in IE. Note that
+if you don't have the correct fonts (Simplified Chinese or Russian) on your
+system, you won't see output that matches the GIF file even if you can parse
+it correctly. Also note that (at least on my Windows machine) console output
+is in a Western code page, so that Print() or printf() cannot correctly display
+the file. This is not a bug in TinyXML - just an OS issue. No data is lost or
+destroyed by TinyXML. The console just doesn't render UTF-8.
+
+
+<h3> Entities </h3>
+TinyXML recognizes the pre-defined "character entities", meaning special
+characters. Namely:
+
+@verbatim
+ & &
+ < <
+ > >
+ " "
+ ' '
+@endverbatim
+
+These are recognized when the XML document is read, and translated to there
+UTF-8 equivalents. For instance, text with the XML of:
+
+@verbatim
+ Far & Away
+@endverbatim
+
+will have the Value() of "Far & Away" when queried from the TiXmlText object,
+and will be written back to the XML stream/file as an ampersand. Older versions
+of TinyXML "preserved" character entities, but the newer versions will translate
+them into characters.
+
+Additionally, any character can be specified by its Unicode code point:
+The syntax " " or " " are both to the non-breaking space characher.
+
+<h3> Printing </h3>
+TinyXML can print output in several different ways that all have strengths and limitations.
+
+- Print( FILE* ). Output to a std-C stream, which includes all C files as well as stdout.
+ - "Pretty prints", but you don't have control over printing options.
+ - The output is streamed directly to the FILE object, so there is no memory overhead
+ in the TinyXML code.
+ - used by Print() and SaveFile()
+
+- operator<<. Output to a c++ stream.
+ - Integrates with standart C++ iostreams.
+ - Outputs in "network printing" mode without line breaks. Good for network transmission
+ and moving XML between C++ objects, but hard for a human to read.
+
+- TiXmlPrinter. Output to a std::string or memory buffer.
+ - API is less concise
+ - Future printing options will be put here.
+ - Printing may change slightly in future versions as it is refined and expanded.
+
+<h3> Streams </h3>
+With TIXML_USE_STL on TinyXML supports C++ streams (operator <<,>>) streams as well
+as C (FILE*) streams. There are some differences that you may need to be aware of.
+
+C style output:
+ - based on FILE*
+ - the Print() and SaveFile() methods
+
+ Generates formatted output, with plenty of white space, intended to be as
+ human-readable as possible. They are very fast, and tolerant of ill formed
+ XML documents. For example, an XML document that contains 2 root elements
+ and 2 declarations, will still print.
+
+C style input:
+ - based on FILE*
+ - the Parse() and LoadFile() methods
+
+ A fast, tolerant read. Use whenever you don't need the C++ streams.
+
+C++ style output:
+ - based on std::ostream
+ - operator<<
+
+ Generates condensed output, intended for network transmission rather than
+ readability. Depending on your system's implementation of the ostream class,
+ these may be somewhat slower. (Or may not.) Not tolerant of ill formed XML:
+ a document should contain the correct one root element. Additional root level
+ elements will not be streamed out.
+
+C++ style input:
+ - based on std::istream
+ - operator>>
+
+ Reads XML from a stream, making it useful for network transmission. The tricky
+ part is knowing when the XML document is complete, since there will almost
+ certainly be other data in the stream. TinyXML will assume the XML data is
+ complete after it reads the root element. Put another way, documents that
+ are ill-constructed with more than one root element will not read correctly.
+ Also note that operator>> is somewhat slower than Parse, due to both
+ implementation of the STL and limitations of TinyXML.
+
+<h3> White space </h3>
+The world simply does not agree on whether white space should be kept, or condensed.
+For example, pretend the '_' is a space, and look at "Hello____world". HTML, and
+at least some XML parsers, will interpret this as "Hello_world". They condense white
+space. Some XML parsers do not, and will leave it as "Hello____world". (Remember
+to keep pretending the _ is a space.) Others suggest that __Hello___world__ should become
+Hello___world.
+
+It's an issue that hasn't been resolved to my satisfaction. TinyXML supports the
+first 2 approaches. Call TiXmlBase::SetCondenseWhiteSpace( bool ) to set the desired behavior.
+The default is to condense white space.
+
+If you change the default, you should call TiXmlBase::SetCondenseWhiteSpace( bool )
+before making any calls to Parse XML data, and I don't recommend changing it after
+it has been set.
+
+
+<h3> Handles </h3>
+
+Where browsing an XML document in a robust way, it is important to check
+for null returns from method calls. An error safe implementation can
+generate a lot of code like:
+
+@verbatim
+TiXmlElement* root = document.FirstChildElement( "Document" );
+if ( root )
+{
+ TiXmlElement* element = root->FirstChildElement( "Element" );
+ if ( element )
+ {
+ TiXmlElement* child = element->FirstChildElement( "Child" );
+ if ( child )
+ {
+ TiXmlElement* child2 = child->NextSiblingElement( "Child" );
+ if ( child2 )
+ {
+ // Finally do something useful.
+@endverbatim
+
+Handles have been introduced to clean this up. Using the TiXmlHandle class,
+the previous code reduces to:
+
+@verbatim
+TiXmlHandle docHandle( &document );
+TiXmlElement* child2 = docHandle.FirstChild( "Document" ).FirstChild( "Element" ).Child( "Child", 1 ).ToElement();
+if ( child2 )
+{
+ // do something useful
+@endverbatim
+
+Which is much easier to deal with. See TiXmlHandle for more information.
+
+
+<h3> Row and Column tracking </h3>
+Being able to track nodes and attributes back to their origin...
[truncated message content] |
|
From: <at...@us...> - 2007-08-30 22:07:32
|
Revision: 501
http://cadcdev.svn.sourceforge.net/cadcdev/?rev=501&view=rev
Author: atani
Date: 2007-08-30 15:07:22 -0700 (Thu, 30 Aug 2007)
Log Message:
-----------
removing gp2x port since it is no longer functional, a few parts of Tiki are now using features not available in GLES
Modified Paths:
--------------
tiki/include/Tiki/tiki.h
Removed Paths:
-------------
tiki/gp2x/
Modified: tiki/include/Tiki/tiki.h
===================================================================
--- tiki/include/Tiki/tiki.h 2007-08-30 00:05:25 UTC (rev 500)
+++ tiki/include/Tiki/tiki.h 2007-08-30 22:07:22 UTC (rev 501)
@@ -30,8 +30,7 @@
#define TIKI_WIN32 1
#define TIKI_SDL 2
#define TIKI_DC 3
-#define TIKI_GP2X 4
-#define TIKI_NDS 5
+#define TIKI_NDS 4
// Bring in our custom types.
#include "Tiki/tikitypes.h"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <at...@us...> - 2007-09-03 03:44:27
|
Revision: 504
http://cadcdev.svn.sourceforge.net/cadcdev/?rev=504&view=rev
Author: atani
Date: 2007-09-02 20:44:24 -0700 (Sun, 02 Sep 2007)
Log Message:
-----------
* increased the buffer for printf (16kb on all plats except nds which is 1k)
* added tinyxml to the include path
* implemented CookieJar::loadFromXML(), CookieJar::saveToXML()
* added dswifi7 lib to arm7_template
* added Socket::send(string), Socket::recv(string)
* modified httpclient to use a TextConsole
Modified Paths:
--------------
tiki/examples/net/httpclient/src/main.cpp
tiki/include/Tiki/net/http/cookie.h
tiki/include/Tiki/net/socket.h
tiki/include/Tiki/net/tcpsocket.h
tiki/include/Tiki/net/util/base64.h
tiki/nds/Makefile.rules
tiki/nds/arm7_template/Makefile
tiki/sdl/Makefile
tiki/src/base/debug.cpp
tiki/src/gl/drawables/console.cpp
tiki/src/net/http/cookiejar.cpp
tiki/src/net/http/useragent.cpp
tiki/src/net/tcpsocket.cpp
tiki/src/net/util/base64.cpp
tiki/win32/include/Tiki/platnet.h
tiki/win32/src/platnet.cpp
tiki/win32/tiki.vcproj
Added Paths:
-----------
tiki/examples/net/httpclient/resources/
tiki/examples/net/httpclient/resources/pc-ascii.png
Added: tiki/examples/net/httpclient/resources/pc-ascii.png
===================================================================
(Binary files differ)
Property changes on: tiki/examples/net/httpclient/resources/pc-ascii.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: tiki/examples/net/httpclient/src/main.cpp
===================================================================
--- tiki/examples/net/httpclient/src/main.cpp 2007-09-02 23:53:47 UTC (rev 503)
+++ tiki/examples/net/httpclient/src/main.cpp 2007-09-03 03:44:24 UTC (rev 504)
@@ -14,16 +14,22 @@
#include <Tiki/net/http/useragent.h>
#include <Tiki/net/http/request.h>
+#include <Tiki/drawables/console.h>
+
using namespace Tiki;
using namespace Tiki::Debug;
using namespace Tiki::Net;
using namespace Tiki::Net::Http;
+using namespace Tiki::GL;
volatile bool g_quitting = false;
void tkCallback( const Hid::Event & evt, void * data ) {
if ( evt.type == Hid::Event::EvtQuit ) {
g_quitting = true;
}
+ else if (evt.type == Hid::Event::EvtKeypress && evt.key == Hid::Event::KeyEsc) {
+ g_quitting = true;
+ }
}
extern "C" int tiki_main( int argc, char **argv) {
@@ -32,51 +38,75 @@
Hid::callbackReg( tkCallback, NULL );
HttpUserAgent *useragent = new HttpUserAgent();
+ useragent->setCookieJar(new CookieJar());
useragent->setIgnoreCookies(false);
+ useragent->getCookieJar()->loadFromXML("cookies.xml");
//useragent->setProxyHost("proxy.example.com");
//useragent->setProxyPort(80);
Request *request = new Request();
request->setUrl("http://www.google.com/");
- useragent->setCookieJar(new CookieJar());
- useragent->setIgnoreCookies(false);
+
- for(int reqCount = 0; reqCount < 10; reqCount++) {
- Response *response = useragent->get(request);
- Tiki::Debug::printf("response code: %d\n", response->getResultCode());
- std::list<Cookie *> cookies = useragent->getCookieJar()->getCookies();
- for(std::list<Cookie *>::iterator iter = cookies.begin();
- iter != cookies.end();
- ++iter) {
- Cookie *cookie = (*iter);
- if(cookie->isSecure()) {
- Tiki::Debug::printf("COOKIE: %s (version->%s,path->%s,max-age->%d,domain->%s,secure->%s)\n",
- cookie->getName().c_str(), cookie->getVersion().c_str(), cookie->getPath().c_str(), cookie->getMaxAge(),
- cookie->getDomain().c_str(), cookie->isSecure() ? "true" : "false");
- }
- else {
- Tiki::Debug::printf("COOKIE: %s (version->%s,value->%s,path->%s,max-age->%d,domain->%s,secure->%s)\n",
- cookie->getName().c_str(), cookie->getVersion().c_str(), cookie->getValue().c_str(), cookie->getPath().c_str(), cookie->getMaxAge(),
- cookie->getDomain().c_str(), cookie->isSecure() ? "true" : "false");
- }
- }
+#if TIKI_PLAT == TIKI_DC
+ RefPtr<Texture> cf = new Texture("/rd/pc-ascii.png", true);
+#else
+ RefPtr<Texture> cf = new Texture("resources/pc-ascii.png", true);
+#endif
+ ConsoleText *console = new ConsoleText(80, 25, cf);
+ console->setSize(640, 480);
+ console->setTranslate( Vector( 320, 240, 0 ) );
+ console->setAutoWrap( true );
+ console->setAutoScroll( true );
- std::list<std::string> content = response->getContentPartNames();
- for(std::list<std::string>::iterator iter = content.begin();
- iter != content.end();
- ++iter)
- {
- Buffer *responseBuf = response->getContentPart(*iter);
- Tiki::Debug::printf("Content Part: %s [%u bytes]\n", (*iter).c_str(), responseBuf->getUsedDataLen());
- //Tiki::Debug::printf("%s\n", responseBuf->getData());
- }
+ console->printf("Sending request: %s\n", request->getUrl().c_str());
+ Response *response = useragent->get(request);
+
+ console->printf("response code: %d\n", response->getResultCode());
+ std::list<Cookie *> cookies = useragent->getCookieJar()->getCookies();
+ for(std::list<Cookie *>::iterator iter = cookies.begin();
+ iter != cookies.end();
+ ++iter) {
+ Cookie *cookie = (*iter);
+ if(cookie->isSecure()) {
+ console->printf("COOKIE: %s (version->%s,path->%s,max-age->%d,domain->%s,secure->%s)\n",
+ cookie->getName().c_str(), cookie->getVersion().c_str(), cookie->getPath().c_str(), cookie->getMaxAge(),
+ cookie->getDomain().c_str(), cookie->isSecure() ? "true" : "false");
+ }
+ else {
+ console->printf("COOKIE: %s (version->%s,value->%s,path->%s,max-age->%d,domain->%s,secure->%s)\n",
+ cookie->getName().c_str(), cookie->getVersion().c_str(), cookie->getValue().c_str(), cookie->getPath().c_str(), cookie->getMaxAge(),
+ cookie->getDomain().c_str(), cookie->isSecure() ? "true" : "false");
+ }
+ }
- delete response;
+ std::list<std::string> content = response->getContentPartNames();
+ for(std::list<std::string>::iterator iter = content.begin();
+ iter != content.end();
+ ++iter)
+ {
+ Buffer *responseBuf = response->getContentPart(*iter);
+ console->printf("Content Part: %s [%u bytes]\n", (*iter).c_str(), responseBuf->getUsedDataLen());
+ console->printf((char *)responseBuf->getData());
}
+
+ while(!g_quitting) {
+ Frame::begin();
+ console->draw(Drawable::Opaque);
+ Frame::transEnable();
+ console->draw(Drawable::Trans);
+ Frame::finish();
+ }
+
+ useragent->getCookieJar()->saveToXML("cookies.xml");
+
+ delete response;
delete request;
delete useragent;
Tiki::Net::shutdown();
+ Tiki::shutdown();
+
return 0;
}
Modified: tiki/include/Tiki/net/http/cookie.h
===================================================================
--- tiki/include/Tiki/net/http/cookie.h 2007-09-02 23:53:47 UTC (rev 503)
+++ tiki/include/Tiki/net/http/cookie.h 2007-09-03 03:44:24 UTC (rev 504)
@@ -85,6 +85,9 @@
uint64 getCreateTime() const {
return m_createTime;
}
+ void setCreateTime(uint64 time) {
+ m_createTime = time;
+ }
private:
string m_name;
string m_value;
Modified: tiki/include/Tiki/net/socket.h
===================================================================
--- tiki/include/Tiki/net/socket.h 2007-09-02 23:53:47 UTC (rev 503)
+++ tiki/include/Tiki/net/socket.h 2007-09-03 03:44:24 UTC (rev 504)
@@ -65,8 +65,12 @@
virtual void send(Buffer *data) = 0;
+ virtual void send(string &data) = 0;
+
virtual void recv(Buffer *data) = 0;
+ virtual void recv(string &data) = 0;
+
virtual void open() = 0;
virtual void close() = 0;
Modified: tiki/include/Tiki/net/tcpsocket.h
===================================================================
--- tiki/include/Tiki/net/tcpsocket.h 2007-09-02 23:53:47 UTC (rev 503)
+++ tiki/include/Tiki/net/tcpsocket.h 2007-09-03 03:44:24 UTC (rev 504)
@@ -42,8 +42,10 @@
virtual ~TCPSocket() {}
virtual void send(Buffer *data);
+ virtual void send(string &data);
virtual void recv(Buffer *data);
+ virtual void recv(string &data);
virtual bool isOpen() {
return m_open;
Modified: tiki/include/Tiki/net/util/base64.h
===================================================================
--- tiki/include/Tiki/net/util/base64.h 2007-09-02 23:53:47 UTC (rev 503)
+++ tiki/include/Tiki/net/util/base64.h 2007-09-03 03:44:24 UTC (rev 504)
@@ -9,6 +9,8 @@
#ifndef __TIKI_BASE64_H
#define __TIKI_BASE64_H
+#include "Tiki/net/buffer.h"
+
namespace Tiki {
namespace Net {
namespace Util {
Modified: tiki/nds/Makefile.rules
===================================================================
--- tiki/nds/Makefile.rules 2007-09-02 23:53:47 UTC (rev 503)
+++ tiki/nds/Makefile.rules 2007-09-03 03:44:24 UTC (rev 504)
@@ -24,6 +24,7 @@
CXXFLAGS+=-I$(TIKI_DIR)/3rdparty/libogg/include
CXXFLAGS+=-I$(TIKI_DIR)/3rdparty/libvorbis/include
CXXFLAGS+=-I$(TIKI_DIR)/3rdparty/libvorbis/lib
+CXXFLAGS+=-I$(TIKI_DIR)/3rdparty/tinyxml
CXXFLAGS+=-DARM9
CXXFLAGS+=-march=armv5te -mtune=arm946e-s -fomit-frame-pointer -ffast-math -mthumb -mthumb-interwork -O2
CFLAGS=$(CXXFLAGS)
Modified: tiki/nds/arm7_template/Makefile
===================================================================
--- tiki/nds/arm7_template/Makefile 2007-09-02 23:53:47 UTC (rev 503)
+++ tiki/nds/arm7_template/Makefile 2007-09-03 03:44:24 UTC (rev 504)
@@ -37,7 +37,7 @@
ASFLAGS := -g $(ARCH)
LDFLAGS = -specs=ds_arm7.specs -g $(ARCH) -mno-fpu -Wl,-Map,$(notdir $*).map
-LIBS := -lnds7
+LIBS := -lnds7 -ldswifi7
#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
Modified: tiki/sdl/Makefile
===================================================================
--- tiki/sdl/Makefile 2007-09-02 23:53:47 UTC (rev 503)
+++ tiki/sdl/Makefile 2007-09-03 03:44:24 UTC (rev 504)
@@ -48,7 +48,7 @@
THIRD_PARTY_OBJS = $(JPEG_OBJ) $(OGG_OBJ) $(VORBIS_OBJ) $(PNG_OBJ) $(ZLIB_OBJ) $(TINYXML_OBJ)
CFLAGS=-I../include -I$(CURDIR)/include -g
-CFLAGS+=-I../3rdparty/libogg/include -I../3rdparty/libvorbis/include -I../3rdparty/libvorbis/lib
+CFLAGS+=-I../3rdparty/libogg/include -I../3rdparty/libvorbis/include -I../3rdparty/libvorbis/lib -I../3rdparty/tinyxml
SUBDIRS=src
Modified: tiki/src/base/debug.cpp
===================================================================
--- tiki/src/base/debug.cpp 2007-09-02 23:53:47 UTC (rev 503)
+++ tiki/src/base/debug.cpp 2007-09-03 03:44:24 UTC (rev 504)
@@ -19,7 +19,7 @@
// console output in a GUI app.
#if TIKI_PLAT == TIKI_WIN32
va_list args;
- char buffer[ 4096 ];
+ char buffer[ 16 * 1024 ];
va_start( args, fmt );
int i = vsprintf( buffer, fmt, args );
va_end( args );
Modified: tiki/src/gl/drawables/console.cpp
===================================================================
--- tiki/src/gl/drawables/console.cpp 2007-09-02 23:53:47 UTC (rev 503)
+++ tiki/src/gl/drawables/console.cpp 2007-09-03 03:44:24 UTC (rev 504)
@@ -137,7 +137,11 @@
void ConsoleText::printf( const char *fmt, ... )
{
+#if TIKI_PLAT == TIKI_NDS
char buf[ 1024 ];
+#else
+ char buf[ 16 * 1024 ];
+#endif
va_list args;
va_start( args, fmt );
Modified: tiki/src/net/http/cookiejar.cpp
===================================================================
--- tiki/src/net/http/cookiejar.cpp 2007-09-02 23:53:47 UTC (rev 503)
+++ tiki/src/net/http/cookiejar.cpp 2007-09-03 03:44:24 UTC (rev 504)
@@ -10,8 +10,13 @@
#include "Tiki/tiki.h"
#include "Tiki/tikitime.h"
#include "Tiki/net/http/cookiejar.h"
+#include "Tiki/net/util/base64.h"
#include "Tiki/net/util/date.h"
+#include "tinyxml.h"
+
+#include <fstream>
+
namespace Tiki {
namespace Net {
@@ -19,7 +24,10 @@
namespace Http {
using std::string;
+ using std::endl;
using std::list;
+ using std::ofstream;
+ using Tiki::Net::Util::Base64;
CookieJar::CookieJar() {
}
@@ -186,7 +194,9 @@
}
void CookieJar::expireCookies() {
- if(m_cookies.empty()) return;
+ if(m_cookies.empty()) {
+ return;
+ }
list< list< Cookie * >::iterator > cookiesToExpire;
uint64 now = Tiki::Time::gettime();
for(list<Cookie *>::iterator iter = m_cookies.begin();
@@ -195,7 +205,9 @@
// check if cookie has expired
uint64 create = (*iter)->getCreateTime();
uint64 diff = now - create;
- if(diff < 1) diff = 1;
+ if(diff < 1) {
+ diff = 1;
+ }
// convert the diff from microseconds to milliseconds
diff /= 1000;
// convert the diff from milliseconds to seconds
@@ -206,10 +218,84 @@
}
}
- void loadFromXML(string filename) {
+ void CookieJar::loadFromXML(string filename) {
+ TiXmlDocument doc(filename.c_str());
+ Base64 b64;
+ if(doc.LoadFile()) {
+ for(TiXmlNode *node = doc.FirstChildElement("CookieJar")->FirstChild("Cookie"); node != NULL; node = node->NextSibling()) {
+ Cookie *cookie;
+ string name = node->ToElement()->Attribute("name");
+ TiXmlElement *valueNode = node->FirstChildElement("Value");
+ string valueEncoded(valueNode->GetText());
+ Tiki::Debug::printf(valueNode->GetText());
+ Buffer buf(valueEncoded.length(), (uint8 *)valueEncoded.c_str());
+ Buffer *decoded = b64.decode(&buf);
+ string value = (char *)decoded->getData();
+ delete decoded;
+
+ cookie = new Cookie(name, value);
+ for(TiXmlAttribute *attr = node->ToElement()->FirstAttribute();
+ attr != NULL;
+ attr = attr->Next()) {
+ if(!string(attr->Name()).compare("maxage")) {
+ cookie->setMaxAge(attr->IntValue());
+ }
+ else if(!string(attr->Name()).compare("version")) {
+ cookie->setVersion(attr->Value());
+ }
+ else if(!string(attr->Name()).compare("path")) {
+ cookie->setPath(attr->Value());
+ }
+ else if(!string(attr->Name()).compare("secure")) {
+ if(attr->Value()[0] == 't') {
+ cookie->setSecure(true);
+ }
+ }
+ else if(!string(attr->Name()).compare("domain")) {
+ cookie->setDomain(attr->Value());
+ }
+ else if(!string(attr->Name()).compare("created")) {
+ cookie->setCreateTime(attr->IntValue());
+ }
+ }
+ addCookie(cookie);
+ }
+ }
}
- void saveToXML(string filename) {
+ void CookieJar::saveToXML(string filename) {
+ ofstream stream;
+ stream.open(filename.c_str());
+
+ stream << "<?xml version=\"1.0\" ?>" << endl;
+ stream << "<CookieJar>" << endl;
+ Base64 b64;
+ for(list< Cookie * >::iterator iter = m_cookies.begin();
+ iter != m_cookies.end();
+ ++iter) {
+ stream << " <Cookie name=\""<< (*iter)->getName()
+ << "\" version=\"" << (*iter)->getVersion()
+ << "\" maxage=\"" << (*iter)->getMaxAge()
+ << "\" created=\"" << (*iter)->getCreateTime()
+ << "\" domain=\"" << (*iter)->getDomain()
+ << "\" path=\"" << (*iter)->getPath()
+ << "\" secure=\"" << ((*iter)->isSecure() ? string("true") : string("false"))
+ << "\">" << endl;
+ if(!(*iter)->getComment().empty()) {
+ stream << " <Comment>" << (*iter)->getComment() << "</Comment>" << endl;
+ }
+ stream << " <Value><![CDATA[" << endl;
+ Buffer *buf = b64.encode(new Buffer((*iter)->getValue().length(),
+ (uint8 *)((*iter)->getValue().c_str())));
+ stream << (char *)(buf->getData());
+ delete buf;
+ stream << endl << "]]></Value>" << endl;
+ stream << " </Cookie>" << endl;
+ }
+ stream << "</CookieJar>" << endl;
+
+ stream.flush();
+ stream.close();
}
}; // namespace Http
Modified: tiki/src/net/http/useragent.cpp
===================================================================
--- tiki/src/net/http/useragent.cpp 2007-09-02 23:53:47 UTC (rev 503)
+++ tiki/src/net/http/useragent.cpp 2007-09-03 03:44:24 UTC (rev 504)
@@ -28,25 +28,6 @@
using std::istringstream;
using std::ios;
-#define READ_ONE_LINE(res, socket) \
- { \
- Buffer *recvBuf = new Buffer(1); \
- res = ""; \
- while(socket->isOpen()) { \
- recvBuf->reset(); \
- socket->recv(recvBuf); \
- if(recvBuf->getUsedDataLen() > 0) { \
- if(recvBuf->getData()[0] != '\n' && recvBuf->getData()[0] != '\r' ) { \
- res.append((char *)recvBuf->getData()); \
- } \
- else if(recvBuf->getData()[0] != '\r' ) { \
- break; \
- } \
- } \
- } \
- delete recvBuf; \
- }
-
HttpUserAgent::HttpUserAgent() {
#if TIKI_PLAT == TIKI_WIN32
m_userAgentName = "Tiki/1.0 (Windows)";
@@ -100,7 +81,7 @@
Tiki::Debug::printf("Sending request...\n");
Tiki::Debug::printf(requestText.c_str());
- socket->send(new Buffer(requestText.length(), (uint8 *)requestText.c_str()));
+ socket->send(requestText);
readResponse(response, socket);
@@ -144,12 +125,12 @@
}
Tiki::Debug::printf("Sending request...\n");
- socket->send(new Buffer(requestText.length(), (uint8 *)requestText.c_str()));
+ socket->send(requestText);
list<string> content = req->getContentPartNames();
if(content.size() > 1 || req->isForcedMultiPartUpload()) {
string status = "";
- READ_ONE_LINE(status, socket)
+ socket->recv(status);
for(list<string>::iterator iter = content.begin();
iter != content.end();
@@ -168,7 +149,7 @@
temp << "\"; filename=\"" << buf->getFileNameShort() << "\"\r\nContent-Type: " << buf->getContentType() << "\r\n\r\n";
string headerText = temp.str();
//Tiki::Debug::printf("CONTENT_HEADER:\n%s", headerText.c_str());
- socket->send(new Buffer(headerText.length(), (uint8 *)headerText.c_str()));
+ socket->send(headerText);
socket->send(buf);
}
}
@@ -176,7 +157,7 @@
footerText.append(req->getBoundaryMarker());
footerText.append("--\r\n");
//Tiki::Debug::printf("CONTENT_FOOTER:\n%s", footerText.c_str());
- socket->send(new Buffer(footerText.length(), (uint8 *)footerText.c_str()));
+ socket->send(footerText);
}
else if(content.size() == 1) {
Buffer *buf = req->getContentPart(*content.begin());
@@ -303,7 +284,7 @@
parseUrl(response->getUrl(), host, resource, port);
string status = "";
- READ_ONE_LINE(status, socket)
+ socket->recv(status);
Tiki::Debug::printf("%s\n", status.c_str());
@@ -317,7 +298,7 @@
while(1) {
string line = "";
- READ_ONE_LINE(line, socket)
+ socket->recv(line);
if(line.size() == 0) {
// done with headers
break;
@@ -353,7 +334,7 @@
{
sizeDecoded = 0;
string size = "";
- READ_ONE_LINE(size, socket);
+ socket->recv(size);
if(size.empty()) {
sizeDecoded = 1;
continue;
Modified: tiki/src/net/tcpsocket.cpp
===================================================================
--- tiki/src/net/tcpsocket.cpp 2007-09-02 23:53:47 UTC (rev 503)
+++ tiki/src/net/tcpsocket.cpp 2007-09-03 03:44:24 UTC (rev 504)
@@ -34,6 +34,22 @@
} while(dataLen > 0 && (len > 0 || errno == EINTR));
}
+void TCPSocket::send(string &buffer) {
+ uint8 *data = (uint8 *)buffer.c_str();
+ size_t dataLen = buffer.length();
+ int len;
+
+ do {
+ //Tiki::Debug::printf("sending %d bytes\n", dataLen);
+ len = ::send(m_socket, (const char *)data, (int)dataLen, 0);
+ if(len > 0) {
+ //Tiki::Debug::printf("sent %d bytes\n", len);
+ dataLen -= len;
+ data += len;
+ }
+ } while(dataLen > 0 && (len > 0 || errno == EINTR));
+}
+
void TCPSocket::recv(Buffer *data) {
size_t maxReadData = data->getDataLen();
#if TIKI_PLAT == TIKI_NDS
@@ -65,6 +81,24 @@
delete [] tmp;
}
+void TCPSocket::recv(string &data) {
+ Buffer *recvBuf = new Buffer(1);
+ data = "";
+ while(isOpen()) {
+ recvBuf->reset();
+ recv(recvBuf);
+ if(recvBuf->getUsedDataLen() > 0) {
+ if(recvBuf->getData()[0] != '\n' && recvBuf->getData()[0] != '\r' ) {
+ data.append((char *)recvBuf->getData());
+ }
+ else if(recvBuf->getData()[0] != '\r' ) {
+ break;
+ }
+ }
+ }
+ delete recvBuf;
+}
+
void TCPSocket::open() {
struct sockaddr_in sock_addr;
m_socket = socket(AF_INET, SOCK_STREAM, 0);
Modified: tiki/src/net/util/base64.cpp
===================================================================
--- tiki/src/net/util/base64.cpp 2007-09-02 23:53:47 UTC (rev 503)
+++ tiki/src/net/util/base64.cpp 2007-09-03 03:44:24 UTC (rev 504)
@@ -62,7 +62,7 @@
while (inIndex < source->getUsedDataLen()) {
if (source->getUsedDataLen() - inIndex <= 2) {
quartetsPerLine++;
- encodeTriplet (inputData + inIndex, source->getUsedDataLen() - inIndex, result + outIndex);
+ encodeTriplet (inputData + inIndex, static_cast<uint8>(source->getUsedDataLen() - inIndex), result + outIndex);
break;
} else {
quartetsPerLine++;
@@ -200,14 +200,14 @@
}
size_t Base64::calcEncodeBufferSize(size_t byteCount) {
- div_t result = div (byteCount, 3);
+ div_t result = div (static_cast<int>(byteCount), 3);
size_t bytesNeeded = result.quot * 4;
if (result.rem != 0) {
// pad with 4 extra bytes to ensure room for pad characters;
bytesNeeded += 4;
}
// CRLF -> "\r\n" each 76 characters
- result = div (bytesNeeded, 76);
+ result = div (static_cast<int>(byteCount), 76);
bytesNeeded += result.quot * 2;
// allow room for null terminator
@@ -217,7 +217,7 @@
}
size_t Base64::calcDecodeBufferSize(uint8 *input, size_t inputByteCount) {
- div_t result = div (inputByteCount, 4);
+ div_t result = div (static_cast<int>(inputByteCount), 4);
size_t bytesNeeded = result.quot * 3;
if (input[inputByteCount - 1] == '=') {
Modified: tiki/win32/include/Tiki/platnet.h
===================================================================
--- tiki/win32/include/Tiki/platnet.h 2007-09-02 23:53:47 UTC (rev 503)
+++ tiki/win32/include/Tiki/platnet.h 2007-09-03 03:44:24 UTC (rev 504)
@@ -15,5 +15,9 @@
#include <fcntl.h>
#include <winsock2.h>
+#include <wininet.h>
+#pragma comment(lib, "ws2_32.lib")
+#pragma comment(lib, "wininet.lib")
+
#endif // TIKI_PLATFORM_NET_H
Modified: tiki/win32/src/platnet.cpp
===================================================================
--- tiki/win32/src/platnet.cpp 2007-09-02 23:53:47 UTC (rev 503)
+++ tiki/win32/src/platnet.cpp 2007-09-03 03:44:24 UTC (rev 504)
@@ -9,11 +9,14 @@
#include "pch.h"
#include "Tiki/tiki.h"
#include "Tiki/net.h"
+#include "Tiki/glhdrs.h"
namespace Tiki {
namespace Net {
+ DWORD connectionFlags;
+
void init()
{
WORD version_wanted = MAKEWORD(1,1);
@@ -34,6 +37,38 @@
}
}
+bool connect()
+{
+ BOOL state = InternetAutodial(0, Tiki::GetWin32Window());
+ return state == TRUE;
+}
+
+bool isConnected()
+{
+ BOOL state = InternetGetConnectedState(&connectionFlags, 0);
+ if(connectionFlags & INTERNET_CONNECTION_CONFIGURED) {
+ Tiki::Debug::printf("INTERNET_CONNECTION_CONFIGURED is set\n");
+ }
+ if(connectionFlags & INTERNET_CONNECTION_LAN) {
+ Tiki::Debug::printf("INTERNET_CONNECTION_LAN is set\n");
+ }
+ if(connectionFlags & INTERNET_CONNECTION_MODEM) {
+ Tiki::Debug::printf("INTERNET_CONNECTION_MODEM is set\n");
+ }
+ if(connectionFlags & INTERNET_CONNECTION_OFFLINE) {
+ Tiki::Debug::printf("INTERNET_CONNECTION_OFFLINE is set\n");
+ }
+ if(connectionFlags & INTERNET_CONNECTION_PROXY) {
+ Tiki::Debug::printf("INTERNET_CONNECTION_PROXY is set\n");
+ }
+ return state == TRUE;
+}
+
+void disconnect()
+{
+ InternetAutodialHangup(0);
+}
+
} // namespace Net
} // namespace Tiki
\ No newline at end of file
Modified: tiki/win32/tiki.vcproj
===================================================================
--- tiki/win32/tiki.vcproj 2007-09-02 23:53:47 UTC (rev 503)
+++ tiki/win32/tiki.vcproj 2007-09-03 03:44:24 UTC (rev 504)
@@ -42,7 +42,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
- AdditionalIncludeDirectories=""$(ProjectDir)\include";"$(ProjectDir)\..\include";"C:\Program Files\OpenAL 1.1 SDK\include";"$(ProjectDir)\..\3rdparty\libjpeg";"$(ProjectDir)\..\3rdparty\libogg\include";"$(ProjectDir)\..\3rdparty\libpng";"$(ProjectDir)\..\3rdparty\libvorbis\include";"$(ProjectDir)\..\3rdparty\zlib""
+ AdditionalIncludeDirectories=""$(ProjectDir)\include";"$(ProjectDir)\..\include";"C:\Program Files\OpenAL 1.1 SDK\include";"$(ProjectDir)\..\3rdparty\libjpeg";"$(ProjectDir)\..\3rdparty\libogg\include";"$(ProjectDir)\..\3rdparty\libpng";"$(ProjectDir)\..\3rdparty\libvorbis\include";"$(ProjectDir)\..\3rdparty\zlib";"$(ProjectDir)\..\3rdparty\tinyxml""
PreprocessorDefinitions="_WIN32_WINNT=0x0500;_CRT_SECURE_NO_WARNINGS=1"
MinimalRebuild="true"
BasicRuntimeChecks="3"
@@ -108,7 +108,7 @@
/>
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(ProjectDir)\include";"$(ProjectDir)\..\include";"C:\Program Files\OpenAL 1.1 SDK\include";"$(ProjectDir)\..\3rdparty\libjpeg";"$(ProjectDir)\..\3rdparty\libogg\include";"$(ProjectDir)\..\3rdparty\libpng";"$(ProjectDir)\..\3rdparty\libvorbis\include";"$(ProjectDir)\..\3rdparty\zlib""
+ AdditionalIncludeDirectories=""$(ProjectDir)\include";"$(ProjectDir)\..\include";"C:\Program Files\OpenAL 1.1 SDK\include";"$(ProjectDir)\..\3rdparty\libjpeg";"$(ProjectDir)\..\3rdparty\libogg\include";"$(ProjectDir)\..\3rdparty\libpng";"$(ProjectDir)\..\3rdparty\libvorbis\include";"$(ProjectDir)\..\3rdparty\zlib";"$(ProjectDir)\..\3rdparty\tinyxml""
PreprocessorDefinitions="_WIN32_WINNT=0x0500; _CRT_SECURE_NO_WARNINGS=1"
RuntimeLibrary="0"
UsePrecompiledHeader="2"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <at...@us...> - 2007-09-04 17:24:56
|
Revision: 506
http://cadcdev.svn.sourceforge.net/cadcdev/?rev=506&view=rev
Author: atani
Date: 2007-09-04 10:24:54 -0700 (Tue, 04 Sep 2007)
Log Message:
-----------
* various updates to svn:ignore props
* platforms now use proper filenames (dc -> elf, nds -> nds and ds.gba)
* platforms now able to build romdisk and post_build steps
* package targets updated to include new names for example files
Modified Paths:
--------------
tiki/Makefile
tiki/dc/Makefile
tiki/dc/Makefile.rules
tiki/examples/TikiTest/Makefile
tiki/examples/console/TikiSnake/Makefile
tiki/examples/console/TikiSnake/src/TikiSnake.cpp
tiki/examples/net/basic/Makefile
tiki/examples/net/chat/Makefile
tiki/examples/net/chatd/Makefile
tiki/examples/net/httpclient/Makefile
tiki/examples/net/httpclient/src/main.cpp
tiki/nds/Makefile
tiki/nds/Makefile.rules
tiki/sdl/Makefile
tiki/sdl/Makefile.rules
Added Paths:
-----------
tiki/examples/Makefile
tiki/examples/console/Makefile
tiki/examples/net/Makefile
Property Changed:
----------------
tiki/
tiki/3rdparty/libjpeg/
tiki/3rdparty/libogg/src/
tiki/3rdparty/libpng/
tiki/3rdparty/libvorbis/lib/
tiki/3rdparty/tinyxml/
tiki/3rdparty/zlib/
tiki/dc/
tiki/examples/TikiTest/src/
tiki/examples/console/TikiSnake/src/
tiki/examples/net/basic/src/
tiki/examples/net/chat/src/
tiki/examples/net/chatd/src/
tiki/examples/net/httpclient/src/
tiki/nds/
tiki/nds/src/
tiki/nds/src/audio/
tiki/sdl/
tiki/src/audio/
tiki/src/audio/oggvorbis/
tiki/src/base/
tiki/src/gl/
tiki/src/gl/anims/
tiki/src/gl/drawables/
tiki/src/gl/triggers/
tiki/src/hid/
tiki/src/image/
tiki/src/math/
tiki/src/net/
tiki/src/net/http/
tiki/src/net/util/
tiki/src/thread/
Property changes on: tiki
___________________________________________________________________
Name: svn:ignore
+ dist
Property changes on: tiki/3rdparty/libjpeg
___________________________________________________________________
Name: svn:ignore
+ *.d
Property changes on: tiki/3rdparty/libogg/src
___________________________________________________________________
Name: svn:ignore
+ *.d
Property changes on: tiki/3rdparty/libpng
___________________________________________________________________
Name: svn:ignore
+ *.d
Property changes on: tiki/3rdparty/libvorbis/lib
___________________________________________________________________
Name: svn:ignore
+ *.d
Property changes on: tiki/3rdparty/tinyxml
___________________________________________________________________
Name: svn:ignore
+ *.d
Property changes on: tiki/3rdparty/zlib
___________________________________________________________________
Name: svn:ignore
+ *.d
Modified: tiki/Makefile
===================================================================
--- tiki/Makefile 2007-09-03 18:44:28 UTC (rev 505)
+++ tiki/Makefile 2007-09-04 17:24:54 UTC (rev 506)
@@ -23,4 +23,4 @@
dist_copy:
scp -rq dist/$(SVN_VERSION) tr...@at...:public_html/snapshots/tiki
-.PHONY: win32 dc gp2x osx sdl nds
+.PHONY: win32 dc osx sdl nds
Property changes on: tiki/dc
___________________________________________________________________
Name: svn:ignore
+ libtiki.a
Modified: tiki/dc/Makefile
===================================================================
--- tiki/dc/Makefile 2007-09-03 18:44:28 UTC (rev 505)
+++ tiki/dc/Makefile 2007-09-04 17:24:54 UTC (rev 506)
@@ -22,10 +22,10 @@
clean: clean_subdirs
-rm -f $(BASE_OBJS) libtiki.a
+ $(MAKE) TIKI_PLAT=dc -C$(CURDIR)/../examples clean
examples:
- $(MAKE) TIKI_PLAT=dc TIKI_DIR=$(CURDIR)/../ -C$(CURDIR)/../examples/TikiTest
- $(MAKE) TIKI_PLAT=dc TIKI_DIR=$(CURDIR)/../ -C$(CURDIR)/../examples/console/TikiSnake
+ $(MAKE) TIKI_PLAT=dc -C$(CURDIR)/../examples clean all
package:
zip -9r ../dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-dc.zip libtiki.a
@@ -37,8 +37,8 @@
-x "*/.svn/*"
cd .. && \
zip -9ru dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-dc.zip \
- examples/TikiTest/tikitest \
- examples/console/TikiSnake/tikisnake \
+ examples/TikiTest/tikitest.elf \
+ examples/console/TikiSnake/tikisnake.elf \
-x "*/.svn/*"
include Makefile.rules
Modified: tiki/dc/Makefile.rules
===================================================================
--- tiki/dc/Makefile.rules 2007-09-03 18:44:28 UTC (rev 505)
+++ tiki/dc/Makefile.rules 2007-09-04 17:24:54 UTC (rev 506)
@@ -23,3 +23,21 @@
TIKI_BASE_LIBS=-ltiki -ljpeg -loggvorbisplay -lpng -lz -lgl -lm
CXX=kos-c++
CC=kos-cc
+
+PLATFORM_BINARY_EXT=.elf
+ROMDISK_OBJ=
+
+ifdef ROMDISK_DIR
+define build_romdisk
+ $(KOS_GENROMFS) -f romdisk.img -d $(ROMDISK_DIR) -v -x .svn
+ $(KOS_BASE)/utils/bin2o/bin2o romdisk.img romdisk romdisk.o
+ @rm -f romdisk.img
+endef
+ROMDISK_OBJ := romdisk.o
+else
+define build_romdisk
+endef
+endif
+
+define post_build
+endef
Added: tiki/examples/Makefile
===================================================================
--- tiki/examples/Makefile (rev 0)
+++ tiki/examples/Makefile 2007-09-04 17:24:54 UTC (rev 506)
@@ -0,0 +1,8 @@
+
+SUBDIRS = TikiTest console net
+
+TIKI_DIR ?= $(CURDIR)/../
+include $(TIKI_DIR)$(TIKI_PLAT)/Makefile.rules
+
+all: subdirs
+clean: clean_subdirs
Modified: tiki/examples/TikiTest/Makefile
===================================================================
--- tiki/examples/TikiTest/Makefile 2007-09-03 18:44:28 UTC (rev 505)
+++ tiki/examples/TikiTest/Makefile 2007-09-04 17:24:54 UTC (rev 506)
@@ -1,13 +1,27 @@
-TIKI_DIR=../../
+
CFLAGS=-I$(TIKI_DIR)$(TIKI_PLAT)/include -I$(TIKI_DIR)include
OBJS = $(patsubst %.cpp,%.o,$(wildcard src/*.cpp))
-all: $(OBJS)
- $(CXX) $(LDFLAGS) -L$(TIKI_DIR)$(TIKI_PLAT) -L$(TIKI_DIR)$(TIKI_PLAT)/lib $(OBJS) $(TIKI_BASE_LIBS) -o tikitest
+ifeq ($(TIKI_PLAT),nds)
+NDS_CART_CODE ?= TKTS
+NDS_CART_ID ?= TK
+NDS_CART_NAME ?= TikiTest
+NDS_CART_VERSION ?= 1
+endif
+all: tikitest
+tikitest: $(OBJS)
+ $(build_romdisk)
+ $(CXX) $(LDFLAGS) -L$(TIKI_DIR)$(TIKI_PLAT) -L$(TIKI_DIR)$(TIKI_PLAT)/lib $(OBJS) $(TIKI_BASE_LIBS) -o tikitest$(PLATFORM_BINARY_EXT) $(ROMDISK_OBJ)
+ $(post_build)
+
clean:
- -rm -f $(OBJS) tikitest
+ -rm -f $(OBJS) tikitest$(PLATFORM_BINARY_EXT) $(ROMDISK_OBJ)
+ifeq ($(TIKI_PLAT),nds)
+ -rm -f tikitest.nds tikitest.ds.gba
+endif
+TIKI_DIR ?= $(CURDIR)/../../
DEPSDIR=$(CURDIR)
include $(TIKI_DIR)$(TIKI_PLAT)/Makefile.rules
Property changes on: tiki/examples/TikiTest/src
___________________________________________________________________
Name: svn:ignore
+ *.d
Added: tiki/examples/console/Makefile
===================================================================
--- tiki/examples/console/Makefile (rev 0)
+++ tiki/examples/console/Makefile 2007-09-04 17:24:54 UTC (rev 506)
@@ -0,0 +1,8 @@
+
+SUBDIRS = TikiSnake
+
+TIKI_DIR ?= $(CURDIR)/../../
+include $(TIKI_DIR)$(TIKI_PLAT)/Makefile.rules
+
+all: subdirs
+clean: clean_subdirs
Modified: tiki/examples/console/TikiSnake/Makefile
===================================================================
--- tiki/examples/console/TikiSnake/Makefile 2007-09-03 18:44:28 UTC (rev 505)
+++ tiki/examples/console/TikiSnake/Makefile 2007-09-04 17:24:54 UTC (rev 506)
@@ -1,12 +1,28 @@
-CFLAGS=-I../../../$(TIKI_PLAT)/include -I../../../include
+TIKI_DIR ?= ../../../
+CFLAGS = -I../../../$(TIKI_PLAT)/include -I../../../include
OBJS = $(patsubst %.cpp,%.o,$(wildcard src/*.cpp))
+ROMDISK_DIR = resources
-all: $(OBJS)
- $(CXX) $(LDFLAGS) -L$(TIKI_DIR)$(TIKI_PLAT) -L$(TIKI_DIR)$(TIKI_PLAT)/lib $(OBJS) $(TIKI_BASE_LIBS) -o tikisnake
+ifeq ($(TIKI_PLAT),nds)
+NDS_CART_CODE ?= TKSK
+NDS_CART_ID ?= TK
+NDS_CART_NAME ?= TikiSnake
+NDS_CART_VERSION ?= 1
+endif
+all: tikisnake
+
+tikisnake: $(OBJS)
+ $(build_romdisk)
+ $(CXX) $(LDFLAGS) -L$(TIKI_DIR)$(TIKI_PLAT) -L$(TIKI_DIR)$(TIKI_PLAT)/lib $(OBJS) $(TIKI_BASE_LIBS) -o tikisnake$(PLATFORM_BINARY_EXT) $(ROMDISK_OBJ)
+ $(post_build)
+
clean:
- -rm -f $(OBJS) tikisnake
+ -rm -f $(OBJS) tikisnake$(PLATFORM_BINARY_EXT) $(ROMDISK_OBJ)
+ifeq ($(TIKI_PLAT),nds)
+ -rm -f tikisnake.nds tikisnake.ds.gba
+endif
DEPSDIR=$(CURDIR)
-include ../../../$(TIKI_PLAT)/Makefile.rules
+include $(TIKI_DIR)/$(TIKI_PLAT)/Makefile.rules
Property changes on: tiki/examples/console/TikiSnake/src
___________________________________________________________________
Name: svn:ignore
+ *.d
Modified: tiki/examples/console/TikiSnake/src/TikiSnake.cpp
===================================================================
--- tiki/examples/console/TikiSnake/src/TikiSnake.cpp 2007-09-03 18:44:28 UTC (rev 505)
+++ tiki/examples/console/TikiSnake/src/TikiSnake.cpp 2007-09-04 17:24:54 UTC (rev 506)
@@ -8,6 +8,11 @@
#include <Tiki/tiki.h>
+#if TIKI_PLAT == TIKI_DC
+extern uint8 romdisk[];
+KOS_INIT_ROMDISK(romdisk);
+#endif
+
#if TIKI_PLAT == TIKI_WIN32
#include <windows.h>
#include "pch.h"
Added: tiki/examples/net/Makefile
===================================================================
--- tiki/examples/net/Makefile (rev 0)
+++ tiki/examples/net/Makefile 2007-09-04 17:24:54 UTC (rev 506)
@@ -0,0 +1,12 @@
+
+ifneq ($(TIKI_PLAT),dc)
+SUBDIRS = basic chat chatd httpclient
+else
+SUBDIRS =
+endif
+
+TIKI_DIR ?= $(CURDIR)/../../
+include $(TIKI_DIR)$(TIKI_PLAT)/Makefile.rules
+
+all: subdirs
+clean: clean_subdirs
Modified: tiki/examples/net/basic/Makefile
===================================================================
--- tiki/examples/net/basic/Makefile 2007-09-03 18:44:28 UTC (rev 505)
+++ tiki/examples/net/basic/Makefile 2007-09-04 17:24:54 UTC (rev 506)
@@ -1,13 +1,26 @@
-TIKI_DIR=../../../
-CFLAGS=-I$(TIKI_DIR)$(TIKI_PLAT)/include -I$(TIKI_DIR)include
+TIKI_DIR ?= ../../../
+CFLAGS = -I$(TIKI_DIR)$(TIKI_PLAT)/include -I$(TIKI_DIR)include
OBJS = $(patsubst %.cpp,%.o,$(wildcard src/*.cpp))
-all: $(OBJS)
- $(CXX) $(LDFLAGS) -L$(TIKI_DIR)$(TIKI_PLAT) -L$(TIKI_DIR)$(TIKI_PLAT)/lib $(OBJS) $(TIKI_BASE_LIBS) -o basic
+ifeq ($(TIKI_PLAT),nds)
+NDS_CART_CODE ?= TKNB
+NDS_CART_ID ?= TK
+NDS_CART_NAME ?= TikiBasicNet
+NDS_CART_VERSION ?= 1
+endif
+all: basic
+basic: $(OBJS)
+ $(build_romdisk)
+ $(CXX) $(LDFLAGS) -L$(TIKI_DIR)$(TIKI_PLAT) -L$(TIKI_DIR)$(TIKI_PLAT)/lib $(OBJS) $(TIKI_BASE_LIBS) -o basic$(PLATFORM_BINARY_EXT) $(ROMDISK_OBJ)
+ $(post_build)
+
clean:
- -rm -f $(OBJS) basic
+ -rm -f $(OBJS) basic$(PLATFORM_BINARY_EXT) $(ROMDISK_OBJ)
+ifeq ($(TIKI_PLAT),nds)
+ -rm -f basic.nds basic.ds.gba
+endif
DEPSDIR=$(CURDIR)
include $(TIKI_DIR)$(TIKI_PLAT)/Makefile.rules
Property changes on: tiki/examples/net/basic/src
___________________________________________________________________
Name: svn:ignore
+ *.d
Modified: tiki/examples/net/chat/Makefile
===================================================================
--- tiki/examples/net/chat/Makefile 2007-09-03 18:44:28 UTC (rev 505)
+++ tiki/examples/net/chat/Makefile 2007-09-04 17:24:54 UTC (rev 506)
@@ -1,13 +1,26 @@
-TIKI_DIR=../../../
-CFLAGS=-I$(TIKI_DIR)$(TIKI_PLAT)/include -I$(TIKI_DIR)include
+TIKI_DIR ?= ../../../
+CFLAGS = -I$(TIKI_DIR)$(TIKI_PLAT)/include -I$(TIKI_DIR)include
OBJS = $(patsubst %.cpp,%.o,$(wildcard src/*.cpp))
-all: $(OBJS)
- $(CXX) $(LDFLAGS) -L$(TIKI_DIR)$(TIKI_PLAT) -L$(TIKI_DIR)$(TIKI_PLAT)/lib $(OBJS) $(TIKI_BASE_LIBS) -o chat
+ifeq ($(TIKI_PLAT),nds)
+NDS_CART_CODE ?= TKCH
+NDS_CART_ID ?= TK
+NDS_CART_NAME ?= TikiChat
+NDS_CART_VERSION ?= 1
+endif
+all: chat
+chat: $(OBJS)
+ $(build_romdisk)
+ $(CXX) $(LDFLAGS) -L$(TIKI_DIR)$(TIKI_PLAT) -L$(TIKI_DIR)$(TIKI_PLAT)/lib $(OBJS) $(TIKI_BASE_LIBS) -o chat$(PLATFORM_BINARY_EXT) $(ROMDISK_OBJ)
+ $(post_build)
+
clean:
- -rm -f $(OBJS) chat
+ -rm -f $(OBJS) chat$(PLATFORM_BINARY_EXT) $(ROMDISK_OBJ)
+ifeq ($(TIKI_PLAT),nds)
+ -rm -f chat.nds chat.ds.gba
+endif
DEPSDIR=$(CURDIR)
include $(TIKI_DIR)$(TIKI_PLAT)/Makefile.rules
Property changes on: tiki/examples/net/chat/src
___________________________________________________________________
Name: svn:ignore
+ *.d
Modified: tiki/examples/net/chatd/Makefile
===================================================================
--- tiki/examples/net/chatd/Makefile 2007-09-03 18:44:28 UTC (rev 505)
+++ tiki/examples/net/chatd/Makefile 2007-09-04 17:24:54 UTC (rev 506)
@@ -1,13 +1,26 @@
-TIKI_DIR=../../../
-CFLAGS=-I$(TIKI_DIR)$(TIKI_PLAT)/include -I$(TIKI_DIR)include
+TIKI_DIR ?= ../../../
+CFLAGS = -I$(TIKI_DIR)$(TIKI_PLAT)/include -I$(TIKI_DIR)include
OBJS = $(patsubst %.cpp,%.o,$(wildcard src/*.cpp))
-all: $(OBJS)
- $(CXX) $(LDFLAGS) -L$(TIKI_DIR)$(TIKI_PLAT) -L$(TIKI_DIR)$(TIKI_PLAT)/lib $(OBJS) $(TIKI_BASE_LIBS) -o chatd
+ifeq ($(TIKI_PLAT),nds)
+NDS_CART_CODE ?= TKCD
+NDS_CART_ID ?= TK
+NDS_CART_NAME ?= TikiChatd
+NDS_CART_VERSION ?= 1
+endif
+all: chatd
+chatd: $(OBJS)
+ $(build_romdisk)
+ $(CXX) $(LDFLAGS) -L$(TIKI_DIR)$(TIKI_PLAT) -L$(TIKI_DIR)$(TIKI_PLAT)/lib $(OBJS) $(TIKI_BASE_LIBS) -o chatd$(PLATFORM_BINARY_EXT) $(ROMDISK_OBJ)
+ $(post_build)
+
clean:
- -rm -f $(OBJS) chatd
+ -rm -f $(OBJS) chatd$(PLATFORM_BINARY_EXT) $(ROMDISK_OBJ)
+ifeq ($(TIKI_PLAT),nds)
+ -rm -f chatd.nds chatd.ds.gba
+endif
DEPSDIR=$(CURDIR)
include $(TIKI_DIR)$(TIKI_PLAT)/Makefile.rules
Property changes on: tiki/examples/net/chatd/src
___________________________________________________________________
Name: svn:ignore
+ *.d
Modified: tiki/examples/net/httpclient/Makefile
===================================================================
--- tiki/examples/net/httpclient/Makefile 2007-09-03 18:44:28 UTC (rev 505)
+++ tiki/examples/net/httpclient/Makefile 2007-09-04 17:24:54 UTC (rev 506)
@@ -1,13 +1,27 @@
-TIKI_DIR=../../../
-CFLAGS=-I$(TIKI_DIR)$(TIKI_PLAT)/include -I$(TIKI_DIR)include
+TIKI_DIR ?= ../../../
+CFLAGS = -I$(TIKI_DIR)$(TIKI_PLAT)/include -I$(TIKI_DIR)include
OBJS = $(patsubst %.cpp,%.o,$(wildcard src/*.cpp))
+ROMDISK_DIR=resources
-all: $(OBJS)
- $(CXX) $(LDFLAGS) -L$(TIKI_DIR)$(TIKI_PLAT) -L$(TIKI_DIR)$(TIKI_PLAT)/lib $(OBJS) $(TIKI_BASE_LIBS) -o httpclient
+ifeq ($(TIKI_PLAT),nds)
+NDS_CART_CODE ?= TKHT
+NDS_CART_ID ?= TK
+NDS_CART_NAME ?= TikiHttpTest
+NDS_CART_VERSION ?= 1
+endif
+all: httpclient
+httpclient: $(OBJS)
+ $(build_romdisk)
+ $(CXX) $(LDFLAGS) -L$(TIKI_DIR)$(TIKI_PLAT) -L$(TIKI_DIR)$(TIKI_PLAT)/lib $(OBJS) $(TIKI_BASE_LIBS) -o httpclient$(PLATFORM_BINARY_EXT) $(ROMDISK_OBJ)
+ $(post_build)
+
clean:
- -rm -f $(OBJS) httpclient
+ -rm -f $(OBJS) httpclient$(PLATFORM_BINARY_EXT) $(ROMDISK_OBJ)
+ifeq ($(TIKI_PLAT),nds)
+ -rm -f httpclient.nds httpclient.ds.gba
+endif
DEPSDIR=$(CURDIR)
include $(TIKI_DIR)$(TIKI_PLAT)/Makefile.rules
Property changes on: tiki/examples/net/httpclient/src
___________________________________________________________________
Name: svn:ignore
+ *.d
Modified: tiki/examples/net/httpclient/src/main.cpp
===================================================================
--- tiki/examples/net/httpclient/src/main.cpp 2007-09-03 18:44:28 UTC (rev 505)
+++ tiki/examples/net/httpclient/src/main.cpp 2007-09-04 17:24:54 UTC (rev 506)
@@ -51,7 +51,7 @@
#if TIKI_PLAT == TIKI_DC
RefPtr<Texture> cf = new Texture("/rd/pc-ascii.png", true);
#else
- RefPtr<Texture> cf = new Texture("resources/pc-ascii.png", true);
+ RefPtr<Texture> cf = new Texture("pc-ascii.png", true);
#endif
ConsoleText *console = new ConsoleText(80, 25, cf);
console->setSize(640, 480);
Property changes on: tiki/nds
___________________________________________________________________
Name: svn:ignore
+ libtiki.a
Modified: tiki/nds/Makefile
===================================================================
--- tiki/nds/Makefile 2007-09-03 18:44:28 UTC (rev 505)
+++ tiki/nds/Makefile 2007-09-04 17:24:54 UTC (rev 506)
@@ -56,14 +56,11 @@
clean: clean_subdirs
-rm -f $(BASE_OBJS) $(THIRD_PARTY_OBJS) libtiki.a
+ $(MAKE) -C arm7_template clean TOPDIR=$(CURDIR)
+ $(MAKE) TIKI_PLAT=nds -C$(CURDIR)/../examples clean
examples:
- $(MAKE) TIKI_PLAT=nds TIKI_DIR=$(CURDIR)/../ -C$(CURDIR)/../examples/TikiTest
- $(MAKE) TIKI_PLAT=nds TIKI_DIR=$(CURDIR)/../ -C$(CURDIR)/../examples/console/TikiSnake
- $(MAKE) TIKI_PLAT=nds TIKI_DIR=$(CURDIR)/../ -C$(CURDIR)/../examples/net/basic
- $(MAKE) TIKI_PLAT=nds TIKI_DIR=$(CURDIR)/../ -C$(CURDIR)/../examples/net/chat
- $(MAKE) TIKI_PLAT=nds TIKI_DIR=$(CURDIR)/../ -C$(CURDIR)/../examples/net/chatd
- $(MAKE) TIKI_PLAT=nds TIKI_DIR=$(CURDIR)/../ -C$(CURDIR)/../examples/net/httpclient
+ $(MAKE) TIKI_PLAT=nds -C$(CURDIR)/../examples clean all
package:
zip -9r ../dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-nds.zip \
@@ -76,12 +73,28 @@
nds/include \
nds/Makefile.rules \
-x "*/.svn/*"
+ cp ../examples/console/TikiSnake/resources/pc-ascii.png \
+ ../examples/console/TikiSnake
+ cp ../examples/net/httpclient/resources/pc-ascii.png \
+ ../examples/net/httpclient
cd .. && \
zip -9ru dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-nds.zip \
- examples/TikiTest/tikitest \
- examples/console/TikiSnake/tikisnake \
+ examples/TikiTest/tikitest.nds \
+ examples/TikiTest/tikitest.ds.gba \
+ examples/console/TikiSnake/pc-ascii.png \
+ examples/console/TikiSnake/tikisnake.nds \
+ examples/console/TikiSnake/tikisnake.ds.gba \
+ examples/net/basic/basic.nds \
+ examples/net/basic/basic.ds.gba \
+ examples/net/chat/chat.nds \
+ examples/net/chat/chat.ds.gba \
+ examples/net/chatd/chatd.nds \
+ examples/net/chatd/chatd.ds.gba \
+ examples/net/httpclient/pc-ascii.png \
+ examples/net/httpclient/httpclient.nds \
+ examples/net/httpclient/httpclient.ds.gba \
-x "*/.svn/*"
+ rm -f ../examples/console/TikiSnake/pc-ascii.png ../examples/net/httpclient/pc-ascii.png
DEPSDIR=$(CURDIR)
-TIKI_DIR=$(CURDIR)/..
include Makefile.rules
Modified: tiki/nds/Makefile.rules
===================================================================
--- tiki/nds/Makefile.rules 2007-09-03 18:44:28 UTC (rev 505)
+++ tiki/nds/Makefile.rules 2007-09-04 17:24:54 UTC (rev 506)
@@ -8,14 +8,13 @@
$(patsubst %, _clean_dir_%, $(SUBDIRS)):
@$(MAKE) -C $(patsubst _clean_dir_%, %, $@) clean
-ifeq ($(strip $(DEVKITPRO)),)
-$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>devkitARM)
+ifeq ($(strip $(DEVKITARM)),)
+$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM)
endif
-TIKI_BASE_LIBS=-ltiki -L$(DEVKITPRO)/libnds/lib -ldswifi9 -lfat -lnds9
+TIKI_BASE_LIBS=-ltiki -L$(DEVKITARM)/libnds/lib -ldswifi9 -lfat -lnds9
-
-CXXFLAGS=-I$(DEVKITPRO)/libnds/include
+CXXFLAGS=-I$(DEVKITARM)/libnds/include
CXXFLAGS+=-I$(TIKI_DIR)/include
CXXFLAGS+=-I$(TIKI_DIR)/nds/include -g
CXXFLAGS+=-I$(TIKI_DIR)/3rdparty/zlib
@@ -33,3 +32,23 @@
LDFLAGS=-specs=ds_arm9.specs -mthumb -mthumb-interwork -mno-fpu -L$(DEVKITPRO)/lib -lgcc
include $(DEVKITARM)/ds_rules
+
+PLATFORM_BINARY_EXT = .arm9.elf
+
+define build_romdisk
+endef
+
+NDS_CART_CODE ?= TIKI
+NDS_CART_ID ?= TK
+NDS_CART_NAME ?= Tiki Example
+NDS_CART_VERSION ?= 1
+
+define post_build
+ @$(MAKE) -C $(TIKI_DIR)/$(TIKI_PLAT)/arm7_template TOPDIR=$(CURDIR)
+ @$(DEVKITARM)/bin/arm-eabi-objcopy -O binary $@.arm9.elf $@.arm9
+ @ndstool -c $@.nds -g $(NDS_CART_CODE) $(NDS_CART_ID) "$(NDS_CART_NAME)" $(NDS_CART_VERSION) -7 tikiarm7.arm7 -9 $@.arm9
+ @dsbuild $@.nds
+ @rm -f $@.arm9
+ @rm -f tikiarm7.arm7
+ @rm -f $@.arm9.elf
+endef
Property changes on: tiki/nds/src
___________________________________________________________________
Name: svn:ignore
+ *.d
Property changes on: tiki/nds/src/audio
___________________________________________________________________
Name: svn:ignore
+ *.d
Property changes on: tiki/sdl
___________________________________________________________________
Name: svn:ignore
+ TikiSDL.layout
TikiSDL.depend
libtiki.a
bin
obj
Modified: tiki/sdl/Makefile
===================================================================
--- tiki/sdl/Makefile 2007-09-03 18:44:28 UTC (rev 505)
+++ tiki/sdl/Makefile 2007-09-04 17:24:54 UTC (rev 506)
@@ -57,14 +57,10 @@
clean: clean_subdirs
-rm -f $(BASE_OBJS) $(THIRD_PARTY_OBJS) libtiki.a
+ $(MAKE) TIKI_PLAT=sdl -C$(CURDIR)/../examples clean
examples:
- $(MAKE) TIKI_PLAT=sdl TIKI_DIR=$(CURDIR)/../ -C$(CURDIR)/../examples/TikiTest
- $(MAKE) TIKI_PLAT=sdl TIKI_DIR=$(CURDIR)/../ -C$(CURDIR)/../examples/console/TikiSnake
- $(MAKE) TIKI_PLAT=sdl TIKI_DIR=$(CURDIR)/../ -C$(CURDIR)/../examples/net/basic
- $(MAKE) TIKI_PLAT=sdl TIKI_DIR=$(CURDIR)/../ -C$(CURDIR)/../examples/net/chatd
- $(MAKE) TIKI_PLAT=sdl TIKI_DIR=$(CURDIR)/../ -C$(CURDIR)/../examples/net/chat
- $(MAKE) TIKI_PLAT=sdl TIKI_DIR=$(CURDIR)/../ -C$(CURDIR)/../examples/net/httpclient
+ $(MAKE) TIKI_PLAT=sdl -C$(CURDIR)/../examples clean all
package:
tar -cvf ../dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-sdl.tar libtiki.a
@@ -75,12 +71,19 @@
--exclude .svn
cp ../examples/console/TikiSnake/resources/pc-ascii.png \
../examples/console/TikiSnake
+ cp ../examples/net/httpclient/resources/pc-ascii.png \
+ ../examples/net/httpclient
tar -uvf ../dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-sdl.tar -C ../ \
examples/TikiTest/tikitest \
+ examples/net/basic/basic \
+ examples/net/chat/chat \
+ examples/net/chatd/chatd \
+ examples/net/httpclient/httpclient \
+ examples/net/httpclient/pc-ascii.png \
examples/console/TikiSnake/tikisnake \
examples/console/TikiSnake/pc-ascii.png \
--exclude .svn
- rm -f ../examples/console/TikiSnake/pc-ascii.png
+ rm -f ../examples/console/TikiSnake/pc-ascii.png ../examples/net/httpclient/pc-ascii.png
gzip ../dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-sdl.tar
include Makefile.rules
Modified: tiki/sdl/Makefile.rules
===================================================================
--- tiki/sdl/Makefile.rules 2007-09-03 18:44:28 UTC (rev 505)
+++ tiki/sdl/Makefile.rules 2007-09-04 17:24:54 UTC (rev 506)
@@ -21,3 +21,12 @@
@$(MAKE) -C $(patsubst _clean_dir_%, %, $@) clean
TIKI_BASE_LIBS=-ltiki $(shell openal-config --libs) -lGL -lGLU $(shell sdl-config --libs)
+
+PLATFORM_BINARY_EXT =
+ROMDISK_OBJ =
+
+define build_romdisk
+endef
+
+define post_build
+endef
Property changes on: tiki/src/audio
___________________________________________________________________
Name: svn:ignore
+ *.d
Property changes on: tiki/src/audio/oggvorbis
___________________________________________________________________
Name: svn:ignore
+ *.d
Property changes on: tiki/src/base
___________________________________________________________________
Name: svn:ignore
+ *.d
Property changes on: tiki/src/gl
___________________________________________________________________
Name: svn:ignore
+ *.d
Property changes on: tiki/src/gl/anims
___________________________________________________________________
Name: svn:ignore
+ *.d
Property changes on: tiki/src/gl/drawables
___________________________________________________________________
Name: svn:ignore
+ *.d
Property changes on: tiki/src/gl/triggers
___________________________________________________________________
Name: svn:ignore
+ *.d
Property changes on: tiki/src/hid
___________________________________________________________________
Name: svn:ignore
+ *.d
Property changes on: tiki/src/image
___________________________________________________________________
Name: svn:ignore
+ *.d
Property changes on: tiki/src/math
___________________________________________________________________
Name: svn:ignore
+ *.d
Property changes on: tiki/src/net
___________________________________________________________________
Name: svn:ignore
+ *.d
Property changes on: tiki/src/net/http
___________________________________________________________________
Name: svn:ignore
+ *.d
Property changes on: tiki/src/net/util
___________________________________________________________________
Name: svn:ignore
+ *.d
Property changes on: tiki/src/thread
___________________________________________________________________
Name: svn:ignore
+ *.d
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <at...@us...> - 2007-09-05 00:49:02
|
Revision: 508
http://cadcdev.svn.sourceforge.net/cadcdev/?rev=508&view=rev
Author: atani
Date: 2007-09-04 17:49:00 -0700 (Tue, 04 Sep 2007)
Log Message:
-----------
* moving arm7_template to tikiarm7
* more svn:ignore prop edits (ignore *.nds, *.ds.gba)
* proper sizing for nds in examples
Modified Paths:
--------------
tiki/examples/TikiTest/src/test.cpp
tiki/examples/console/TikiSnake/src/snake.cpp
tiki/examples/net/httpclient/src/main.cpp
tiki/nds/Makefile
tiki/nds/Makefile.rules
tiki/nds/tikiarm7/Makefile
Added Paths:
-----------
tiki/nds/tikiarm7/
Removed Paths:
-------------
tiki/nds/arm7_template/
Property Changed:
----------------
tiki/examples/TikiTest/
tiki/examples/console/TikiSnake/
tiki/examples/net/basic/
tiki/examples/net/chat/
tiki/examples/net/chatd/
tiki/examples/net/httpclient/
Property changes on: tiki/examples/TikiTest
___________________________________________________________________
Name: svn:ignore
- Debug
Release
*.user
+ Debug
Release
*.user
*.nds
*.ds.gba
Modified: tiki/examples/TikiTest/src/test.cpp
===================================================================
--- tiki/examples/TikiTest/src/test.cpp 2007-09-04 17:56:07 UTC (rev 507)
+++ tiki/examples/TikiTest/src/test.cpp 2007-09-05 00:49:00 UTC (rev 508)
@@ -259,7 +259,11 @@
plx_mat3d_mode( PLX_MAT_PROJECTION );
plx_mat3d_identity();
+#if TIKI_PLAT != TIKI_NDS
plx_mat3d_perspective( 45.0f, 640.0f / 480.0f, 0.1f, 100.0f );
+#else
+ plx_mat3d_perspective( 45.0f, 256.0f / 192.0f, 0.1f, 100.0f );
+#endif
plx_mat3d_mode( PLX_MAT_MODELVIEW );
while ( !quitting )
Property changes on: tiki/examples/console/TikiSnake
___________________________________________________________________
Name: svn:ignore
- Debug
Release
*.user
+ Debug
Release
*.user
*.nds
*.ds.gba
Modified: tiki/examples/console/TikiSnake/src/snake.cpp
===================================================================
--- tiki/examples/console/TikiSnake/src/snake.cpp 2007-09-04 17:56:07 UTC (rev 507)
+++ tiki/examples/console/TikiSnake/src/snake.cpp 2007-09-05 00:49:00 UTC (rev 508)
@@ -71,8 +71,13 @@
//initialize the screen
ConsoleText *ct = new ConsoleText( 80, 25, new Texture( "pc-ascii.png", true ) );
+#if TIKI_PLAT != TIKI_NDS
ct->setSize( 640, 480 );
ct->translate( Vector( 320, 240, 0 ) );
+#else
+ ct->setSize( 256, 192);
+ ct->translate( Vector( 128, 96, 0 ) );
+#endif
ct->setAutoScroll( 0 );
ct->setAutoWrap( 0 );
Property changes on: tiki/examples/net/basic
___________________________________________________________________
Name: svn:ignore
- Debug
Release
*.user
+ Debug
Release
*.user
*.nds
*.ds.gba
Property changes on: tiki/examples/net/chat
___________________________________________________________________
Name: svn:ignore
- Debug
Release
*.user
+ Debug
Release
*.user
*.nds
*.ds.gba
Property changes on: tiki/examples/net/chatd
___________________________________________________________________
Name: svn:ignore
- Debug
Release
*.user
+ Debug
Release
*.user
*.nds
*.ds.gba
Property changes on: tiki/examples/net/httpclient
___________________________________________________________________
Name: svn:ignore
- Debug
Release
*.user
+ Debug
Release
*.user
*.nds
*.ds.gba
Modified: tiki/examples/net/httpclient/src/main.cpp
===================================================================
--- tiki/examples/net/httpclient/src/main.cpp 2007-09-04 17:56:07 UTC (rev 507)
+++ tiki/examples/net/httpclient/src/main.cpp 2007-09-05 00:49:00 UTC (rev 508)
@@ -54,8 +54,13 @@
RefPtr<Texture> cf = new Texture("pc-ascii.png", true);
#endif
ConsoleText *console = new ConsoleText(80, 25, cf);
+#if TIKI_PLAT != TIKI_NDS
console->setSize(640, 480);
console->setTranslate( Vector( 320, 240, 0 ) );
+#else
+ console->setSize(256, 192);
+ console->setTranslate( Vector( 128, 96, 0 ) );
+#endif
console->setAutoWrap( true );
console->setAutoScroll( true );
Modified: tiki/nds/Makefile
===================================================================
--- tiki/nds/Makefile 2007-09-04 17:56:07 UTC (rev 507)
+++ tiki/nds/Makefile 2007-09-05 00:49:00 UTC (rev 508)
@@ -56,23 +56,20 @@
clean: clean_subdirs
-rm -f $(BASE_OBJS) $(THIRD_PARTY_OBJS) libtiki.a
- $(MAKE) -C arm7_template clean TOPDIR=$(CURDIR)
+ $(MAKE) -C tikiarm7 clean TOPDIR=$(CURDIR)
$(MAKE) TIKI_PLAT=nds -C$(CURDIR)/../examples clean
examples:
$(MAKE) TIKI_PLAT=nds -C$(CURDIR)/../examples clean all
package:
- zip -9r ../dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-nds.zip \
- libtiki.a \
- arm7_template \
- -x "*/.svn/*"
cd .. && \
zip -9ru dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-nds.zip \
include \
nds/include \
- nds/Makefile.rules \
- -x "*/.svn/*"
+ nds/libtiki.a \
+ nds/tikiarm7 \
+ nds/Makefile.rules
cp ../examples/console/TikiSnake/resources/pc-ascii.png \
../examples/console/TikiSnake
cp ../examples/net/httpclient/resources/pc-ascii.png \
@@ -92,9 +89,10 @@
examples/net/chatd/chatd.ds.gba \
examples/net/httpclient/pc-ascii.png \
examples/net/httpclient/httpclient.nds \
- examples/net/httpclient/httpclient.ds.gba \
- -x "*/.svn/*"
+ examples/net/httpclient/httpclient.ds.gba
rm -f ../examples/console/TikiSnake/pc-ascii.png ../examples/net/httpclient/pc-ascii.png
+ zip ../dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-nds.zip \
+ -d '*.svn*'
DEPSDIR=$(CURDIR)
include Makefile.rules
Modified: tiki/nds/Makefile.rules
===================================================================
--- tiki/nds/Makefile.rules 2007-09-04 17:56:07 UTC (rev 507)
+++ tiki/nds/Makefile.rules 2007-09-05 00:49:00 UTC (rev 508)
@@ -47,7 +47,7 @@
NDS_CART_VERSION ?= 1
define post_build
- @$(MAKE) -C $(TIKI_DIR)/$(TIKI_PLAT)/arm7_template TOPDIR=$(CURDIR)
+ @$(MAKE) -C $(TIKI_DIR)/$(TIKI_PLAT)/tikiarm7 TOPDIR=$(CURDIR)
@$(DEVKITARM)/bin/arm-eabi-objcopy -O binary $@.arm9.elf $@.arm9
@ndstool -c $@.nds -g $(NDS_CART_CODE) $(NDS_CART_ID) "$(NDS_CART_NAME)" $(NDS_CART_VERSION) -7 tikiarm7.arm7 -9 $@.arm9
@dsbuild $@.nds
Copied: tiki/nds/tikiarm7 (from rev 507, tiki/nds/arm7_template)
Property changes on: tiki/nds/tikiarm7
___________________________________________________________________
Name: svn:ignore
+ build
tikiarm7.arm7.elf
Modified: tiki/nds/tikiarm7/Makefile
===================================================================
--- tiki/nds/arm7_template/Makefile 2007-09-04 17:56:07 UTC (rev 507)
+++ tiki/nds/tikiarm7/Makefile 2007-09-05 00:49:00 UTC (rev 508)
@@ -19,6 +19,11 @@
INCLUDES := include build
DATA :=
TARGET := tikiarm7
+
+#---------------------------------------------------------------------------------
+# set default for TOPDIR so it doesnt try to write to / (root)
+#---------------------------------------------------------------------------------
+TOPDIR := $(CURDIR)
#---------------------------------------------------------------------------------
# options for code generation
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <at...@us...> - 2007-09-05 07:29:11
|
Revision: 509
http://cadcdev.svn.sourceforge.net/cadcdev/?rev=509&view=rev
Author: atani
Date: 2007-09-05 00:29:05 -0700 (Wed, 05 Sep 2007)
Log Message:
-----------
* Wired Tiki::Debug::printf on NDS to render to sub-screen
* disabled libfat (hangs NO$GBA, need to verify real hardware)
* reworked NDS init/glhooks, still not 100% functional, but seems to get further
Modified Paths:
--------------
tiki/include/Tiki/plxcompat.h
tiki/nds/Makefile.rules
tiki/nds/src/init_shutdown.cpp
tiki/nds/src/platgl.cpp
tiki/nds/src/platnet.cpp
tiki/src/base/debug.cpp
tiki/src/net/util/base64.cpp
Added Paths:
-----------
tiki/nds/tiki.cbp
Removed Paths:
-------------
tiki/examples/TikiTest/tikitest.layout
tiki/win32/tiki.layout
Property Changed:
----------------
tiki/nds/
tiki/win32/
Deleted: tiki/examples/TikiTest/tikitest.layout
===================================================================
--- tiki/examples/TikiTest/tikitest.layout 2007-09-05 00:49:00 UTC (rev 508)
+++ tiki/examples/TikiTest/tikitest.layout 2007-09-05 07:29:05 UTC (rev 509)
@@ -1,10 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE CodeBlocks_layout_file>
-<CodeBlocks_layout_file>
- <File name="src\TikiTest.cpp" open="0" top="0">
- <Cursor position="147" topLine="0"/>
- </File>
- <File name="src\test.cpp" open="0" top="0">
- <Cursor position="5471" topLine="217"/>
- </File>
-</CodeBlocks_layout_file>
Modified: tiki/include/Tiki/plxcompat.h
===================================================================
--- tiki/include/Tiki/plxcompat.h 2007-09-05 00:49:00 UTC (rev 508)
+++ tiki/include/Tiki/plxcompat.h 2007-09-05 07:29:05 UTC (rev 509)
@@ -257,7 +257,6 @@
// Incoming Z coords will be divided by this number, to ensure they
// stay inside the ortho depth limits.
static const float zscale = 1000.0f;
-
#define PRIMPRE() do { \
if (!stripping) \
glBegin(GL_TRIANGLE_STRIP); \
@@ -270,19 +269,17 @@
} else { \
stripping = true; \
} \
-} while(0)
+} while(0)
static inline void glColoru32( uint32 argb ) {
uint8 r = ( uint8 ) ( ( argb >> 16 ) & 0xff );
uint8 g = ( uint8 ) ( ( argb >> 8 ) & 0xff );
uint8 b = ( uint8 ) ( ( argb >> 0 ) & 0xff );
- uint8 a = ( uint8 ) ( ( argb >> 24 ) & 0xff );
#if TIKI_PLAT != TIKI_NDS
-
+ uint8 a = ( uint8 ) ( ( argb >> 24 ) & 0xff );
glColor4ub( r, g, b, a );
#else
-
- glColor3f( r, g, b );
+ glColor3b( r, g, b );
#endif
}
@@ -291,10 +288,10 @@
// within a single strip, but that generally shouldn't be happening anyway.
static bool stripping = false;
static inline void plx_prim( plx_vertex_t * vert, int size = 0 ) {
- PRIMPRE();
- glColoru32( vert->argb );
+ PRIMPRE();
+ glColoru32( vert->argb );
glTexCoord2f( vert->u, vert->v );
- glVertex3f( vert->x, vert->y, vert->z / zscale );
+ glVertex3f( vert->x, vert->y, vert->z / zscale );
PRIMPOST( vert->flags );
}
@@ -376,14 +373,11 @@
*/
static inline void plx_vert_fnp( int flags, float x, float y, float z, float a, float r, float g, float b ) {
PRIMPRE();
-#if TIKI_PLAT != TIKI_NDS
-
- glColor4f( r, g, b, a );
-#else
-
- glColor3f( r, g, b );
+#if TIKI_PLAT != TIKI_NDS
+ glColor4f( r, g, b, a );
+#else
+ glColor3f( r, g, b );
#endif
-
glVertex3f( x, y, z / zscale );
PRIMPOST( flags );
}
@@ -394,7 +388,7 @@
static inline void plx_vert_inp( int flags, float x, float y, float z, uint32 color ) {
PRIMPRE();
glColoru32( color );
- glVertex3f( x, y, z / zscale );
+ glVertex3f( x, y, z / zscale );
PRIMPOST( flags );
}
@@ -405,7 +399,7 @@
PRIMPRE();
glColoru32( color );
plx_xform( x, y, z );
- glVertex3f( x, y, z / zscale );
+ glVertex3f( x, y, z / zscale );
PRIMPOST( flags );
}
@@ -426,16 +420,13 @@
static inline void plx_vert_ffp( int flags, float x, float y, float z,
float a, float r, float g, float b, float u, float v ) {
PRIMPRE();
-#if TIKI_PLAT != TIKI_NDS
-
- glColor4f( r, g, b, a );
-#else
-
- glColor3f( r, g, b );
-#endif
-
- glTexCoord2f( u, v );
- glVertex3f( x, y, z / zscale );
+#if TIKI_PLAT != TIKI_NDS
+ glColor4f( r, g, b, a );
+#else
+ glColor3f( r, g, b );
+#endif
+ glTexCoord2f( u, v );
+ glVertex3f( x, y, z / zscale );
PRIMPOST( flags );
}
@@ -445,8 +436,8 @@
static inline void plx_vert_ifp( int flags, float x, float y, float z, uint32 color, float u, float v ) {
PRIMPRE();
glColoru32( color );
- glTexCoord2f( u, v );
- glVertex3f( x, y, z / zscale );
+ glTexCoord2f( u, v );
+ glVertex3f( x, y, z / zscale );
PRIMPOST( flags );
}
Property changes on: tiki/nds
___________________________________________________________________
Name: svn:ignore
- libtiki.a
+ libtiki.a
tiki.depend
tiki.layout
.objs
Modified: tiki/nds/Makefile.rules
===================================================================
--- tiki/nds/Makefile.rules 2007-09-05 00:49:00 UTC (rev 508)
+++ tiki/nds/Makefile.rules 2007-09-05 07:29:05 UTC (rev 509)
@@ -28,7 +28,7 @@
CXXFLAGS+=-I$(TIKI_DIR)/3rdparty/libvorbis/lib
CXXFLAGS+=-I$(TIKI_DIR)/3rdparty/tinyxml
CXXFLAGS+=-DARM9
-CXXFLAGS+=-march=armv5te -mtune=arm946e-s -fomit-frame-pointer -ffast-math -mthumb -mthumb-interwork -O2
+CXXFLAGS+=-march=armv5te -mtune=arm946e-s -fomit-frame-pointer -ffast-math -mthumb -mthumb-interwork -O2 -g
CFLAGS=$(CXXFLAGS)
CXXFLAGS+=-fno-rtti
Modified: tiki/nds/src/init_shutdown.cpp
===================================================================
--- tiki/nds/src/init_shutdown.cpp 2007-09-05 00:49:00 UTC (rev 508)
+++ tiki/nds/src/init_shutdown.cpp 2007-09-05 07:29:05 UTC (rev 509)
@@ -30,35 +30,45 @@
bool init( int argc, char **argv ) {
// Turn on everything
- powerON( POWER_ALL );
+ powerON( POWER_ALL );
+
+ lcdMainOnTop();
- // Setup the Main screen for 3D
- videoSetMode( MODE_0_3D );
- vramSetBankA( VRAM_A_TEXTURE );
- lcdMainOnBottom();
-
+ consoleDemoInit();
+
+ // Setup the Main screen for 3D
+ videoSetMode( MODE_0_3D );
+ vramSetBankA( VRAM_A_TEXTURE );
+
+ Tiki::Debug::printf("Enabling IRQs\n");
// IRQ basic setup
- irqInit();
+ irqInit();
+
+ Tiki::Debug::printf("Enabling GL\n");
// initialize the geometry engine
- glInit();
-
+ glInit();
+ glEnable(GL_TEXTURE_2D);
+
+ //Tiki::Debug::printf("Enabling libFAT\n");
// initialize libfat
- fatInitDefault();
+ //fatInitDefault();
// initialize parallax
- GL::Plxcompat::plx_mat3d_init( 256, 192 );
+ GL::Plxcompat::plx_mat3d_init( 256, 192 );
+ Tiki::Debug::printf("Enabling Sound\n");
Audio::Stream::initGlobal();
- Hid::init();
+ Hid::init();
+
irqSet( IRQ_TIMER3, Timer_50ms ); // setup timer IRQ
- irqEnable( IRQ_TIMER3 );
+ irqEnable( IRQ_TIMER3 );
+ Tiki::Debug::printf("Enabling Wifi\n");
{ // send fifo message to initialize the arm7 wifi
REG_IPC_FIFO_CR = IPC_FIFO_ENABLE | IPC_FIFO_SEND_CLEAR; // enable & clear FIFO
u32 Wifi_pass = Wifi_Init( WIFIINIT_OPTION_USELED );
REG_IPC_FIFO_TX = 0x12345678;
- REG_IPC_FIFO_TX = Wifi_pass;
-
+ REG_IPC_FIFO_TX = Wifi_pass;
irqEnable( IRQ_FIFO_NOT_EMPTY );
REG_IPC_FIFO_CR = IPC_FIFO_ENABLE | IPC_FIFO_RECV_IRQ; // enable FIFO IRQ
Modified: tiki/nds/src/platgl.cpp
===================================================================
--- tiki/nds/src/platgl.cpp 2007-09-05 00:49:00 UTC (rev 508)
+++ tiki/nds/src/platgl.cpp 2007-09-05 07:29:05 UTC (rev 509)
@@ -34,7 +34,8 @@
void tiki_scene_finish_hook() {
glFlush( 0 );
- swiWaitForVBlank();
+ //swiWaitForVBlank();
+ Tiki::Debug::printf("Frame::finish()\n");
}
void tiki_scene_begin_opaque_hook() {}
Modified: tiki/nds/src/platnet.cpp
===================================================================
--- tiki/nds/src/platnet.cpp 2007-09-05 00:49:00 UTC (rev 508)
+++ tiki/nds/src/platnet.cpp 2007-09-05 07:29:05 UTC (rev 509)
@@ -20,7 +20,8 @@
}
bool connect() {
- if(!isConnected()) {
+ if(!isConnected()) {
+ Tiki::Debug::printf("Connecting to Wifi\n");
Wifi_AutoConnect();
while(1) {
switch(Wifi_AssocStatus()) {
@@ -40,7 +41,8 @@
}
void disconnect() {
- if(isConnected()) {
+ if(isConnected()) {
+ Tiki::Debug::printf("Disconnecting Wifi\n");
Wifi_DisconnectAP();
}
}
Added: tiki/nds/tiki.cbp
===================================================================
--- tiki/nds/tiki.cbp (rev 0)
+++ tiki/nds/tiki.cbp 2007-09-05 07:29:05 UTC (rev 509)
@@ -0,0 +1,1537 @@
+<?xml version="1.0"?>
+<!DOCTYPE CodeBlocks_project_file>
+<CodeBlocks_project_file>
+ <FileVersion major="1" minor="1"/>
+ <Project>
+ <Option title="Tiki"/>
+ <Option makefile="Makefile"/>
+ <Option makefile_is_custom="1"/>
+ <Option compiler="0"/>
+ <Build>
+ <Target title="default">
+ <Option output="libtiki.a"/>
+ <Option working_dir=""/>
+ <Option object_output=".objs"/>
+ <Option deps_output=".deps"/>
+ <Option type="2"/>
+ <Option compiler="6"/>
+ <Option projectResourceIncludeDirsRelation="2"/>
+ </Target>
+ </Build>
+ <Compiler>
+ <Add option="-O2"/>
+ <Add option="-MMD -MP -MF -march=armv5te -mtune=arm946e-s -fomit-frame-pointer -ffast-math -mthumb -mthumb-interwork -fno-rtti"/>
+ <Add option="-DARM9"/>
+ <Add directory="..\3rdparty\libjpeg"/>
+ <Add directory="..\3rdparty\libogg\include"/>
+ <Add directory="..\3rdparty\libogg\src"/>
+ <Add directory="..\3rdparty\libpng"/>
+ <Add directory="..\3rdparty\libvorbis\include"/>
+ <Add directory="..\3rdparty\libvorbis\lib"/>
+ <Add directory="..\3rdparty\tinyxml"/>
+ <Add directory="..\3rdparty\zlib"/>
+ <Add directory="..\include"/>
+ <Add directory="include"/>
+ </Compiler>
+ <Unit filename="..\3rdparty\libjpeg\jcapimin.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libjpeg\jcapistd.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libjpeg\jccoefct.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libjpeg\jccolor.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libjpeg\jcdctmgr.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libjpeg\jchuff.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libjpeg\jchuff.h">
+ <Option compilerVar=""/>
+ <Option compile="0"/>
+ <Option link="0"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libjpeg\jcinit.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libjpeg\jcmainct.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libjpeg\jcmarker.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libjpeg\jcmaster.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libjpeg\jcomapi.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libjpeg\jconfig.h">
+ <Option compilerVar=""/>
+ <Option compile="0"/>
+ <Option link="0"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libjpeg\jcparam.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libjpeg\jcphuff.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libjpeg\jcprepct.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libjpeg\jcsample.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libjpeg\jctrans.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libjpeg\jdapimin.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libjpeg\jdapistd.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libjpeg\jdatadst.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libjpeg\jdatasrc.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libjpeg\jdcoefct.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libjpeg\jdcolor.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libjpeg\jdct.h">
+ <Option compilerVar=""/>
+ <Option compile="0"/>
+ <Option link="0"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libjpeg\jddctmgr.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libjpeg\jdhuff.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libjpeg\jdhuff.h">
+ <Option compilerVar=""/>
+ <Option compile="0"/>
+ <Option link="0"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libjpeg\jdinput.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libjpeg\jdmainct.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libjpeg\jdmarker.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libjpeg\jdmaster.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libjpeg\jdmerge.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libjpeg\jdphuff.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libjpeg\jdpostct.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libjpeg\jdsample.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libjpeg\jdtrans.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libjpeg\jerror.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libjpeg\jerror.h">
+ <Option compilerVar=""/>
+ <Option compile="0"/>
+ <Option link="0"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libjpeg\jfdctflt.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libjpeg\jfdctfst.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libjpeg\jfdctint.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libjpeg\jidctflt.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libjpeg\jidctfst.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libjpeg\jidctint.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libjpeg\jidctred.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libjpeg\jinclude.h">
+ <Option compilerVar=""/>
+ <Option compile="0"/>
+ <Option link="0"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libjpeg\jmemmgr.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libjpeg\jmemnobs.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libjpeg\jmemsys.h">
+ <Option compilerVar=""/>
+ <Option compile="0"/>
+ <Option link="0"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libjpeg\jmorecfg.h">
+ <Option compilerVar=""/>
+ <Option compile="0"/>
+ <Option link="0"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libjpeg\jpegint.h">
+ <Option compilerVar=""/>
+ <Option compile="0"/>
+ <Option link="0"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libjpeg\jpeglib.h">
+ <Option compilerVar=""/>
+ <Option compile="0"/>
+ <Option link="0"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libjpeg\jquant1.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libjpeg\jquant2.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libjpeg\jutils.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libjpeg\jversion.h">
+ <Option compilerVar=""/>
+ <Option compile="0"/>
+ <Option link="0"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libogg\include\ogg\ogg.h">
+ <Option compilerVar=""/>
+ <Option compile="0"/>
+ <Option link="0"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libogg\include\ogg\os_types.h">
+ <Option compilerVar=""/>
+ <Option compile="0"/>
+ <Option link="0"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libogg\src\bitwise.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libogg\src\framing.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libpng\png.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libpng\png.h">
+ <Option compilerVar=""/>
+ <Option compile="0"/>
+ <Option link="0"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libpng\pngconf.h">
+ <Option compilerVar=""/>
+ <Option compile="0"/>
+ <Option link="0"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libpng\pngerror.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libpng\pnggccrd.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libpng\pngget.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libpng\pngmem.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libpng\pngpread.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libpng\pngread.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libpng\pngrio.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libpng\pngrtran.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libpng\pngrutil.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libpng\pngset.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libpng\pngtrans.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libpng\pngvcrd.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libpng\pngwio.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libpng\pngwrite.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libpng\pngwtran.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libpng\pngwutil.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libvorbis\include\vorbis\codec.h">
+ <Option compilerVar=""/>
+ <Option compile="0"/>
+ <Option link="0"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libvorbis\include\vorbis\vorbisenc.h">
+ <Option compilerVar=""/>
+ <Option compile="0"/>
+ <Option link="0"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libvorbis\include\vorbis\vorbisfile.h">
+ <Option compilerVar=""/>
+ <Option compile="0"/>
+ <Option link="0"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libvorbis\lib\analysis.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libvorbis\lib\backends.h">
+ <Option compilerVar=""/>
+ <Option compile="0"/>
+ <Option link="0"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libvorbis\lib\barkmel.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libvorbis\lib\bitrate.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libvorbis\lib\bitrate.h">
+ <Option compilerVar=""/>
+ <Option compile="0"/>
+ <Option link="0"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libvorbis\lib\block.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libvorbis\lib\books\coupled\res_books_stereo.h">
+ <Option compilerVar=""/>
+ <Option compile="0"/>
+ <Option link="0"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libvorbis\lib\books\floor\floor_books.h">
+ <Option compilerVar=""/>
+ <Option compile="0"/>
+ <Option link="0"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libvorbis\lib\books\uncoupled\res_books_uncoupled.h">
+ <Option compilerVar=""/>
+ <Option compile="0"/>
+ <Option link="0"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libvorbis\lib\codebook.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libvorbis\lib\codebook.h">
+ <Option compilerVar=""/>
+ <Option compile="0"/>
+ <Option link="0"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libvorbis\lib\codec_internal.h">
+ <Option compilerVar=""/>
+ <Option compile="0"/>
+ <Option link="0"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libvorbis\lib\envelope.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libvorbis\lib\envelope.h">
+ <Option compilerVar=""/>
+ <Option compile="0"/>
+ <Option link="0"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libvorbis\lib\floor0.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libvorbis\lib\floor1.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libvorbis\lib\highlevel.h">
+ <Option compilerVar=""/>
+ <Option compile="0"/>
+ <Option link="0"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libvorbis\lib\info.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libvorbis\lib\lookup.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libvorbis\lib\lookup.h">
+ <Option compilerVar=""/>
+ <Option compile="0"/>
+ <Option link="0"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libvorbis\lib\lookup_data.h">
+ <Option compilerVar=""/>
+ <Option compile="0"/>
+ <Option link="0"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libvorbis\lib\lpc.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libvorbis\lib\lpc.h">
+ <Option compilerVar=""/>
+ <Option compile="0"/>
+ <Option link="0"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libvorbis\lib\lsp.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libvorbis\lib\lsp.h">
+ <Option compilerVar=""/>
+ <Option compile="0"/>
+ <Option link="0"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libvorbis\lib\mapping0.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libvorbis\lib\masking.h">
+ <Option compilerVar=""/>
+ <Option compile="0"/>
+ <Option link="0"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libvorbis\lib\mdct.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libvorbis\lib\mdct.h">
+ <Option compilerVar=""/>
+ <Option compile="0"/>
+ <Option link="0"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libvorbis\lib\misc.h">
+ <Option compilerVar=""/>
+ <Option compile="0"/>
+ <Option link="0"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libvorbis\lib\modes\floor_all.h">
+ <Option compilerVar=""/>
+ <Option compile="0"/>
+ <Option link="0"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libvorbis\lib\modes\psych_11.h">
+ <Option compilerVar=""/>
+ <Option compile="0"/>
+ <Option link="0"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libvorbis\lib\modes\psych_16.h">
+ <Option compilerVar=""/>
+ <Option compile="0"/>
+ <Option link="0"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libvorbis\lib\modes\psych_44.h">
+ <Option compilerVar=""/>
+ <Option compile="0"/>
+ <Option link="0"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libvorbis\lib\modes\psych_8.h">
+ <Option compilerVar=""/>
+ <Option compile="0"/>
+ <Option link="0"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libvorbis\lib\modes\residue_16.h">
+ <Option compilerVar=""/>
+ <Option compile="0"/>
+ <Option link="0"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libvorbis\lib\modes\residue_44.h">
+ <Option compilerVar=""/>
+ <Option compile="0"/>
+ <Option link="0"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libvorbis\lib\modes\residue_44u.h">
+ <Option compilerVar=""/>
+ <Option compile="0"/>
+ <Option link="0"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libvorbis\lib\modes\residue_8.h">
+ <Option compilerVar=""/>
+ <Option compile="0"/>
+ <Option link="0"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libvorbis\lib\modes\setup_11.h">
+ <Option compilerVar=""/>
+ <Option compile="0"/>
+ <Option link="0"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libvorbis\lib\modes\setup_16.h">
+ <Option compilerVar=""/>
+ <Option compile="0"/>
+ <Option link="0"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libvorbis\lib\modes\setup_22.h">
+ <Option compilerVar=""/>
+ <Option compile="0"/>
+ <Option link="0"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libvorbis\lib\modes\setup_32.h">
+ <Option compilerVar=""/>
+ <Option compile="0"/>
+ <Option link="0"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libvorbis\lib\modes\setup_44.h">
+ <Option compilerVar=""/>
+ <Option compile="0"/>
+ <Option link="0"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libvorbis\lib\modes\setup_44u.h">
+ <Option compilerVar=""/>
+ <Option compile="0"/>
+ <Option link="0"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libvorbis\lib\modes\setup_8.h">
+ <Option compilerVar=""/>
+ <Option compile="0"/>
+ <Option link="0"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libvorbis\lib\modes\setup_X.h">
+ <Option compilerVar=""/>
+ <Option compile="0"/>
+ <Option link="0"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libvorbis\lib\os.h">
+ <Option compilerVar=""/>
+ <Option compile="0"/>
+ <Option link="0"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libvorbis\lib\psy.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libvorbis\lib\psy.h">
+ <Option compilerVar=""/>
+ <Option compile="0"/>
+ <Option link="0"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libvorbis\lib\registry.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libvorbis\lib\registry.h">
+ <Option compilerVar=""/>
+ <Option compile="0"/>
+ <Option link="0"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libvorbis\lib\res0.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libvorbis\lib\scales.h">
+ <Option compilerVar=""/>
+ <Option compile="0"/>
+ <Option link="0"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libvorbis\lib\sharedbook.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libvorbis\lib\smallft.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libvorbis\lib\smallft.h">
+ <Option compilerVar=""/>
+ <Option compile="0"/>
+ <Option link="0"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libvorbis\lib\synthesis.c">
+ <Option compilerVar="CC"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="..\3rdparty\libvorbis\lib\vorbisenc.c">
+ <Optio...
[truncated message content] |
|
From: <at...@us...> - 2007-09-10 23:35:54
|
Revision: 511
http://cadcdev.svn.sourceforge.net/cadcdev/?rev=511&view=rev
Author: atani
Date: 2007-09-10 16:35:51 -0700 (Mon, 10 Sep 2007)
Log Message:
-----------
adding initialization flags.
Modified Paths:
--------------
tiki/examples/net/chatd/src/ChatServer.cpp
tiki/include/Tiki/tiki.h
tiki/sdl/src/init_shutdown.cpp
tiki/sdl/src/platgl.cpp
tiki/sdl/src/plathid.cpp
Added Paths:
-----------
tiki/src/base/init_flags_default.cpp
Modified: tiki/examples/net/chatd/src/ChatServer.cpp
===================================================================
--- tiki/examples/net/chatd/src/ChatServer.cpp 2007-09-10 17:03:45 UTC (rev 510)
+++ tiki/examples/net/chatd/src/ChatServer.cpp 2007-09-10 23:35:51 UTC (rev 511)
@@ -9,6 +9,8 @@
#include <Tiki/tiki.h>
#include <pch.h>
+TIKI_INIT_FLAGS(INIT_NONE);
+
#if TIKI_PLAT == TIKI_WIN32
#include <windows.h>
Modified: tiki/include/Tiki/tiki.h
===================================================================
--- tiki/include/Tiki/tiki.h 2007-09-10 17:03:45 UTC (rev 510)
+++ tiki/include/Tiki/tiki.h 2007-09-10 23:35:51 UTC (rev 511)
@@ -56,8 +56,39 @@
uint32 swaple( uint32 src );
uint16 swapbe( uint16 src );
uint32 swapbe( uint32 src );
+
+ // Tiki initialization flags
+ // defaults to INIT_HID_DEFAULT | INIT_VIDEO_DEFAULT | INIT_AUDIO_DEFAULT
+ extern uint32 g_tiki_init_flags;
+
+ #define TIKI_INIT_FLAGS(flags) uint32 Tiki::g_tiki_init_flags = (flags);
+ typedef enum {
+ // HID options
+ INIT_HID_KEYBOARD = 0x00000001,
+ INIT_HID_MOUSE = 0x00000002,
+ INIT_HID_JOYSTICK = 0x00000004,
+ INIT_HID_DEFAULT = INIT_HID_KEYBOARD | INIT_HID_MOUSE | INIT_HID_JOYSTICK,
+ INIT_HID_MASK = 0x000000FF,
+
+ // Graphic related options
+ INIT_VIDEO_WINDOWED = 0x00000100,
+ INIT_VIDEO_FULLSCREEN = 0x00000200,
+ INIT_VIDEO_CENTERED = 0x00000400,
+ INIT_VIDEO_DEFAULT = INIT_VIDEO_WINDOWED | INIT_VIDEO_CENTERED,
+ INIT_VIDEO_MASK = 0x0000FF00,
+
+ // Audio related options
+ INIT_AUDIO_STREAM = 0x00010000,
+ INIT_AUDIO_SFX = 0x00020000,
+ INIT_AUDIO_DEFAULT = INIT_AUDIO_STREAM | INIT_AUDIO_SFX,
+ INIT_AUDIO_MASK = 0x00FF0000,
+
+ INIT_NONE = 0x00000000,
+ INIT_DEFAULT = INIT_HID_DEFAULT | INIT_VIDEO_DEFAULT | INIT_AUDIO_DEFAULT,
+ } TIKI_INIT_FLAGS_ENUM;
}
+
// Bring in debug stuff, we'll use it everywhere.
#include "Tiki/debug.h"
Modified: tiki/sdl/src/init_shutdown.cpp
===================================================================
--- tiki/sdl/src/init_shutdown.cpp 2007-09-10 17:03:45 UTC (rev 510)
+++ tiki/sdl/src/init_shutdown.cpp 2007-09-10 23:35:51 UTC (rev 511)
@@ -18,38 +18,63 @@
#include <SDL/SDL.h>
namespace Tiki {
-
bool init( int argc, char **argv ) {
- ALCdevice * dev;
- ALCcontext *context;
if ( SDL_Init( SDL_INIT_EVERYTHING | SDL_INIT_EVENTTHREAD | SDL_INIT_NOPARACHUTE ) < 0 ) {
- fprintf( stderr, "Unable to initialize SDL: %s\n", SDL_GetError() );
- return false;
- }
-
-#ifdef ALCchar
- dev = alcOpenDevice( const_cast<ALCchar *>("sdl") );
+ fprintf( stderr, "Unable to initialize SDL: %s\n", SDL_GetError() );
+ return false;
+ }
+ if(g_tiki_init_flags & INIT_AUDIO_MASK) {
+#ifdef AL_LINUX
+ ALCdevice * dev = alcOpenDevice( (ALCchar *)("sdl") );
#else
- dev = alcOpenDevice( (ALCubyte *)("sdl") );
+ ALCdevice * dev = alcOpenDevice( (ALCubyte *)("sdl") );
#endif
- if ( dev == NULL ) {
+ if ( dev == NULL ) {
fprintf( stderr, "Unable to initialize OpenAL: %s\n", alGetString( alGetError() ) );
} else {
- context = alcCreateContext( dev, NULL );
+ ALCcontext *context = alcCreateContext( dev, NULL );
if ( context == NULL ) {
- fprintf( stderr, "alcCreateContext returned NULL: %s\n", alGetString( alGetError() ) );
- } else {
- alcMakeContextCurrent( context );
- alcProcessContext( context );
- Audio::Sound::initGlobal();
- Audio::Stream::initGlobal();
- }
+ fprintf( stderr, "alcCreateContext returned NULL: %s\n", alGetString( alGetError() ) );
+ } else {
+ alcMakeContextCurrent( context );
+ alcProcessContext( context );
+ }
}
- GL::Plxcompat::plx_mat3d_init( 640, 480 );
+ if(g_tiki_init_flags & INIT_AUDIO_SFX) {
+ Audio::Sound::initGlobal();
+ }
+ if(g_tiki_init_flags & INIT_AUDIO_STREAM) {
+ Audio::Stream::initGlobal();
+ }
+ }
+ if(g_tiki_init_flags & INIT_VIDEO_MASK) {
+ if ( SDL_SetVideoMode( 640, 480, 16, SDL_OPENGL ) == NULL ) {
+ fprintf( stderr, "Unable to Create OpenGL Window: %s\n", SDL_GetError() );
+ return false;
+ }
+
+ glEnable( GL_TEXTURE_2D );
+ glEnable( GL_BLEND );
+ glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
+ glShadeModel( GL_SMOOTH ); // Enable Smooth Shading
+ glClearColor( 0.0f, 0.0f, 0.0f, 0.0f ); // Black Background
+ glClearDepth( 1.0f ); // Depth Buffer Setup
+ glEnable( GL_DEPTH_TEST ); // Enables Depth Testing
+ glDepthFunc( GL_LEQUAL ); // The Type Of Depth Testing To Do
+
+ glHint( GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST ); // Really Nice Perspective Calculations
+ GL::Plxcompat::plx_mat3d_init( 640, 480 );
+ }
return Hid::init();
}
void shutdown() {
+ if(g_tiki_init_flags & INIT_AUDIO_SFX) {
+ Audio::Sound::shutdownGlobal();
+ }
+ if(g_tiki_init_flags & INIT_AUDIO_STREAM) {
+ Audio::Stream::shutdownGlobal();
+ }
Hid::shutdown();
}
Modified: tiki/sdl/src/platgl.cpp
===================================================================
--- tiki/sdl/src/platgl.cpp 2007-09-10 17:03:45 UTC (rev 510)
+++ tiki/sdl/src/platgl.cpp 2007-09-10 23:35:51 UTC (rev 511)
@@ -46,9 +46,9 @@
// Every so often we should reset the frame counters, to avoid
// having a super long term averaging effect.
if ( frameCnt >= 500 ) {
- firstFrame = 0;
- frameCnt = 0;
- }
+ firstFrame = 0;
+ frameCnt = 0;
+ }
// Update frame counters.
if ( !firstFrame )
@@ -57,9 +57,9 @@
totalFrameCnt++;
if ( lastFrame.tv_sec == 0 ) {
- gettimeofday( &lastFrame, NULL );
- return ;
- }
+ gettimeofday( &lastFrame, NULL );
+ return ;
+ }
struct timeval now;
gettimeofday( &now, NULL );
@@ -67,8 +67,8 @@
long long lastu = (( long long ) lastFrame.tv_sec ) * 1000 * 1000 + lastFrame.tv_usec;
long long diffu = nowu - lastu;
if ( diffu < ( 1000 * 1000 / targetFrameRate ) ) {
- usleep(( 1000 * 1000 / targetFrameRate ) - diffu );
- }
+ usleep(( 1000 * 1000 / targetFrameRate ) - diffu );
+ }
gettimeofday( &lastFrame, NULL );
}
Modified: tiki/sdl/src/plathid.cpp
===================================================================
--- tiki/sdl/src/plathid.cpp 2007-09-10 17:03:45 UTC (rev 510)
+++ tiki/sdl/src/plathid.cpp 2007-09-10 23:35:51 UTC (rev 511)
@@ -49,8 +49,8 @@
int abs_x, abs_y;
};
-static RefPtr<KbDevice> SDLkb;
-static RefPtr<MouseDevice> SDLMouse;
+static RefPtr<KbDevice> SDLkb = NULL;
+static RefPtr<MouseDevice> SDLMouse = NULL;
int HandleMouse( void *unused );
int HandleKeyboard( void *unused );
@@ -62,60 +62,51 @@
SDL_Thread *wm_thread;
bool Hid::platInit() {
- SDLkb = new KbDevice();
- SDLMouse = new MouseDevice();
- SDLMouse->setXY( 0, 0 );
-
- Event evtKB( Event::EvtAttach );
- evtKB.dev = SDLkb;
- sendEvent( evtKB );
-
- Event evtMouse( Event::EvtAttach );
- evtMouse.dev = SDLMouse;
- sendEvent( evtMouse );
-
- if ( SDL_SetVideoMode( 640, 480, 16, SDL_OPENGL ) == NULL ) {
- fprintf( stderr, "Unable to Create OpenGL Window: %s\n", SDL_GetError() );
- return false;
- }
-
- SDL_WarpMouse( 0, 0 );
-
char junk = '0';
- mouse_thread = SDL_CreateThread( HandleMouse, &junk );
- keybd_thread = SDL_CreateThread( HandleKeyboard, &junk );
- wm_thread = SDL_CreateThread( HandleWM, &junk );
+ if(g_tiki_init_flags & INIT_HID_KEYBOARD) {
+ Tiki::Debug::printf("Initializing Keyboard\n");
+ SDLkb = new KbDevice();
+ keybd_thread = SDL_CreateThread( HandleKeyboard, &junk );
- glEnable( GL_TEXTURE_2D );
- glEnable( GL_BLEND );
- glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
- glShadeModel( GL_SMOOTH ); // Enable Smooth Shading
- glClearColor( 0.0f, 0.0f, 0.0f, 0.0f ); // Black Background
- glClearDepth( 1.0f ); // Depth Buffer Setup
- glEnable( GL_DEPTH_TEST ); // Enables Depth Testing
- glDepthFunc( GL_LEQUAL ); // The Type Of Depth Testing To Do
+ Event evtKB( Event::EvtAttach );
+ evtKB.dev = SDLkb;
+ sendEvent( evtKB );
+ }
+ if(g_tiki_init_flags & INIT_HID_MOUSE) {
+ Tiki::Debug::printf("Initializing Mouse\n");
+ SDLMouse = new MouseDevice();
+ SDLMouse->setXY( 0, 0 );
+ mouse_thread = SDL_CreateThread( HandleMouse, &junk );
- glHint( GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST ); // Really Nice Perspective Calculations
+ Event evtMouse( Event::EvtAttach );
+ evtMouse.dev = SDLMouse;
+ sendEvent( evtMouse );
+ }
+ wm_thread = SDL_CreateThread( HandleWM, &junk );
return true;
}
void Hid::platShutdown() {
done = 1;
SDL_Delay( 20 );
- SDL_WaitThread( mouse_thread, NULL );
- SDL_WaitThread( keybd_thread, NULL );
+ if(g_tiki_init_flags & INIT_HID_MOUSE) {
+ Tiki::Debug::printf("Detaching Mouse\n");
+ SDL_WaitThread( mouse_thread, NULL );
+ Event evtMouse( Event::EvtDetach );
+ evtMouse.dev = SDLMouse;
+ sendEvent( evtMouse );
+ }
+ if(g_tiki_init_flags & INIT_HID_KEYBOARD) {
+ Tiki::Debug::printf("Detaching Keyboard\n");
+ SDL_WaitThread( keybd_thread, NULL );
+ Event evtKB( Event::EvtDetach );
+ evtKB.dev = SDLkb;
+ sendEvent( evtKB );
+ }
SDL_WaitThread( wm_thread, NULL );
- Event evtKB( Event::EvtDetach );
- evtKB.dev = SDLkb;
- sendEvent( evtKB );
-
- Event evtMouse( Event::EvtDetach );
- evtMouse.dev = SDLMouse;
- sendEvent( evtMouse );
-
SDL_Quit();
}
Added: tiki/src/base/init_flags_default.cpp
===================================================================
--- tiki/src/base/init_flags_default.cpp (rev 0)
+++ tiki/src/base/init_flags_default.cpp 2007-09-10 23:35:51 UTC (rev 511)
@@ -0,0 +1,12 @@
+/*
+ Tiki
+
+ init_flags_default.cpp
+
+ Copyright (C)2007 Atani Software
+*/
+
+#include "pch.h"
+#include "Tiki/tiki.h"
+
+TIKI_INIT_FLAGS(INIT_DEFAULT);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <at...@us...> - 2007-09-11 01:50:15
|
Revision: 512
http://cadcdev.svn.sourceforge.net/cadcdev/?rev=512&view=rev
Author: atani
Date: 2007-09-10 18:50:14 -0700 (Mon, 10 Sep 2007)
Log Message:
-----------
init flags support on win32
Modified Paths:
--------------
tiki/win32/src/init_shutdown.cpp
tiki/win32/src/platgl.cpp
tiki/win32/src/plathid.cpp
tiki/win32/tiki.vcproj
Property Changed:
----------------
tiki/examples/net/httpclient/resources/
Property changes on: tiki/examples/net/httpclient/resources
___________________________________________________________________
Name: svn:ignore
+ cookies.xml
Modified: tiki/win32/src/init_shutdown.cpp
===================================================================
--- tiki/win32/src/init_shutdown.cpp 2007-09-10 23:35:51 UTC (rev 511)
+++ tiki/win32/src/init_shutdown.cpp 2007-09-11 01:50:14 UTC (rev 512)
@@ -16,31 +16,41 @@
// Let us run with millisecond precision if possible.
timeBeginPeriod( 1 );
- ALCdevice *dev = NULL;
- ALCcontext *ctx = NULL;
+ if(g_tiki_init_flags & INIT_AUDIO_MASK) {
+ ALCdevice *dev = NULL;
+ ALCcontext *ctx = NULL;
- dev = alcOpenDevice( getenv( "OPENAL_DEVICE" ) ); // getenv()==NULL is okay.
- if ( dev != NULL ) {
- ctx = alcCreateContext( dev, 0 );
- if ( ctx != NULL ) {
- alcMakeContextCurrent( ctx );
- alcProcessContext( ctx );
+ dev = alcOpenDevice( getenv( "OPENAL_DEVICE" ) ); // getenv()==NULL is okay.
+ if ( dev != NULL ) {
+ ctx = alcCreateContext( dev, 0 );
+ if ( ctx != NULL ) {
+ alcMakeContextCurrent( ctx );
+ alcProcessContext( ctx );
+ } // if
} // if
- } // if
+ if(g_tiki_init_flags & INIT_AUDIO_SFX) {
+ Audio::Sound::initGlobal();
+ }
+ if(g_tiki_init_flags & INIT_AUDIO_STREAM) {
+ Audio::Stream::initGlobal();
+ }
+ }
- Audio::Stream::initGlobal();
- Audio::Sound::initGlobal();
-
- GL::Plxcompat::plx_mat3d_init( 640, 480 );
- Hid::init();
-
- return true;
+ if(g_tiki_init_flags & INIT_AUDIO_STREAM) {
+ GL::Plxcompat::plx_mat3d_init( 640, 480 );
+ }
+
+ return Hid::init();
}
void Tiki::shutdown() {
Hid::shutdown();
- Audio::Sound::shutdownGlobal();
- Audio::Stream::shutdownGlobal();
+ if(g_tiki_init_flags & INIT_AUDIO_STREAM) {
+ Audio::Stream::shutdownGlobal();
+ }
+ if(g_tiki_init_flags & INIT_AUDIO_SFX) {
+ Audio::Sound::shutdownGlobal();
+ }
timeEndPeriod( 1 );
}
Modified: tiki/win32/src/platgl.cpp
===================================================================
--- tiki/win32/src/platgl.cpp 2007-09-10 23:35:51 UTC (rev 511)
+++ tiki/win32/src/platgl.cpp 2007-09-11 01:50:14 UTC (rev 512)
@@ -107,15 +107,26 @@
m_hThread = CreateThread( NULL, 0, GameThread, lpCmdLine, 0, &m_dwThreadID );
- while ( m_hThread != NULL ) {
- do {
- if ( GetMessage( &msg, NULL, NULL, NULL ) ) {
- TranslateMessage( &msg );
- DispatchMessage( &msg );
- }
+ UINT min = WM_KEYFIRST, max = WM_MOUSELAST;
- } while ( ::PeekMessage( &msg, NULL, NULL, NULL, PM_REMOVE ) );
+ if(g_tiki_init_flags & INIT_HID_KEYBOARD &&
+ !(g_tiki_init_flags & INIT_HID_MOUSE)) {
+ max = WM_KEYLAST;
+ }
+ else if(g_tiki_init_flags & INIT_HID_MOUSE &&
+ !(g_tiki_init_flags & INIT_HID_KEYBOARD)) {
+ min = WM_MOUSEFIRST;
+ }
+ while ( m_hThread != NULL ) {
+ if ( ::PeekMessage( &msg, m_hWndMain, WM_NULL, WM_KEYFIRST - 1, PM_REMOVE ) ) {
+ TranslateMessage( &msg );
+ DispatchMessage( &msg );
+ }
+ else if ( ::PeekMessage( &msg, m_hWndMain, min, max, PM_REMOVE ) ) {
+ TranslateMessage( &msg );
+ DispatchMessage( &msg );
+ }
Sleep( 2 );
}
@@ -138,23 +149,22 @@
case WM_RBUTTONDOWN:
case WM_RBUTTONUP:
#if (_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400) //WM_MOUSEWHEEL requires Windows 98 or above
-
case WM_MOUSEWHEEL:
#endif
-
- Tiki::RecvEvent( iMsg, wParam, lParam );
- break;
+ Tiki::RecvEvent( iMsg, wParam, lParam );
+ break;
case WM_CLOSE:
- Tiki::RecvQuit();
- return 0;
- break;
+ case WM_QUIT:
+ Tiki::RecvQuit();
+ return 0;
+ break;
case WM_DESTROY:
- DestroyApplication();
- PostQuitMessage( 0 );
- break;
+ DestroyApplication();
+ PostQuitMessage( 0 );
+ break;
default:
- return DefWindowProc( hWnd, iMsg, wParam, lParam );
+ return DefWindowProc( hWnd, iMsg, wParam, lParam );
}
return 0L;
}
@@ -326,7 +336,6 @@
totalFrameCnt++;
#ifdef _DEBUG
-
if ( frameCnt && !( frameCnt % 250 ) ) {
Debug::printf( "frame %d, fps = %.2f\n", ( int ) frameCnt,
( double ) Tiki::GL::Frame::getFrameRate() );
Modified: tiki/win32/src/plathid.cpp
===================================================================
--- tiki/win32/src/plathid.cpp 2007-09-10 23:35:51 UTC (rev 511)
+++ tiki/win32/src/plathid.cpp 2007-09-11 01:50:14 UTC (rev 512)
@@ -28,17 +28,16 @@
}
};
-static RefPtr<KbDevice> win32kb;
-static RefPtr<MouseDevice> win32mouse;
+static RefPtr<KbDevice> win32kb = NULL;
+static RefPtr<MouseDevice> win32mouse = NULL;
bool Hid::platInit() {
win32kb = new KbDevice();
- win32mouse = new MouseDevice();
-
Event evt( Event::EvtAttach );
evt.dev = win32kb;
sendEvent( evt );
+ win32mouse = new MouseDevice();
evt.dev = win32mouse;
sendEvent( evt );
return true;
@@ -229,7 +228,6 @@
}
break;
#if (_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400) //WM_MOUSEWHEEL requires Windows 98 or above
-
case WM_MOUSEWHEEL: {
Event evt( Event::EvtBtnPress );
evt.dev = win32mouse;
Modified: tiki/win32/tiki.vcproj
===================================================================
--- tiki/win32/tiki.vcproj 2007-09-10 23:35:51 UTC (rev 511)
+++ tiki/win32/tiki.vcproj 2007-09-11 01:50:14 UTC (rev 512)
@@ -43,7 +43,7 @@
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""$(ProjectDir)\include";"$(ProjectDir)\..\include";"C:\Program Files\OpenAL 1.1 SDK\include";"$(ProjectDir)\..\3rdparty\libjpeg";"$(ProjectDir)\..\3rdparty\libogg\include";"$(ProjectDir)\..\3rdparty\libpng";"$(ProjectDir)\..\3rdparty\libvorbis\include";"$(ProjectDir)\..\3rdparty\zlib";"$(ProjectDir)\..\3rdparty\tinyxml""
- PreprocessorDefinitions="_WIN32_WINNT=0x0500;_CRT_SECURE_NO_WARNINGS=1"
+ PreprocessorDefinitions="_WIN32_WINNT=0x0500;_CRT_SECURE_NO_WARNINGS=1;_DEBUG=1"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
@@ -228,6 +228,10 @@
>
</File>
<File
+ RelativePath="..\src\base\init_flags_default.cpp"
+ >
+ </File>
+ <File
RelativePath="..\src\base\object.cpp"
>
</File>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <at...@us...> - 2007-09-11 17:57:58
|
Revision: 514
http://cadcdev.svn.sourceforge.net/cadcdev/?rev=514&view=rev
Author: atani
Date: 2007-09-11 10:57:54 -0700 (Tue, 11 Sep 2007)
Log Message:
-----------
change init flags to be TIKI_INIT_* to prevent conflicts with KOS
Modified Paths:
--------------
tiki/examples/net/chatd/src/ChatServer.cpp
tiki/examples/net/httpclient/src/HttpClient.cpp
tiki/include/Tiki/tiki.h
tiki/sdl/src/init_shutdown.cpp
tiki/sdl/src/plathid.cpp
tiki/src/base/init_flags_default.cpp
tiki/win32/src/init_shutdown.cpp
tiki/win32/src/platgl.cpp
Property Changed:
----------------
tiki/examples/TikiTest/
tiki/examples/console/TikiSnake/
Property changes on: tiki/examples/TikiTest
___________________________________________________________________
Name: svn:ignore
- Debug
Release
*.user
*.nds
*.ds.gba
+ Debug
Release
*.user
*.nds
*.ds.gba
*.elf
Property changes on: tiki/examples/console/TikiSnake
___________________________________________________________________
Name: svn:ignore
- Debug
Release
*.user
*.nds
*.ds.gba
+ Debug
Release
*.user
*.nds
*.ds.gba
*.elf
Modified: tiki/examples/net/chatd/src/ChatServer.cpp
===================================================================
--- tiki/examples/net/chatd/src/ChatServer.cpp 2007-09-11 16:37:50 UTC (rev 513)
+++ tiki/examples/net/chatd/src/ChatServer.cpp 2007-09-11 17:57:54 UTC (rev 514)
@@ -9,7 +9,7 @@
#include <Tiki/tiki.h>
#include <pch.h>
-TIKI_INIT_FLAGS(INIT_NONE);
+TIKI_INIT_FLAGS(TIKI_INIT_NOTHING);
#if TIKI_PLAT == TIKI_WIN32
#include <windows.h>
Modified: tiki/examples/net/httpclient/src/HttpClient.cpp
===================================================================
--- tiki/examples/net/httpclient/src/HttpClient.cpp 2007-09-11 16:37:50 UTC (rev 513)
+++ tiki/examples/net/httpclient/src/HttpClient.cpp 2007-09-11 17:57:54 UTC (rev 514)
@@ -9,6 +9,11 @@
#include <Tiki/tiki.h>
#include <pch.h>
+#if TIKI_PLAT == TIKI_DC
+extern uint8 romdisk[];
+KOS_INIT_ROMDISK(romdisk);
+#endif
+
#if TIKI_PLAT == TIKI_WIN32
#include <windows.h>
Modified: tiki/include/Tiki/tiki.h
===================================================================
--- tiki/include/Tiki/tiki.h 2007-09-11 16:37:50 UTC (rev 513)
+++ tiki/include/Tiki/tiki.h 2007-09-11 17:57:54 UTC (rev 514)
@@ -64,27 +64,27 @@
#define TIKI_INIT_FLAGS(flags) uint32 Tiki::g_tiki_init_flags = (flags);
typedef enum {
// HID options
- INIT_HID_KEYBOARD = 0x00000001,
- INIT_HID_MOUSE = 0x00000002,
- INIT_HID_JOYSTICK = 0x00000004,
- INIT_HID_DEFAULT = INIT_HID_KEYBOARD | INIT_HID_MOUSE | INIT_HID_JOYSTICK,
- INIT_HID_MASK = 0x000000FF,
+ TIKI_INIT_HID_KEYBOARD = 0x00000001,
+ TIKI_INIT_HID_MOUSE = 0x00000002,
+ TIKI_INIT_HID_JOYSTICK = 0x00000004,
+ TIKI_INIT_HID_DEFAULT = TIKI_INIT_HID_KEYBOARD | TIKI_INIT_HID_MOUSE | TIKI_INIT_HID_JOYSTICK,
+ TIKI_INIT_HID_MASK = 0x000000FF,
// Graphic related options
- INIT_VIDEO_WINDOWED = 0x00000100,
- INIT_VIDEO_FULLSCREEN = 0x00000200,
- INIT_VIDEO_CENTERED = 0x00000400,
- INIT_VIDEO_DEFAULT = INIT_VIDEO_WINDOWED | INIT_VIDEO_CENTERED,
- INIT_VIDEO_MASK = 0x0000FF00,
+ TIKI_INIT_VIDEO_WINDOWED = 0x00000100,
+ TIKI_INIT_VIDEO_FULLSCREEN = 0x00000200,
+ TIKI_INIT_VIDEO_CENTERED = 0x00000400,
+ TIKI_INIT_VIDEO_DEFAULT = TIKI_INIT_VIDEO_WINDOWED | TIKI_INIT_VIDEO_CENTERED,
+ TIKI_INIT_VIDEO_MASK = 0x0000FF00,
// Audio related options
- INIT_AUDIO_STREAM = 0x00010000,
- INIT_AUDIO_SFX = 0x00020000,
- INIT_AUDIO_DEFAULT = INIT_AUDIO_STREAM | INIT_AUDIO_SFX,
- INIT_AUDIO_MASK = 0x00FF0000,
+ TIKI_INIT_AUDIO_STREAM = 0x00010000,
+ TIKI_INIT_AUDIO_SFX = 0x00020000,
+ TIKI_INIT_AUDIO_DEFAULT = TIKI_INIT_AUDIO_STREAM | TIKI_INIT_AUDIO_SFX,
+ TIKI_INIT_AUDIO_MASK = 0x00FF0000,
- INIT_NONE = 0x00000000,
- INIT_DEFAULT = INIT_HID_DEFAULT | INIT_VIDEO_DEFAULT | INIT_AUDIO_DEFAULT,
+ TIKI_INIT_NOTHING = 0x00000000,
+ TIKI_INIT_DEFAULTS = TIKI_INIT_HID_DEFAULT | TIKI_INIT_VIDEO_DEFAULT | TIKI_INIT_AUDIO_DEFAULT,
} TIKI_INIT_FLAGS_ENUM;
}
Modified: tiki/sdl/src/init_shutdown.cpp
===================================================================
--- tiki/sdl/src/init_shutdown.cpp 2007-09-11 16:37:50 UTC (rev 513)
+++ tiki/sdl/src/init_shutdown.cpp 2007-09-11 17:57:54 UTC (rev 514)
@@ -23,7 +23,7 @@
fprintf( stderr, "Unable to initialize SDL: %s\n", SDL_GetError() );
return false;
}
- if(g_tiki_init_flags & INIT_AUDIO_MASK) {
+ if(g_tiki_init_flags & TIKI_INIT_AUDIO_MASK) {
// OpenAL team doesnt seem to increment version numbers when they make signature changes
// use the header ifdef/endif flag to figure out version since this seems to have changed
// between the compatible versions
@@ -43,14 +43,14 @@
alcProcessContext( context );
}
}
- if(g_tiki_init_flags & INIT_AUDIO_SFX) {
+ if(g_tiki_init_flags & TIKI_INIT_AUDIO_SFX) {
Audio::Sound::initGlobal();
}
- if(g_tiki_init_flags & INIT_AUDIO_STREAM) {
+ if(g_tiki_init_flags & TIKI_INIT_AUDIO_STREAM) {
Audio::Stream::initGlobal();
}
}
- if(g_tiki_init_flags & INIT_VIDEO_MASK) {
+ if(g_tiki_init_flags & TIKI_INIT_VIDEO_MASK) {
if ( SDL_SetVideoMode( 640, 480, 16, SDL_OPENGL ) == NULL ) {
fprintf( stderr, "Unable to Create OpenGL Window: %s\n", SDL_GetError() );
return false;
@@ -72,10 +72,10 @@
}
void shutdown() {
- if(g_tiki_init_flags & INIT_AUDIO_SFX) {
+ if(g_tiki_init_flags & TIKI_INIT_AUDIO_SFX) {
Audio::Sound::shutdownGlobal();
}
- if(g_tiki_init_flags & INIT_AUDIO_STREAM) {
+ if(g_tiki_init_flags & TIKI_INIT_AUDIO_STREAM) {
Audio::Stream::shutdownGlobal();
}
Hid::shutdown();
Modified: tiki/sdl/src/plathid.cpp
===================================================================
--- tiki/sdl/src/plathid.cpp 2007-09-11 16:37:50 UTC (rev 513)
+++ tiki/sdl/src/plathid.cpp 2007-09-11 17:57:54 UTC (rev 514)
@@ -64,7 +64,7 @@
bool Hid::platInit() {
char junk = '0';
- if(g_tiki_init_flags & INIT_HID_KEYBOARD) {
+ if(g_tiki_init_flags & TIKI_INIT_HID_KEYBOARD) {
Tiki::Debug::printf("Initializing Keyboard\n");
SDLkb = new KbDevice();
keybd_thread = SDL_CreateThread( HandleKeyboard, &junk );
@@ -73,7 +73,7 @@
evtKB.dev = SDLkb;
sendEvent( evtKB );
}
- if(g_tiki_init_flags & INIT_HID_MOUSE) {
+ if(g_tiki_init_flags & TIKI_INIT_HID_MOUSE) {
Tiki::Debug::printf("Initializing Mouse\n");
SDLMouse = new MouseDevice();
SDLMouse->setXY( 0, 0 );
@@ -91,14 +91,14 @@
void Hid::platShutdown() {
done = 1;
SDL_Delay( 20 );
- if(g_tiki_init_flags & INIT_HID_MOUSE) {
+ if(g_tiki_init_flags & TIKI_INIT_HID_MOUSE) {
Tiki::Debug::printf("Detaching Mouse\n");
SDL_WaitThread( mouse_thread, NULL );
Event evtMouse( Event::EvtDetach );
evtMouse.dev = SDLMouse;
sendEvent( evtMouse );
}
- if(g_tiki_init_flags & INIT_HID_KEYBOARD) {
+ if(g_tiki_init_flags & TIKI_INIT_HID_KEYBOARD) {
Tiki::Debug::printf("Detaching Keyboard\n");
SDL_WaitThread( keybd_thread, NULL );
Event evtKB( Event::EvtDetach );
Modified: tiki/src/base/init_flags_default.cpp
===================================================================
--- tiki/src/base/init_flags_default.cpp 2007-09-11 16:37:50 UTC (rev 513)
+++ tiki/src/base/init_flags_default.cpp 2007-09-11 17:57:54 UTC (rev 514)
@@ -9,4 +9,4 @@
#include "pch.h"
#include "Tiki/tiki.h"
-TIKI_INIT_FLAGS(INIT_DEFAULT);
+TIKI_INIT_FLAGS(TIKI_INIT_DEFAULTS);
Modified: tiki/win32/src/init_shutdown.cpp
===================================================================
--- tiki/win32/src/init_shutdown.cpp 2007-09-11 16:37:50 UTC (rev 513)
+++ tiki/win32/src/init_shutdown.cpp 2007-09-11 17:57:54 UTC (rev 514)
@@ -16,7 +16,7 @@
// Let us run with millisecond precision if possible.
timeBeginPeriod( 1 );
- if(g_tiki_init_flags & INIT_AUDIO_MASK) {
+ if(g_tiki_init_flags & TIKI_INIT_AUDIO_MASK) {
ALCdevice *dev = NULL;
ALCcontext *ctx = NULL;
@@ -28,15 +28,15 @@
alcProcessContext( ctx );
} // if
} // if
- if(g_tiki_init_flags & INIT_AUDIO_SFX) {
+ if(g_tiki_init_flags & TIKI_INIT_AUDIO_SFX) {
Audio::Sound::initGlobal();
}
- if(g_tiki_init_flags & INIT_AUDIO_STREAM) {
+ if(g_tiki_init_flags & TIKI_INIT_AUDIO_STREAM) {
Audio::Stream::initGlobal();
}
}
- if(g_tiki_init_flags & INIT_AUDIO_STREAM) {
+ if(g_tiki_init_flags & TIKI_INIT_VIDEO_MASK) {
GL::Plxcompat::plx_mat3d_init( 640, 480 );
}
@@ -45,10 +45,10 @@
void Tiki::shutdown() {
Hid::shutdown();
- if(g_tiki_init_flags & INIT_AUDIO_STREAM) {
+ if(g_tiki_init_flags & TIKI_INIT_AUDIO_STREAM) {
Audio::Stream::shutdownGlobal();
}
- if(g_tiki_init_flags & INIT_AUDIO_SFX) {
+ if(g_tiki_init_flags & TIKI_INIT_AUDIO_SFX) {
Audio::Sound::shutdownGlobal();
}
Modified: tiki/win32/src/platgl.cpp
===================================================================
--- tiki/win32/src/platgl.cpp 2007-09-11 16:37:50 UTC (rev 513)
+++ tiki/win32/src/platgl.cpp 2007-09-11 17:57:54 UTC (rev 514)
@@ -109,12 +109,12 @@
UINT min = WM_KEYFIRST, max = WM_MOUSELAST;
- if(g_tiki_init_flags & INIT_HID_KEYBOARD &&
- !(g_tiki_init_flags & INIT_HID_MOUSE)) {
+ if(g_tiki_init_flags & TIKI_INIT_HID_KEYBOARD &&
+ !(g_tiki_init_flags & TIKI_INIT_HID_MOUSE)) {
max = WM_KEYLAST;
}
- else if(g_tiki_init_flags & INIT_HID_MOUSE &&
- !(g_tiki_init_flags & INIT_HID_KEYBOARD)) {
+ else if(g_tiki_init_flags & TIKI_INIT_HID_MOUSE &&
+ !(g_tiki_init_flags & TIKI_INIT_HID_KEYBOARD)) {
min = WM_MOUSEFIRST;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <at...@us...> - 2007-10-25 23:42:46
|
Revision: 515
http://cadcdev.svn.sourceforge.net/cadcdev/?rev=515&view=rev
Author: atani
Date: 2007-10-25 16:42:44 -0700 (Thu, 25 Oct 2007)
Log Message:
-----------
misc updates for DS functionality
Modified Paths:
--------------
tiki/examples/Makefile
tiki/examples/TikiTest/tikitest.cbp
tiki/examples/net/basic/src/main.cpp
tiki/examples/net/chat/src/main.cpp
tiki/examples/net/chatd/src/main.cpp
tiki/examples/net/httpclient/src/main.cpp
tiki/nds/src/init_shutdown.cpp
tiki/nds/src/platgl.cpp
tiki/nds/tiki.cbp
tiki/nds/tikiarm7/source/arm7main.c
tiki/nds/tikiarm7/source/sound7.c
tiki/sdl/src/platgl.cpp
tiki/src/gl/gl.cpp
tiki/src/gl/texture.cpp
Added Paths:
-----------
tiki/examples/nehe/
tiki/examples/nehe/Makefile
tiki/examples/nehe/lesson01/
tiki/examples/nehe/lesson01/Makefile
tiki/examples/nehe/lesson01/src/
tiki/examples/nehe/lesson01/src/main.cpp
tiki/examples/nehe/lesson02/
tiki/examples/nehe/lesson02/Makefile
tiki/examples/nehe/lesson02/src/
tiki/examples/nehe/lesson02/src/main.cpp
Modified: tiki/examples/Makefile
===================================================================
--- tiki/examples/Makefile 2007-09-11 17:57:54 UTC (rev 514)
+++ tiki/examples/Makefile 2007-10-25 23:42:44 UTC (rev 515)
@@ -1,5 +1,5 @@
-SUBDIRS = TikiTest console net
+SUBDIRS = TikiTest console net nehe
TIKI_DIR ?= $(CURDIR)/../
include $(TIKI_DIR)$(TIKI_PLAT)/Makefile.rules
Modified: tiki/examples/TikiTest/tikitest.cbp
===================================================================
--- tiki/examples/TikiTest/tikitest.cbp 2007-09-11 17:57:54 UTC (rev 514)
+++ tiki/examples/TikiTest/tikitest.cbp 2007-10-25 23:42:44 UTC (rev 515)
@@ -1,57 +1,42 @@
-<?xml version="1.0"?>
-<!DOCTYPE CodeBlocks_project_file>
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
- <FileVersion major="1" minor="1"/>
+ <FileVersion major="1" minor="6" />
<Project>
- <Option title="TikiTest"/>
- <Option makefile="Makefile"/>
- <Option makefile_is_custom="0"/>
- <Option compiler="0"/>
+ <Option title="TikiTest" />
+ <Option pch_mode="0" />
+ <Option compiler="gcc" />
<Build>
<Target title="default">
- <Option output="C:\projects\tiki\examples\TikiTest\tikitest.exe"/>
- <Option working_dir="."/>
- <Option object_output=".objs"/>
- <Option deps_output=".deps"/>
- <Option type="0"/>
- <Option compiler="0"/>
- <Option projectResourceIncludeDirsRelation="0"/>
+ <Option output="C:/projects/tiki/examples/TikiTest/tikitest.exe" prefix_auto="0" extension_auto="0" />
+ <Option type="0" />
+ <Option compiler="gcc" />
+ <Option projectResourceIncludeDirsRelation="0" />
</Target>
</Build>
+ <VirtualTargets>
+ <Add alias="All" targets="default;" />
+ </VirtualTargets>
<Compiler>
- <Add directory="..\..\include"/>
- <Add directory="..\..\win32\include"/>
+ <Add directory="../../include" />
+ <Add directory="../../win32/include" />
</Compiler>
<Linker>
- <Add library="gdi32"/>
- <Add library="user32"/>
- <Add library="kernel32"/>
- <Add library="tiki"/>
- <Add library="opengl32"/>
- <Add library="alut"/>
- <Add directory="..\..\win32"/>
- <Add directory="C:\Program Files\OpenAL 1.1 SDK\libs\Win32"/>
+ <Add library="gdi32" />
+ <Add library="user32" />
+ <Add library="kernel32" />
+ <Add library="tiki" />
+ <Add library="opengl32" />
+ <Add library="alut" />
+ <Add directory="../../win32" />
+ <Add directory="C:/Program Files/OpenAL 1.1 SDK/libs/Win32" />
</Linker>
- <Unit filename="src\TikiTest.cpp">
- <Option compilerVar="CPP"/>
- <Option objectName="TikiTest.obj"/>
- <Option target="default"/>
- </Unit>
- <Unit filename="src\test.cpp">
- <Option compilerVar="CPP"/>
- <Option objectName="test.obj"/>
- <Option target="default"/>
- </Unit>
- <Unit filename="src\testobj.cpp">
- <Option compilerVar="CPP"/>
- <Option objectName="testobj.obj"/>
- <Option target="default"/>
- </Unit>
- <Unit filename="src\testobj.h">
- <Option compilerVar=""/>
- <Option compile="0"/>
- <Option link="0"/>
- <Option target="default"/>
- </Unit>
+ <Unit filename="src/TikiTest.cpp" />
+ <Unit filename="src/test.cpp" />
+ <Unit filename="src/testobj.cpp" />
+ <Unit filename="src/testobj.h" />
+ <Extensions>
+ <code_completion />
+ <debugger />
+ </Extensions>
</Project>
</CodeBlocks_project_file>
Added: tiki/examples/nehe/Makefile
===================================================================
--- tiki/examples/nehe/Makefile (rev 0)
+++ tiki/examples/nehe/Makefile 2007-10-25 23:42:44 UTC (rev 515)
@@ -0,0 +1,8 @@
+
+SUBDIRS = lesson01 lesson02
+
+TIKI_DIR ?= $(CURDIR)/../../
+include $(TIKI_DIR)$(TIKI_PLAT)/Makefile.rules
+
+all: subdirs
+clean: clean_subdirs
Added: tiki/examples/nehe/lesson01/Makefile
===================================================================
--- tiki/examples/nehe/lesson01/Makefile (rev 0)
+++ tiki/examples/nehe/lesson01/Makefile 2007-10-25 23:42:44 UTC (rev 515)
@@ -0,0 +1,27 @@
+
+
+CFLAGS=-I$(TIKI_DIR)$(TIKI_PLAT)/include -I$(TIKI_DIR)include
+OBJS = $(patsubst %.cpp,%.o,$(wildcard src/*.cpp))
+
+ifeq ($(TIKI_PLAT),nds)
+NDS_CART_CODE ?= NH01
+NDS_CART_ID ?= NH
+NDS_CART_NAME ?= NeHe01
+NDS_CART_VERSION ?= 1
+endif
+
+all: nehe_lesson01
+nehe_lesson01: $(OBJS)
+ $(build_romdisk)
+ $(CXX) $(LDFLAGS) -L$(TIKI_DIR)$(TIKI_PLAT) -L$(TIKI_DIR)$(TIKI_PLAT)/lib $(OBJS) $(TIKI_BASE_LIBS) -o nehe_lesson01$(PLATFORM_BINARY_EXT) $(ROMDISK_OBJ)
+ $(post_build)
+
+clean:
+ -rm -f $(OBJS) nehe_lesson01$(PLATFORM_BINARY_EXT) $(ROMDISK_OBJ)
+ifeq ($(TIKI_PLAT),nds)
+ -rm -f nehe_lesson01.nds nehe_lesson01.ds.gba
+endif
+
+TIKI_DIR ?= $(CURDIR)/../../../
+DEPSDIR=$(CURDIR)
+include $(TIKI_DIR)$(TIKI_PLAT)/Makefile.rules
Property changes on: tiki/examples/nehe/lesson01/Makefile
___________________________________________________________________
Name: svn:executable
+ *
Added: tiki/examples/nehe/lesson01/src/main.cpp
===================================================================
--- tiki/examples/nehe/lesson01/src/main.cpp (rev 0)
+++ tiki/examples/nehe/lesson01/src/main.cpp 2007-10-25 23:42:44 UTC (rev 515)
@@ -0,0 +1,46 @@
+/****************************************
+ * NDS NeHe Lesson 01 *
+ * Author: Dovoto *
+ ****************************************/
+
+#include <Tiki/tiki.h>
+#include <Tiki/gl.h>
+
+using namespace Tiki;
+using namespace Tiki::GL;
+
+void DrawGLScene();
+
+int main(int argc, char *argv[])
+{
+ Tiki::init(argc, argv);
+
+ while (1)
+ {
+ Frame::begin();
+
+ // Set the current matrix to be the model matrix
+ glMatrixMode(GL_MODELVIEW);
+
+ // Set the color..not in nehe source...ds gl default will be black
+ glColor3f(1, 1, 1);
+
+ //Push our original Matrix onto the stack (save state)
+ //glPushMatrix();
+
+ DrawGLScene();
+
+ // Pop our Matrix from the stack (restore state)
+ //glPopMatrix();
+
+ Frame::finish();
+ }
+
+ return 0;
+}
+
+void DrawGLScene(void)
+{
+ //this is where the magic happens
+ glLoadIdentity();
+}
Added: tiki/examples/nehe/lesson02/Makefile
===================================================================
--- tiki/examples/nehe/lesson02/Makefile (rev 0)
+++ tiki/examples/nehe/lesson02/Makefile 2007-10-25 23:42:44 UTC (rev 515)
@@ -0,0 +1,27 @@
+
+
+CFLAGS=-I$(TIKI_DIR)$(TIKI_PLAT)/include -I$(TIKI_DIR)include
+OBJS = $(patsubst %.cpp,%.o,$(wildcard src/*.cpp))
+
+ifeq ($(TIKI_PLAT),nds)
+NDS_CART_CODE ?= NH02
+NDS_CART_ID ?= NH
+NDS_CART_NAME ?= NeHe02
+NDS_CART_VERSION ?= 1
+endif
+
+all: nehe_lesson02
+nehe_lesson02: $(OBJS)
+ $(build_romdisk)
+ $(CXX) $(LDFLAGS) -L$(TIKI_DIR)$(TIKI_PLAT) -L$(TIKI_DIR)$(TIKI_PLAT)/lib $(OBJS) $(TIKI_BASE_LIBS) -o nehe_lesson02$(PLATFORM_BINARY_EXT) $(ROMDISK_OBJ)
+ $(post_build)
+
+clean:
+ -rm -f $(OBJS) nehe_lesson02$(PLATFORM_BINARY_EXT) $(ROMDISK_OBJ)
+ifeq ($(TIKI_PLAT),nds)
+ -rm -f nehe_lesson02.nds nehe_lesson02.ds.gba
+endif
+
+TIKI_DIR ?= $(CURDIR)/../../../
+DEPSDIR=$(CURDIR)
+include $(TIKI_DIR)$(TIKI_PLAT)/Makefile.rules
Property changes on: tiki/examples/nehe/lesson02/Makefile
___________________________________________________________________
Name: svn:executable
+ *
Added: tiki/examples/nehe/lesson02/src/main.cpp
===================================================================
--- tiki/examples/nehe/lesson02/src/main.cpp (rev 0)
+++ tiki/examples/nehe/lesson02/src/main.cpp 2007-10-25 23:42:44 UTC (rev 515)
@@ -0,0 +1,59 @@
+/****************************************
+ * NDS NeHe Lesson 02 *
+ * Author: Dovoto *
+ ****************************************/
+
+#include <Tiki/tiki.h>
+#include <Tiki/gl.h>
+
+using namespace Tiki;
+using namespace Tiki::GL;
+
+void DrawGLScene();
+
+int main(int argc, char *argv[])
+{
+ Tiki::init(argc, argv);
+
+ while (1)
+ {
+
+ Frame::begin();
+ Frame::set3d();
+
+ // Set the current matrix to be the model matrix
+ glMatrixMode(GL_MODELVIEW);
+
+ //Push our original Matrix onto the stack (save state)
+ //glPushMatrix();
+
+ DrawGLScene();
+
+ // Pop our Matrix from the stack (restore state)
+ //glPopMatrix();
+
+ Frame::finish();
+
+ }
+
+ return 0;
+}
+
+void DrawGLScene() // Here's Where We Do All The Drawing
+{
+
+ glLoadIdentity(); // Reset The Current Modelview Matrix
+ glTranslatef(-1.5f,0.0f,-6.0f); // Move Left 1.5 Units And Into The Screen 6.0
+ glBegin(GL_TRIANGLES); // Drawing Using Triangles
+ glVertex3f( 0.0f, 1.0f, 0.0f); // Top
+ glVertex3f(-1.0f,-1.0f, 0.0f); // Bottom Left
+ glVertex3f( 1.0f,-1.0f, 0.0f); // Bottom Right
+ glEnd(); // Finished Drawing The Triangle
+ glTranslatef(3.0f,0.0f,0.0f); // Move Right 3 Units
+ glBegin(GL_QUADS); // Draw A Quad
+ glVertex3f(-1.0f, 1.0f, 0.0f); // Top Left
+ glVertex3f( 1.0f, 1.0f, 0.0f); // Top Right
+ glVertex3f( 1.0f,-1.0f, 0.0f); // Bottom Right
+ glVertex3f(-1.0f,-1.0f, 0.0f); // Bottom Left
+ glEnd(); // Done Drawing The Quad
+}
Modified: tiki/examples/net/basic/src/main.cpp
===================================================================
--- tiki/examples/net/basic/src/main.cpp 2007-09-11 17:57:54 UTC (rev 514)
+++ tiki/examples/net/basic/src/main.cpp 2007-10-25 23:42:44 UTC (rev 515)
@@ -21,6 +21,8 @@
Tiki::Net::init();
+ Tiki::Net::connect();
+
RefPtr<Address> address = new Address();
address->setHostName("www.example.com");
address->setPort(80);
@@ -50,6 +52,8 @@
socket->close();
+ Tiki::Net::disconnect();
+
Tiki::Net::shutdown();
return 0;
}
Modified: tiki/examples/net/chat/src/main.cpp
===================================================================
--- tiki/examples/net/chat/src/main.cpp 2007-09-11 17:57:54 UTC (rev 514)
+++ tiki/examples/net/chat/src/main.cpp 2007-10-25 23:42:44 UTC (rev 515)
@@ -40,6 +40,7 @@
extern "C" int tiki_main( int argc, char **argv) {
Tiki::init(argc, argv);
Tiki::Net::init();
+ Tiki::Net::connect();
Hid::callbackReg( tkCallback, NULL );
RefPtr<Address> remote = new Address();
@@ -59,6 +60,7 @@
}
g_remoteconn->close();
+ Tiki::Net::disconnect();
Tiki::Net::shutdown();
return 0;
Modified: tiki/examples/net/chatd/src/main.cpp
===================================================================
--- tiki/examples/net/chatd/src/main.cpp 2007-09-11 17:57:54 UTC (rev 514)
+++ tiki/examples/net/chatd/src/main.cpp 2007-10-25 23:42:44 UTC (rev 515)
@@ -114,6 +114,7 @@
Tiki::Net::init();
Hid::callbackReg( tkCallback, NULL );
+ Tiki::Net::connect();
loadCommandHandlers();
@@ -148,6 +149,7 @@
}
}
+ Tiki::Net::disconnect();
Tiki::Net::shutdown();
return 0;
}
Modified: tiki/examples/net/httpclient/src/main.cpp
===================================================================
--- tiki/examples/net/httpclient/src/main.cpp 2007-09-11 17:57:54 UTC (rev 514)
+++ tiki/examples/net/httpclient/src/main.cpp 2007-10-25 23:42:44 UTC (rev 515)
@@ -37,6 +37,8 @@
Tiki::Net::init();
Hid::callbackReg( tkCallback, NULL );
+ Tiki::Net::connect();
+
HttpUserAgent *useragent = new HttpUserAgent();
useragent->setCookieJar(new CookieJar());
useragent->setIgnoreCookies(false);
@@ -46,7 +48,6 @@
Request *request = new Request();
request->setUrl("http://www.google.com/");
-
#if TIKI_PLAT == TIKI_DC
RefPtr<Texture> cf = new Texture("/rd/pc-ascii.png", true);
@@ -66,7 +67,7 @@
console->printf("Sending request: %s\n", request->getUrl().c_str());
Response *response = useragent->get(request);
-
+
console->printf("response code: %d\n", response->getResultCode());
std::list<Cookie *> cookies = useragent->getCookieJar()->getCookies();
for(std::list<Cookie *>::iterator iter = cookies.begin();
@@ -109,6 +110,8 @@
delete request;
delete useragent;
+ Tiki::Net::disconnect();
+
Tiki::Net::shutdown();
Tiki::shutdown();
Modified: tiki/nds/src/init_shutdown.cpp
===================================================================
--- tiki/nds/src/init_shutdown.cpp 2007-09-11 17:57:54 UTC (rev 514)
+++ tiki/nds/src/init_shutdown.cpp 2007-10-25 23:42:44 UTC (rev 515)
@@ -38,21 +38,51 @@
// Setup the Main screen for 3D
videoSetMode( MODE_0_3D );
- vramSetBankA( VRAM_A_TEXTURE );
+
+ //vramSetBankA( VRAM_A_TEXTURE );
Tiki::Debug::printf("Enabling IRQs\n");
// IRQ basic setup
- irqInit();
+ irqInit();
+ irqSet(IRQ_VBLANK, 0);
Tiki::Debug::printf("Enabling GL\n");
// initialize the geometry engine
glInit();
- glEnable(GL_TEXTURE_2D);
+ glEnable(GL_TEXTURE_2D);
+
+ // Set our viewport to be the same size as the screen
+ glViewport(0,0,255,191);
+
+ // enable antialiasing
+ glEnable(GL_ANTIALIAS);
+ glClearColor(0,0,0,31); // BG must be opaque for AA to work
+ glClearPolyID(63); // BG must have a unique polygon ID for AA to work
+ glClearDepth( 0x7FFFF );
+
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ gluPerspective(70, 256.0 / 192.0, 0.1, 100);
+ glMatrixMode(GL_MODELVIEW);
+
+ //need to set up some material properties since DS does not have them set by default
+ glMaterialf(GL_AMBIENT, RGB15(16,16,16));
+ glMaterialf(GL_DIFFUSE, RGB15(16,16,16));
+ glMaterialf(GL_SPECULAR, BIT(15) | RGB15(8,8,8));
+ glMaterialf(GL_EMISSION, RGB15(16,16,16));
+
+ //ds uses a table for shinyness..this generates a half-ass one
+ glMaterialShinyness();
+
+ glPolyFmt(POLY_ALPHA(31) | POLY_CULL_NONE );
+
+ // set a default color.
+ glColor3f(1, 1, 1);
- //Tiki::Debug::printf("Enabling libFAT\n");
+ Tiki::Debug::printf("Enabling libFAT\n");
// initialize libfat
- //fatInitDefault();
+ fatInitDefault();
// initialize parallax
GL::Plxcompat::plx_mat3d_init( 256, 192 );
Modified: tiki/nds/src/platgl.cpp
===================================================================
--- tiki/nds/src/platgl.cpp 2007-09-11 17:57:54 UTC (rev 514)
+++ tiki/nds/src/platgl.cpp 2007-10-25 23:42:44 UTC (rev 515)
@@ -14,28 +14,54 @@
#include <unistd.h>
#include <sys/time.h>
+
+static uint64 lastFrame = 0;
+static uint64 firstFrame = 0;
+static uint64 frameCnt = 0, totalFrameCnt = 0;
+
namespace Tiki {
namespace GL {
namespace Frame {
+
float getFrameRate() {
- return 0.0f;
+ uint64 cur = Tiki::Time::gettime();
+
+ // Avoid divzero
+ if ( cur == firstFrame )
+ return 0.0f;
+
+ return ( float ) ( ( frameCnt * 1000000.0 ) / ( cur - firstFrame ) );
}
-void setFrameRateLimit( int rate ) {}
+void setFrameRateLimit( int rate ) {
+}
}
extern "C" {
-
void tiki_wait_if_needed() {}
- void tiki_scene_begin_hook() {}
+ void tiki_scene_begin_hook() {
+ if ( frameCnt >= 500 ) {
+ firstFrame = 0;
+ frameCnt = 0;
+ }
+ // Update frame counters.
+ if ( !firstFrame )
+ firstFrame = Tiki::Time::gettime();
+ frameCnt++;
+ totalFrameCnt++;
+ if ( frameCnt && !( frameCnt % 250 ) ) {
+ Debug::printf( "frame %d, fps = %.2f\n", ( int ) frameCnt,
+ ( double ) Tiki::GL::Frame::getFrameRate() );
+ }
+ }
+
void tiki_scene_finish_hook() {
glFlush( 0 );
- //swiWaitForVBlank();
- Tiki::Debug::printf("Frame::finish()\n");
+ swiWaitForVBlank();
}
void tiki_scene_begin_opaque_hook() {}
Modified: tiki/nds/tiki.cbp
===================================================================
--- tiki/nds/tiki.cbp 2007-09-11 17:57:54 UTC (rev 514)
+++ tiki/nds/tiki.cbp 2007-10-25 23:42:44 UTC (rev 515)
@@ -1,1537 +1,544 @@
-<?xml version="1.0"?>
-<!DOCTYPE CodeBlocks_project_file>
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
- <FileVersion major="1" minor="1"/>
+ <FileVersion major="1" minor="6" />
<Project>
- <Option title="Tiki"/>
- <Option makefile="Makefile"/>
- <Option makefile_is_custom="1"/>
- <Option compiler="0"/>
+ <Option title="Tiki" />
+ <Option makefile_is_custom="1" />
+ <Option pch_mode="0" />
+ <Option compiler="gcc" />
<Build>
<Target title="default">
- <Option output="libtiki.a"/>
- <Option working_dir=""/>
- <Option object_output=".objs"/>
- <Option deps_output=".deps"/>
- <Option type="2"/>
- <Option compiler="6"/>
- <Option projectResourceIncludeDirsRelation="2"/>
+ <Option output="libtiki.a" prefix_auto="0" extension_auto="0" />
+ <Option working_dir="" />
+ <Option type="2" />
+ <Option compiler="ppcgcc" />
+ <Option projectResourceIncludeDirsRelation="2" />
</Target>
</Build>
+ <VirtualTargets>
+ <Add alias="All" targets="default;" />
+ </VirtualTargets>
<Compiler>
- <Add option="-O2"/>
- <Add option="-MMD -MP -MF -march=armv5te -mtune=arm946e-s -fomit-frame-pointer -ffast-math -mthumb -mthumb-interwork -fno-rtti"/>
- <Add option="-DARM9"/>
- <Add directory="..\3rdparty\libjpeg"/>
- <Add directory="..\3rdparty\libogg\include"/>
- <Add directory="..\3rdparty\libogg\src"/>
- <Add directory="..\3rdparty\libpng"/>
- <Add directory="..\3rdparty\libvorbis\include"/>
- <Add directory="..\3rdparty\libvorbis\lib"/>
- <Add directory="..\3rdparty\tinyxml"/>
- <Add directory="..\3rdparty\zlib"/>
- <Add directory="..\include"/>
- <Add directory="include"/>
+ <Add option="-O2" />
+ <Add option="-MMD -MP -MF -march=armv5te -mtune=arm946e-s -fomit-frame-pointer -ffast-math -mthumb -mthumb-interwork -fno-rtti" />
+ <Add option="-DARM9" />
+ <Add directory="../3rdparty/libjpeg" />
+ <Add directory="../3rdparty/libogg/include" />
+ <Add directory="../3rdparty/libogg/src" />
+ <Add directory="../3rdparty/libpng" />
+ <Add directory="../3rdparty/libvorbis/include" />
+ <Add directory="../3rdparty/libvorbis/lib" />
+ <Add directory="../3rdparty/tinyxml" />
+ <Add directory="../3rdparty/zlib" />
+ <Add directory="../include" />
+ <Add directory="include" />
</Compiler>
- <Unit filename="..\3rdparty\libjpeg\jcapimin.c">
- <Option compilerVar="CC"/>
- <Option target="default"/>
+ <Unit filename="../3rdparty/libjpeg/jcapimin.c">
+ <Option compilerVar="CC" />
</Unit>
- <Unit filename="..\3rdparty\libjpeg\jcapistd.c">
- <Option compilerVar="CC"/>
- <Option target="default"/>
+ <Unit filename="../3rdparty/libjpeg/jcapistd.c">
+ <Option compilerVar="CC" />
</Unit>
- <Unit filename="..\3rdparty\libjpeg\jccoefct.c">
- <Option compilerVar="CC"/>
- <Option target="default"/>
+ <Unit filename="../3rdparty/libjpeg/jccoefct.c">
+ <Option compilerVar="CC" />
</Unit>
- <Unit filename="..\3rdparty\libjpeg\jccolor.c">
- <Option compilerVar="CC"/>
- <Option target="default"/>
+ <Unit filename="../3rdparty/libjpeg/jccolor.c">
+ <Option compilerVar="CC" />
</Unit>
- <Unit filename="..\3rdparty\libjpeg\jcdctmgr.c">
- <Option compilerVar="CC"/>
- <Option target="default"/>
+ <Unit filename="../3rdparty/libjpeg/jcdctmgr.c">
+ <Option compilerVar="CC" />
</Unit>
- <Unit filename="..\3rdparty\libjpeg\jchuff.c">
- <Option compilerVar="CC"/>
- <Option target="default"/>
+ <Unit filename="../3rdparty/libjpeg/jchuff.c">
+ <Option compilerVar="CC" />
</Unit>
- <Unit filename="..\3rdparty\libjpeg\jchuff.h">
- <Option compilerVar=""/>
- <Option compile="0"/>
- <Option link="0"/>
- <Option target="default"/>
+ <Unit filename="../3rdparty/libjpeg/jchuff.h" />
+ <Unit filename="../3rdparty/libjpeg/jcinit.c">
+ <Option compilerVar="CC" />
</Unit>
- <Unit filename="..\3rdparty\libjpeg\jcinit.c">
- <Option compilerVar="CC"/>
- <Option target="default"/>
+ <Unit filename="../3rdparty/libjpeg/jcmainct.c">
+ <Option compilerVar="CC" />
</Unit>
- <Unit filename="..\3rdparty\libjpeg\jcmainct.c">
- <Option compilerVar="CC"/>
- <Option target="default"/>
+ <Unit filename="../3rdparty/libjpeg/jcmarker.c">
+ <Option compilerVar="CC" />
</Unit>
- <Unit filename="..\3rdparty\libjpeg\jcmarker.c">
- <Option compilerVar="CC"/>
- <Option target="default"/>
+ <Unit filename="../3rdparty/libjpeg/jcmaster.c">
+ <Option compilerVar="CC" />
</Unit>
- <Unit filename="..\3rdparty\libjpeg\jcmaster.c">
- <Option compilerVar="CC"/>
- <Option target="default"/>
+ <Unit filename="../3rdparty/libjpeg/jcomapi.c">
+ <Option compilerVar="CC" />
</Unit>
- <Unit filename="..\3rdparty\libjpeg\jcomapi.c">
- <Option compilerVar="CC"/>
- <Option target="default"/>
+ <Unit filename="../3rdparty/libjpeg/jconfig.h" />
+ <Unit filename="../3rdparty/libjpeg/jcparam.c">
+ <Option compilerVar="CC" />
</Unit>
- <Unit filename="..\3rdparty\libjpeg\jconfig.h">
- <Option compilerVar=""/>
- <Option compile="0"/>
- <Option link="0"/>
- <Option target="default"/>
+ <Unit filename="../3rdparty/libjpeg/jcphuff.c">
+ <Option compilerVar="CC" />
</Unit>
- <Unit filename="..\3rdparty\libjpeg\jcparam.c">
- <Option compilerVar="CC"/>
- <Option target="default"/>
+ <Unit filename="../3rdparty/libjpeg/jcprepct.c">
+ <Option compilerVar="CC" />
</Unit>
- <Unit filename="..\3rdparty\libjpeg\jcphuff.c">
- <Option compilerVar="CC"/>
- <Option target="default"/>
+ <Unit filename="../3rdparty/libjpeg/jcsample.c">
+ <Option compilerVar="CC" />
</Unit>
- <Unit filename="..\3rdparty\libjpeg\jcprepct.c">
- <Option compilerVar="CC"/>
- <Option target="default"/>
+ <Unit filename="../3rdparty/libjpeg/jctrans.c">
+ <Option compilerVar="CC" />
</Unit>
- <Unit filename="..\3rdparty\libjpeg\jcsample.c">
- <Option compilerVar="CC"/>
- <Option target="default"/>
+ <Unit filename="../3rdparty/libjpeg/jdapimin.c">
+ <Option compilerVar="CC" />
</Unit>
- <Unit filename="..\3rdparty\libjpeg\jctrans.c">
- <Option compilerVar="CC"/>
- <Option target="default"/>
+ <Unit filename="../3rdparty/libjpeg/jdapistd.c">
+ <Option compilerVar="CC" />
</Unit>
- <Unit filename="..\3rdparty\libjpeg\jdapimin.c">
- <Option compilerVar="CC"/>
- <Option target="default"/>
+ <Unit filename="../3rdparty/libjpeg/jdatadst.c">
+ <Option compilerVar="CC" />
</Unit>
- <Unit filename="..\3rdparty\libjpeg\jdapistd.c">
- <Option compilerVar="CC"/>
- <Option target="default"/>
+ <Unit filename="../3rdparty/libjpeg/jdatasrc.c">
+ <Option compilerVar="CC" />
</Unit>
- <Unit filename="..\3rdparty\libjpeg\jdatadst.c">
- <Option compilerVar="CC"/>
- <Option target="default"/>
+ <Unit filename="../3rdparty/libjpeg/jdcoefct.c">
+ <Option compilerVar="CC" />
</Unit>
- <Unit filename="..\3rdparty\libjpeg\jdatasrc.c">
- <Option compilerVar="CC"/>
- <Option target="default"/>
+ <Unit filename="../3rdparty/libjpeg/jdcolor.c">
+ <Option compilerVar="CC" />
</Unit>
- <Unit filename="..\3rdparty\libjpeg\jdcoefct.c">
- <Option compilerVar="CC"/>
- <Option target="default"/>
+ <Unit filename="../3rdparty/libjpeg/jdct.h" />
+ <Unit filename="../3rdparty/libjpeg/jddctmgr.c">
+ <Option compilerVar="CC" />
</Unit>
- <Unit filename="..\3rdparty\libjpeg\jdcolor.c">
- <Option compilerVar="CC"/>
- <Option target="default"/>
+ <Unit filename="../3rdparty/libjpeg/jdhuff.c">
+ <Option compilerVar="CC" />
</Unit>
- <Unit filename="..\3rdparty\libjpeg\jdct.h">
- <Option compilerVar=""/>
- <Option compile="0"/>
- <Option link="0"/>
- <Option target="default"/>
+ <Unit filename="../3rdparty/libjpeg/jdhuff.h" />
+ <Unit filename="../3rdparty/libjpeg/jdinput.c">
+ <Option compilerVar="CC" />
</Unit>
- <Unit filename="..\3rdparty\libjpeg\jddctmgr.c">
- <Option compilerVar="CC"/>
- <Option target="default"/>
+ <Unit filename="../3rdparty/libjpeg/jdmainct.c">
+ <Option compilerVar="CC" />
</Unit>
- <Unit filename="..\3rdparty\libjpeg\jdhuff.c">
- <Option compilerVar="CC"/>
- <Option target="default"/>
+ <Unit filename="../3rdparty/libjpeg/jdmarker.c">
+ <Option compilerVar="CC" />
</Unit>
- <Unit filename="..\3rdparty\libjpeg\jdhuff.h">
- <Option compilerVar=""/>
- <Option compile="0"/>
- <Option link="0"/>
- <Option target="default"/>
+ <Unit filename="../3rdparty/libjpeg/jdmaster.c">
+ <Option compilerVar="CC" />
</Unit>
- <Unit filename="..\3rdparty\libjpeg\jdinput.c">
- <Option compilerVar="CC"/>
- <Option target="default"/>
+ <Unit filename="../3rdparty/libjpeg/jdmerge.c">
+ <Option compilerVar="CC" />
</Unit>
- <Unit filename="..\3rdparty\libjpeg\jdmainct.c">
- <Option compilerVar="CC"/>
- <Option target="default"/>
+ <Unit filename="../3rdparty/libjpeg/jdphuff.c">
+ <Option compilerVar="CC" />
</Unit>
- <Unit filename="..\3rdparty\libjpeg\jdmarker.c">
- <Option compilerVar="CC"/>
- <Option target="default"/>
+ <Unit filename="../3rdparty/libjpeg/jdpostct.c">
+ <Option compilerVar="CC" />
</Unit>
- <Unit filename="..\3rdparty\libjpeg\jdmaster.c">
- <Option compilerVar="CC"/>
- <Option target="default"/>
+ <Unit filename="../3rdparty/libjpeg/jdsample.c">
+ <Option compilerVar="CC" />
</Unit>
- <Unit filename="..\3rdparty\libjpeg\jdmerge.c">
- <Option compilerVar="CC"/>
- <Option target="default"/>
+ <Unit filename="../3rdparty/libjpeg/jdtrans.c">
+ <Option compilerVar="CC" />
</Unit>
- <Unit filename="..\3rdparty\libjpeg\jdphuff.c">
- <Option compilerVar="CC"/>
- <Option target="default"/>
+ <Unit filename="../3rdparty/libjpeg/jerror.c">
+ <Option compilerVar="CC" />
</Unit>
- <Unit filename="..\3rdparty\libjpeg\jdpostct.c">
- <Option compilerVar="CC"/>
- <Option target="default"/>
+ <Unit filename="../3rdparty/libjpeg/jerror.h" />
+ <Unit filename="../3rdparty/libjpeg/jfdctflt.c">
+ <Option compilerVar="CC" />
</Unit>
- <Unit filename="..\3rdparty\libjpeg\jdsample.c">
- <Option compilerVar="CC"/>
- <Option target="default"/>
+ <Unit filename="../3rdparty/libjpeg/jfdctfst.c">
+ <Option compilerVar="CC" />
</Unit>
- <Unit filename="..\3rdparty\libjpeg\jdtrans.c">
- <Option compilerVar="CC"/>
- <Option target="default"/>
+ <Unit filename="../3rdparty/libjpeg/jfdctint.c">
+ <Option compilerVar="CC" />
</Unit>
- <Unit filename="..\3rdparty\libjpeg\jerror.c">
- <Option compilerVar="CC"/>
- <Option target="default"/>
+ <Unit filename="../3rdparty/libjpeg/jidctflt.c">
+ <Option compilerVar="CC" />
</Unit>
- <Unit filename="..\3rdparty\libjpeg\jerror.h">
- <Option compilerVar=""/>
- <Option compile="0"/>
- <Option link="0"/>
- <Option target="default"/>
+ <Unit filename="../3rdparty/libjpeg/jidctfst.c">
+ <Option compilerVar="CC" />
</Unit>
- <Unit filename="..\3rdparty\libjpeg\jfdctflt.c">
- <Option compilerVar="CC"/>
- <Option target="default"/>
+ <Unit filename="../3rdparty/libjpeg/jidctint.c">
+ <Option compilerVar="CC" />
</Unit>
- <Unit filename="..\3rdparty\libjpeg\jfdctfst.c">
- <Option compilerVar="CC"/>
- <Option target="default"/>
+ <Unit filename="../3rdparty/libjpeg/jidctred.c">
+ <Option compilerVar="CC" />
</Unit>
- <Unit filename="..\3rdparty\libjpeg\jfdctint.c">
- <Option compilerVar="CC"/>
- <Option target="default"/>
+ <Unit filename="../3rdparty/libjpeg/jinclude.h" />
+ <Unit filename="../3rdparty/libjpeg/jmemmgr.c">
+ <Option compilerVar="CC" />
</Unit>
- <Unit filename="..\3rdparty\libjpeg\jidctflt.c">
- <Option compilerVar="CC"/>
- <Option target="default"/>
+ <Unit filename="../3rdparty/libjpeg/jmemnobs.c">
+ <Option compilerVar="CC" />
</Unit>
- <Unit filename="..\3rdparty\libjpeg\jidctfst.c">
- <Option compilerVar="CC"/>
- <Option target="default"/>
+ <Unit filename="../3rdparty/libjpeg/jmemsys.h" />
+ <Unit filename="../3rdparty/libjpeg/jmorecfg.h" />
+ <Unit filename="../3rdparty/libjpeg/jpegint.h" />
+ <Unit filename="../3rdparty/libjpeg/jpeglib.h" />
+ <Unit filename="../3rdparty/libjpeg/jquant1.c">
+ <Option compilerVar="CC" />
</Unit>
- <Unit filename="..\3rdparty\libjpeg\jidctint.c">
- <Option compilerVar="CC"/>
- <Option target="default"/>
+ <Unit filename="../3rdparty/libjpeg/jquant2.c">
+ <Option compilerVar="CC" />
</Unit>
- <Unit filename="..\3rdparty\libjpeg\jidctred.c">
- <Option compilerVar="CC"/>
- <Option target="default"/>
+ <Unit filename="../3rdparty/libjpeg/jutils.c">
+ <Option compilerVar="CC" />
</Unit>
- <Unit filename="..\3rdparty\libjpeg\jinclude.h">
- <Option compilerVar=""/>
- <Option compile="0"/>
- <Option link="0"/>
- <Option target="default"/>
+ <Unit filename="../3rdparty/libjpeg/jversion.h" />
+ <Unit filename="../3rdparty/libogg/include/ogg/ogg.h" />
+ <Unit filename="../3rdparty/libogg/include/ogg/os_types.h" />
+ <Unit filename="../3rdparty/libogg/src/bitwise.c">
+ <Option compilerVar="CC" />
</Unit>
- <Unit filename="..\3rdparty\libjpeg\jmemmgr.c">
- <Option compilerVar="CC"/>
- <Option target="default"/>
+ <Unit filename="../3rdparty/libogg/src/framing.c">
+ <Option compilerVar="CC" />
</Unit>
- <Unit filename="..\3rdparty\libjpeg\jmemnobs.c">
- <Option compilerVar="CC"/>
- <Option target="default"/>
+ <Unit filename="../3rdparty/libpng/png.c">
+ <Option compilerVar="CC" />
</Unit>
- <Unit filename="..\3rdparty\libjpeg\jmemsys.h">
- <Option compilerVar=""/>
- <Op...
[truncated message content] |
|
From: <at...@us...> - 2007-10-26 19:19:17
|
Revision: 516
http://cadcdev.svn.sourceforge.net/cadcdev/?rev=516&view=rev
Author: atani
Date: 2007-10-26 12:19:14 -0700 (Fri, 26 Oct 2007)
Log Message:
-----------
* more NeHe examples
* migrated a couple drawables away from plx to normal OpenGL calls
* more NDS compatibility, all NeHe examples work as expected.
Modified Paths:
--------------
tiki/examples/nehe/Makefile
tiki/examples/nehe/lesson02/src/main.cpp
tiki/examples/nehe/lesson03/Makefile
tiki/examples/nehe/lesson03/src/main.cpp
tiki/examples/net/httpclient/src/main.cpp
tiki/include/Tiki/color.h
tiki/src/gl/drawables/banner.cpp
tiki/src/gl/drawables/console.cpp
tiki/src/gl/drawables/pointerArrow.cpp
tiki/src/gl/gl.cpp
Added Paths:
-----------
tiki/examples/nehe/lesson03/
tiki/examples/nehe/lesson04/
tiki/examples/nehe/lesson04/Makefile
tiki/examples/nehe/lesson04/src/
tiki/examples/nehe/lesson04/src/main.cpp
tiki/examples/nehe/lesson05/
tiki/examples/nehe/lesson05/Makefile
tiki/examples/nehe/lesson05/src/
tiki/examples/nehe/lesson05/src/main.cpp
Removed Paths:
-------------
tiki/examples/nehe/lesson01/
Property Changed:
----------------
tiki/examples/nehe/lesson02/src/
tiki/examples/nehe/lesson03/src/
Modified: tiki/examples/nehe/Makefile
===================================================================
--- tiki/examples/nehe/Makefile 2007-10-25 23:42:44 UTC (rev 515)
+++ tiki/examples/nehe/Makefile 2007-10-26 19:19:14 UTC (rev 516)
@@ -1,5 +1,5 @@
-SUBDIRS = lesson01 lesson02
+SUBDIRS = lesson02 lesson03 lesson04 lesson05
TIKI_DIR ?= $(CURDIR)/../../
include $(TIKI_DIR)$(TIKI_PLAT)/Makefile.rules
Property changes on: tiki/examples/nehe/lesson02/src
___________________________________________________________________
Name: svn:ignore
+ *.d
*.nds
*.ds.gba
Modified: tiki/examples/nehe/lesson02/src/main.cpp
===================================================================
--- tiki/examples/nehe/lesson02/src/main.cpp 2007-10-25 23:42:44 UTC (rev 515)
+++ tiki/examples/nehe/lesson02/src/main.cpp 2007-10-26 19:19:14 UTC (rev 516)
@@ -22,16 +22,10 @@
Frame::set3d();
// Set the current matrix to be the model matrix
- glMatrixMode(GL_MODELVIEW);
-
- //Push our original Matrix onto the stack (save state)
- //glPushMatrix();
+ glMatrixMode(GL_MODELVIEW);
DrawGLScene();
- // Pop our Matrix from the stack (restore state)
- //glPopMatrix();
-
Frame::finish();
}
Copied: tiki/examples/nehe/lesson03 (from rev 515, tiki/examples/nehe/lesson01)
Modified: tiki/examples/nehe/lesson03/Makefile
===================================================================
--- tiki/examples/nehe/lesson01/Makefile 2007-10-25 23:42:44 UTC (rev 515)
+++ tiki/examples/nehe/lesson03/Makefile 2007-10-26 19:19:14 UTC (rev 516)
@@ -4,22 +4,22 @@
OBJS = $(patsubst %.cpp,%.o,$(wildcard src/*.cpp))
ifeq ($(TIKI_PLAT),nds)
-NDS_CART_CODE ?= NH01
+NDS_CART_CODE ?= NH03
NDS_CART_ID ?= NH
-NDS_CART_NAME ?= NeHe01
+NDS_CART_NAME ?= NeHe03
NDS_CART_VERSION ?= 1
endif
-all: nehe_lesson01
-nehe_lesson01: $(OBJS)
+all: nehe_lesson03
+nehe_lesson03: $(OBJS)
$(build_romdisk)
- $(CXX) $(LDFLAGS) -L$(TIKI_DIR)$(TIKI_PLAT) -L$(TIKI_DIR)$(TIKI_PLAT)/lib $(OBJS) $(TIKI_BASE_LIBS) -o nehe_lesson01$(PLATFORM_BINARY_EXT) $(ROMDISK_OBJ)
+ $(CXX) $(LDFLAGS) -L$(TIKI_DIR)$(TIKI_PLAT) -L$(TIKI_DIR)$(TIKI_PLAT)/lib $(OBJS) $(TIKI_BASE_LIBS) -o nehe_lesson03$(PLATFORM_BINARY_EXT) $(ROMDISK_OBJ)
$(post_build)
clean:
- -rm -f $(OBJS) nehe_lesson01$(PLATFORM_BINARY_EXT) $(ROMDISK_OBJ)
+ -rm -f $(OBJS) nehe_lesson03$(PLATFORM_BINARY_EXT) $(ROMDISK_OBJ)
ifeq ($(TIKI_PLAT),nds)
- -rm -f nehe_lesson01.nds nehe_lesson01.ds.gba
+ -rm -f nehe_lesson03.nds nehe_lesson03.ds.gba
endif
TIKI_DIR ?= $(CURDIR)/../../../
Property changes on: tiki/examples/nehe/lesson03/src
___________________________________________________________________
Name: svn:ignore
+ *.d
*.nds
*.ds.nds
Modified: tiki/examples/nehe/lesson03/src/main.cpp
===================================================================
--- tiki/examples/nehe/lesson01/src/main.cpp 2007-10-25 23:42:44 UTC (rev 515)
+++ tiki/examples/nehe/lesson03/src/main.cpp 2007-10-26 19:19:14 UTC (rev 516)
@@ -18,20 +18,12 @@
while (1)
{
Frame::begin();
+ Frame::set3d();
// Set the current matrix to be the model matrix
glMatrixMode(GL_MODELVIEW);
- // Set the color..not in nehe source...ds gl default will be black
- glColor3f(1, 1, 1);
-
- //Push our original Matrix onto the stack (save state)
- //glPushMatrix();
-
DrawGLScene();
-
- // Pop our Matrix from the stack (restore state)
- //glPopMatrix();
Frame::finish();
}
@@ -39,8 +31,24 @@
return 0;
}
-void DrawGLScene(void)
+void DrawGLScene() // Here's Where We Do All The Drawing
{
- //this is where the magic happens
- glLoadIdentity();
+ glLoadIdentity(); // Reset The Current Modelview Matrix
+ glTranslatef(-1.5f,0.0f,-6.0f); // Move Left 1.5 Units And Into The Screen 6.0
+ glBegin(GL_TRIANGLES); // Drawing Using Triangles
+ glColor3f(1.0f,0.0f,0.0f); // Set The Color To Red
+ glVertex3f( 0.0f, 1.0f, 0.0f); // Top
+ glColor3f(0.0f,1.0f,0.0f); // Set The Color To Green
+ glVertex3f(-1.0f,-1.0f, 0.0f); // Bottom Left
+ glColor3f(0.0f,0.0f,1.0f); // Set The Color To Blue
+ glVertex3f( 1.0f,-1.0f, 0.0f); // Bottom Right
+ glEnd(); // Finished Drawing The Triangle
+ glTranslatef(3.0f,0.0f,0.0f); // Move Right 3 Units
+ glColor3f(0.5f,0.5f,1.0f); // Set The Color To Blue One Time Only
+ glBegin(GL_QUADS); // Draw A Quad
+ glVertex3f(-1.0f, 1.0f, 0.0f); // Top Left
+ glVertex3f( 1.0f, 1.0f, 0.0f); // Top Right
+ glVertex3f( 1.0f,-1.0f, 0.0f); // Bottom Right
+ glVertex3f(-1.0f,-1.0f, 0.0f); // Bottom Left
+ glEnd(); // Done Drawing The Quad
}
Property changes on: tiki/examples/nehe/lesson04
___________________________________________________________________
Name: svn:ignore
+ *.nds
*.ds.gba
Added: tiki/examples/nehe/lesson04/Makefile
===================================================================
--- tiki/examples/nehe/lesson04/Makefile (rev 0)
+++ tiki/examples/nehe/lesson04/Makefile 2007-10-26 19:19:14 UTC (rev 516)
@@ -0,0 +1,27 @@
+
+
+CFLAGS=-I$(TIKI_DIR)$(TIKI_PLAT)/include -I$(TIKI_DIR)include
+OBJS = $(patsubst %.cpp,%.o,$(wildcard src/*.cpp))
+
+ifeq ($(TIKI_PLAT),nds)
+NDS_CART_CODE ?= NH04
+NDS_CART_ID ?= NH
+NDS_CART_NAME ?= NeHe04
+NDS_CART_VERSION ?= 1
+endif
+
+all: nehe_lesson04
+nehe_lesson04: $(OBJS)
+ $(build_romdisk)
+ $(CXX) $(LDFLAGS) -L$(TIKI_DIR)$(TIKI_PLAT) -L$(TIKI_DIR)$(TIKI_PLAT)/lib $(OBJS) $(TIKI_BASE_LIBS) -o nehe_lesson04$(PLATFORM_BINARY_EXT) $(ROMDISK_OBJ)
+ $(post_build)
+
+clean:
+ -rm -f $(OBJS) nehe_lesson04$(PLATFORM_BINARY_EXT) $(ROMDISK_OBJ)
+ifeq ($(TIKI_PLAT),nds)
+ -rm -f nehe_lesson04.nds nehe_lesson04.ds.gba
+endif
+
+TIKI_DIR ?= $(CURDIR)/../../../
+DEPSDIR=$(CURDIR)
+include $(TIKI_DIR)$(TIKI_PLAT)/Makefile.rules
Property changes on: tiki/examples/nehe/lesson04/Makefile
___________________________________________________________________
Name: svn:executable
+ *
Property changes on: tiki/examples/nehe/lesson04/src
___________________________________________________________________
Name: svn:ignore
+ *.d
Added: tiki/examples/nehe/lesson04/src/main.cpp
===================================================================
--- tiki/examples/nehe/lesson04/src/main.cpp (rev 0)
+++ tiki/examples/nehe/lesson04/src/main.cpp 2007-10-26 19:19:14 UTC (rev 516)
@@ -0,0 +1,69 @@
+/****************************************
+ * NDS NeHe Lesson 04 *
+ * Author: Dovoto *
+ ****************************************/
+
+// include your ndslib
+#include <Tiki/tiki.h>
+#include <Tiki/gl.h>
+
+using namespace Tiki;
+using namespace Tiki::GL;
+
+
+void DrawGLScene();
+
+float rtri; // Angle For The Triangle ( NEW )
+float rquad; // Angle For The Quad ( NEW )
+
+int main(int argc, char *argv[])
+{
+ Tiki::init(argc, argv);
+
+ // Set the current matrix to be the model matrix
+ glMatrixMode(GL_MODELVIEW);
+
+ while (1)
+ {
+ Frame::begin();
+ Frame::set3d();
+
+ // Set the current matrix to be the model matrix
+ glMatrixMode(GL_MODELVIEW);
+
+ // draw the scene
+ DrawGLScene();
+
+ Frame::finish();
+ }
+
+ return 0;
+}
+
+void DrawGLScene() // Here's Where We Do All The Drawing
+{
+ glLoadIdentity(); // Reset The Current Modelview Matrix
+ glTranslatef(-1.5f,0.0f,-6.0f); // Move Left 1.5 Units And Into The Screen 6.0
+ glRotatef(rtri,0.0f,1.0f,0.0f); // Rotate The Triangle On The Y axis ( NEW )
+ glColor3f(1, 1, 1); // set the vertex color
+ glBegin(GL_TRIANGLES); // Start Drawing A Triangle
+ glColor3f(1.0f,0.0f,0.0f); // Set Top Point Of Triangle To Red
+ glVertex3f( 0.0f, 1.0f, 0.0f); // First Point Of The Triangle
+ glColor3f(0.0f,1.0f,0.0f); // Set Left Point Of Triangle To Green
+ glVertex3f(-1.0f,-1.0f, 0.0f); // Second Point Of The Triangle
+ glColor3f(0.0f,0.0f,1.0f); // Set Right Point Of Triangle To Blue
+ glVertex3f( 1.0f,-1.0f, 0.0f); // Third Point Of The Triangle
+ glEnd(); // Done Drawing The Triangle
+ glLoadIdentity(); // Reset The Current Modelview Matrix
+ glTranslatef(1.5f,0.0f,-6.0f); // Move Right 1.5 Units And Into The Screen 6.0
+ glRotatef(rquad,1.0f,0.0f,0.0f); // Rotate The Quad On The X axis ( NEW )
+ glColor3f(0.5f,0.5f,1.0f); // Set The Color To Blue One Time Only
+ glBegin(GL_QUADS); // Draw A Quad
+ glVertex3f(-1.0f, 1.0f, 0.0f); // Top Left
+ glVertex3f( 1.0f, 1.0f, 0.0f); // Top Right
+ glVertex3f( 1.0f,-1.0f, 0.0f); // Bottom Right
+ glVertex3f(-1.0f,-1.0f, 0.0f); // Bottom Left
+ glEnd(); // Done Drawing The Quad
+ rtri+=0.9f; // Increase The Rotation Variable For The Triangle ( NEW )
+ rquad-=0.75f; // Decrease The Rotation Variable For The Quad ( NEW )
+}
Property changes on: tiki/examples/nehe/lesson05
___________________________________________________________________
Name: svn:ignore
+ *.nds
*.ds.gba
Added: tiki/examples/nehe/lesson05/Makefile
===================================================================
--- tiki/examples/nehe/lesson05/Makefile (rev 0)
+++ tiki/examples/nehe/lesson05/Makefile 2007-10-26 19:19:14 UTC (rev 516)
@@ -0,0 +1,27 @@
+
+
+CFLAGS=-I$(TIKI_DIR)$(TIKI_PLAT)/include -I$(TIKI_DIR)include
+OBJS = $(patsubst %.cpp,%.o,$(wildcard src/*.cpp))
+
+ifeq ($(TIKI_PLAT),nds)
+NDS_CART_CODE ?= NH05
+NDS_CART_ID ?= NH
+NDS_CART_NAME ?= NeHe05
+NDS_CART_VERSION ?= 1
+endif
+
+all: nehe_lesson05
+nehe_lesson05: $(OBJS)
+ $(build_romdisk)
+ $(CXX) $(LDFLAGS) -L$(TIKI_DIR)$(TIKI_PLAT) -L$(TIKI_DIR)$(TIKI_PLAT)/lib $(OBJS) $(TIKI_BASE_LIBS) -o nehe_lesson05$(PLATFORM_BINARY_EXT) $(ROMDISK_OBJ)
+ $(post_build)
+
+clean:
+ -rm -f $(OBJS) nehe_lesson05$(PLATFORM_BINARY_EXT) $(ROMDISK_OBJ)
+ifeq ($(TIKI_PLAT),nds)
+ -rm -f nehe_lesson05.nds nehe_lesson05.ds.gba
+endif
+
+TIKI_DIR ?= $(CURDIR)/../../../
+DEPSDIR=$(CURDIR)
+include $(TIKI_DIR)$(TIKI_PLAT)/Makefile.rules
Property changes on: tiki/examples/nehe/lesson05/Makefile
___________________________________________________________________
Name: svn:executable
+ *
Property changes on: tiki/examples/nehe/lesson05/src
___________________________________________________________________
Name: svn:ignore
+ *.d
Added: tiki/examples/nehe/lesson05/src/main.cpp
===================================================================
--- tiki/examples/nehe/lesson05/src/main.cpp (rev 0)
+++ tiki/examples/nehe/lesson05/src/main.cpp 2007-10-26 19:19:14 UTC (rev 516)
@@ -0,0 +1,108 @@
+/****************************************
+ * NDS NeHe Lesson 05 *
+ * Author: Dovoto *
+ ****************************************/
+
+// include your ndslib
+#include <Tiki/tiki.h>
+#include <Tiki/gl.h>
+
+using namespace Tiki;
+using namespace Tiki::GL;
+
+void DrawGLScene();
+
+float rtri; // Angle For The Triangle ( NEW )
+float rquad; // Angle For The Quad ( NEW )
+
+int main(int argc, char *argv[])
+{
+ Tiki::init(argc, argv);
+
+ while (1)
+ {
+ Frame::begin();
+ Frame::set3d();
+
+ // Set the current matrix to be the model matrix
+ glMatrixMode(GL_MODELVIEW);
+
+ DrawGLScene();
+
+ Frame::finish();
+ }
+
+ return 0;
+}
+
+void DrawGLScene() // Here's Where We Do All The Drawing
+{
+ glLoadIdentity(); // Reset The Current Modelview Matrix
+ glTranslatef(-1.5f,0.0f,-6.0f); // Move Left 1.5 Units And Into The Screen 6.0
+ glRotatef(rtri,0.0f,1.0f,0.0f); // Rotate The Triangle On The Y axis ( NEW )
+ glBegin(GL_TRIANGLES); // Start Drawing A Triangle
+ glColor3f(1.0f,0.0f,0.0f); // Red
+ glVertex3f( 0.0f, 1.0f, 0.0f); // Top Of Triangle (Front)
+ glColor3f(0.0f,1.0f,0.0f); // Green
+ glVertex3f(-1.0f,-1.0f, 1.0f); // Left Of Triangle (Front)
+ glColor3f(0.0f,0.0f,1.0f); // Blue
+ glVertex3f( 1.0f,-1.0f, 1.0f); // Right Of Triangle (Front)
+ glColor3f(1.0f,0.0f,0.0f); // Red
+ glVertex3f( 0.0f, 1.0f, 0.0f); // Top Of Triangle (Right)
+ glColor3f(0.0f,0.0f,1.0f); // Blue
+ glVertex3f( 1.0f,-1.0f, 1.0f); // Left Of Triangle (Right)
+ glColor3f(0.0f,1.0f,0.0f); // Green
+ glVertex3f( 1.0f,-1.0f, -1.0f); // Right Of Triangle (Right)
+ glColor3f(1.0f,0.0f,0.0f); // Red
+ glVertex3f( 0.0f, 1.0f, 0.0f); // Top Of Triangle (Back)
+ glColor3f(0.0f,1.0f,0.0f); // Green
+ glVertex3f( 1.0f,-1.0f, -1.0f); // Left Of Triangle (Back)
+ glColor3f(0.0f,0.0f,1.0f); // Blue
+ glVertex3f(-1.0f,-1.0f, -1.0f); // Right Of Triangle (Back)
+ glColor3f(1.0f,0.0f,0.0f); // Red
+ glVertex3f( 0.0f, 1.0f, 0.0f); // Top Of Triangle (Left)
+ glColor3f(0.0f,0.0f,1.0f); // Blue
+ glVertex3f(-1.0f,-1.0f,-1.0f); // Left Of Triangle (Left)
+ glColor3f(0.0f,1.0f,0.0f); // Green
+ glVertex3f(-1.0f,-1.0f, 1.0f); // Right Of Triangle (Left)
+ glEnd(); // Done Drawing The Pyramid
+
+ glLoadIdentity(); // Reset The Current Modelview Matrix
+ glTranslatef(1.5f,0.0f,-7.0f); // Move Right 1.5 Units And Into The Screen 7.0
+ glRotatef(rquad,1.0f,1.0f,1.0f); // Rotate The Quad On The X axis ( NEW )
+ glBegin(GL_QUADS); // Draw A Quad
+ glColor3f(0.0f,1.0f,0.0f); // Set The Color To Green
+ glVertex3f( 1.0f, 1.0f,-1.0f); // Top Right Of The Quad (Top)
+ glVertex3f(-1.0f, 1.0f,-1.0f); // Top Left Of The Quad (Top)
+ glVertex3f(-1.0f, 1.0f, 1.0f); // Bottom Left Of The Quad (Top)
+ glVertex3f( 1.0f, 1.0f, 1.0f); // Bottom Right Of The Quad (Top)
+ glColor3f(1.0f,0.5f,0.0f); // Set The Color To Orange
+ glVertex3f( 1.0f,-1.0f, 1.0f); // Top Right Of The Quad (Bottom)
+ glVertex3f(-1.0f,-1.0f, 1.0f); // Top Left Of The Quad (Bottom)
+ glVertex3f(-1.0f,-1.0f,-1.0f); // Bottom Left Of The Quad (Bottom)
+ glVertex3f( 1.0f,-1.0f,-1.0f); // Bottom Right Of The Quad (Bottom)
+ glColor3f(1.0f,0.0f,0.0f); // Set The Color To Red
+ glVertex3f( 1.0f, 1.0f, 1.0f); // Top Right Of The Quad (Front)
+ glVertex3f(-1.0f, 1.0f, 1.0f); // Top Left Of The Quad (Front)
+ glVertex3f(-1.0f,-1.0f, 1.0f); // Bottom Left Of The Quad (Front)
+ glVertex3f( 1.0f,-1.0f, 1.0f); // Bottom Right Of The Quad (Front)
+ glColor3f(1.0f,1.0f,0.0f); // Set The Color To Yellow
+ glVertex3f( 1.0f,-1.0f,-1.0f); // Top Right Of The Quad (Back)
+ glVertex3f(-1.0f,-1.0f,-1.0f); // Top Left Of The Quad (Back)
+ glVertex3f(-1.0f, 1.0f,-1.0f); // Bottom Left Of The Quad (Back)
+ glVertex3f( 1.0f, 1.0f,-1.0f); // Bottom Right Of The Quad (Back)
+ glColor3f(0.0f,0.0f,1.0f); // Set The Color To Blue
+ glVertex3f(-1.0f, 1.0f, 1.0f); // Top Right Of The Quad (Left)
+ glVertex3f(-1.0f, 1.0f,-1.0f); // Top Left Of The Quad (Left)
+ glVertex3f(-1.0f,-1.0f,-1.0f); // Bottom Left Of The Quad (Left)
+ glVertex3f(-1.0f,-1.0f, 1.0f); // Bottom Right Of The Quad (Left)
+ glColor3f(1.0f,0.0f,1.0f); // Set The Color To Violet
+ glVertex3f( 1.0f, 1.0f,-1.0f); // Top Right Of The Quad (Right)
+ glVertex3f( 1.0f, 1.0f, 1.0f); // Top Left Of The Quad (Right)
+ glVertex3f( 1.0f,-1.0f, 1.0f); // Bottom Left Of The Quad (Right)
+ glVertex3f( 1.0f,-1.0f,-1.0f); // Bottom Right Of The Quad (Right)
+ glEnd(); // Done Drawing The Quad
+
+ rtri+=0.2f; // Increase The Rotation Variable For The Triangle ( NEW )
+ rquad-=0.15f; // Decrease The Rotation Variable For The Quad ( NEW )
+}
Modified: tiki/examples/net/httpclient/src/main.cpp
===================================================================
--- tiki/examples/net/httpclient/src/main.cpp 2007-10-25 23:42:44 UTC (rev 515)
+++ tiki/examples/net/httpclient/src/main.cpp 2007-10-26 19:19:14 UTC (rev 516)
@@ -59,7 +59,7 @@
console->setSize(640, 480);
console->setTranslate( Vector( 320, 240, 0 ) );
#else
- console->setSize(256, 192);
+ console->setSize(255, 191);
console->setTranslate( Vector( 128, 96, 0 ) );
#endif
console->setAutoWrap( true );
@@ -80,7 +80,7 @@
cookie->getDomain().c_str(), cookie->isSecure() ? "true" : "false");
}
else {
- console->printf("COOKIE: %s (version->%s,value->%s,path->%s,max-age->%d,domain->%s,secure->%s)\n",
+ console->printf("COOKIE: %s (version->%s,value->%s,path->%s,max-age->%d,domain->%s,secure->%s)\n",
cookie->getName().c_str(), cookie->getVersion().c_str(), cookie->getValue().c_str(), cookie->getPath().c_str(), cookie->getMaxAge(),
cookie->getDomain().c_str(), cookie->isSecure() ? "true" : "false");
}
Modified: tiki/include/Tiki/color.h
===================================================================
--- tiki/include/Tiki/color.h 2007-10-25 23:42:44 UTC (rev 515)
+++ tiki/include/Tiki/color.h 2007-10-26 19:19:14 UTC (rev 516)
@@ -84,8 +84,7 @@
#if TIKI_PLAT != TIKI_NDS
glColor4f( r, g, b, a );
#else
-
- glColor3f( r, g, b );
+ glColor(pack1555(r, g, b, a));
#endif
}
@@ -96,6 +95,12 @@
( ( ( int ) ( g * 255 ) ) << 8 ) |
( ( ( int ) ( b * 255 ) ) );
}
+ static uint32 pack1555( float a, float r, float g, float b ) {
+ return ( ( ( ( int ) ( a * 255 ) ) >> 7 ) << 8 ) |
+ ( ( ( ( int ) ( r * 255 ) ) >> 3 ) << 10 ) |
+ ( ( ( ( int ) ( g * 255 ) ) >> 3 ) << 5 ) |
+ ( ( ( ( int ) ( b * 255 ) ) >> 4 ) );
+ }
float a, r, g, b;
};
Modified: tiki/src/gl/drawables/banner.cpp
===================================================================
--- tiki/src/gl/drawables/banner.cpp 2007-10-25 23:42:44 UTC (rev 515)
+++ tiki/src/gl/drawables/banner.cpp 2007-10-26 19:19:14 UTC (rev 516)
@@ -70,38 +70,23 @@
const Vector & tv = getPosition();
- plx_vertex_t vert;
- if (list == Trans) {
- vert.argb = getColor();
- } else {
- Color t = getColor(); t.a = 1.0f;
- vert.argb = t;
- }
- vert.oargb = 0;
+ Color argb = getColor();
- vert.flags = PLX_VERT;
- vert.x = tv.x-w/2;
- vert.y = tv.y+h/2;
- vert.z = tv.z;
- vert.u = m_u1;
- vert.v = m_v1;
- plx_prim(&vert, sizeof(vert));
-
- vert.y = tv.y-h/2;
- vert.u = m_u2;
- vert.v = m_v2;
- plx_prim(&vert, sizeof(vert));
-
- vert.x = tv.x+w/2;
- vert.y = tv.y+h/2;
- vert.u = m_u3;
- vert.v = m_v3;
- plx_prim(&vert, sizeof(vert));
-
- vert.flags = PLX_VERT_EOS;
- vert.y = tv.y-h/2;
- vert.u = m_u4;
- vert.v = m_v4;
- plx_prim(&vert, sizeof(vert));
+ if (list != Trans) {
+ argb.a = 1.0f;
+ }
+
+ argb.select();
+
+ glBegin(GL_TRIANGLE_STRIP);
+ glTexCoord2f(m_u1, m_v1);
+ glVertex3f(tv.x - w/2, tv.y + h/2, tv.z);
+ glTexCoord2f(m_u2, m_v2);
+ glVertex3f(tv.x - w/2, tv.y - h/2, tv.z);
+ glTexCoord2f(m_u3, m_v3);
+ glVertex3f(tv.x + w/2, tv.y + h/2, tv.z);
+ glTexCoord2f(m_u4, m_v4);
+ glVertex3f(tv.x + w/2, tv.y - h/2, tv.z);
+ glEnd();
}
Modified: tiki/src/gl/drawables/console.cpp
===================================================================
--- tiki/src/gl/drawables/console.cpp 2007-10-25 23:42:44 UTC (rev 515)
+++ tiki/src/gl/drawables/console.cpp 2007-10-26 19:19:14 UTC (rev 516)
@@ -38,7 +38,6 @@
m_texture->select();
#if TIKI_PLAT != TIKI_DC && TIKI_PLAT != TIKI_NDS
-
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
#endif
@@ -222,88 +221,46 @@
void ConsoleText::renderCharacter( float x, float y, float w, float h, unsigned char c, int attr )
{
- plx_vertex_t vert;
float u = static_cast<float>( ( c % 16 ) * 8 );
float v = static_cast<float>( ( c / 16 ) * 8 );
- int color = attr & 0x07;
-
const Vector & sv = getScale();
w *= sv.x;
h *= sv.y;
const Vector & tv = getPosition() + Vector( x, y, 0.01f );
- m_texture->select();
-
+ Color color = m_palette[BLACK];
if ( attr & HIGH_INTENSITY )
{
- vert.argb = Color( 0.25, 0.25, 0.25 );
- //color -= 8;
+ color += Color( 0.25, 0.25, 0.25 );
}
- else
- {
- vert.argb = Color( 0, 0, 0 );
- }
- vert.argb += m_palette[ color ];
- vert.oargb = 0;
-
- vert.flags = PLX_VERT;
- vert.x = tv.x - m_w / 2;
- vert.y = tv.y + h - m_h / 2;
- vert.z = tv.z;
- vert.u = u / m_texture->getW();
- vert.v = ( v + 8 ) / m_texture->getH();
- plx_prim( &vert, sizeof( vert ) );
-
- vert.y = tv.y - m_h / 2;
- vert.u = u / m_texture->getH();
- vert.v = v / m_texture->getW();
- plx_prim( &vert, sizeof( vert ) );
-
- vert.x = tv.x + w - m_w / 2;
- vert.y = tv.y + h - m_h / 2;
- vert.u = ( u + 8 ) / m_texture->getW();
- vert.v = ( v + 8 ) / m_texture->getH();
- plx_prim( &vert, sizeof( vert ) );
-
- vert.flags = PLX_VERT_EOS;
- vert.y = tv.y - m_h / 2;
- vert.u = ( u + 8 ) / m_texture->getW();
- vert.v = v / m_texture->getH();
- plx_prim( &vert, sizeof( vert ) );
+ color += m_palette[ attr & 0x07 ];
+ color.select();
+
+ glTexCoord2f(u/m_texture->getW(), (v+8)/m_texture->getH());
+ glVertex3f(tv.x - (m_w / 2), tv.y + h - (m_h / 2), tv.z);
+ glTexCoord2f(u/m_texture->getW(), v/m_texture->getH());
+ glVertex3f(tv.x - (m_w / 2), tv.y - (m_h / 2), tv.z);
+ glTexCoord2f((u+8)/m_texture->getW(), v/m_texture->getH());
+ glVertex3f(tv.x + w - (m_w / 2), tv.y - (m_h / 2), tv.z);
+ glTexCoord2f((u+8)/m_texture->getW(), (v+8)/m_texture->getH());
+ glVertex3f(tv.x + w - (m_w / 2), tv.y + h - (m_h / 2), tv.z);
}
void ConsoleText::renderBackground( float x, float y, float w, float h, int color )
{
- plx_vertex_t vert;
const Vector & sv = getScale();
w *= sv.x;
h *= sv.y;
const Vector & tv = getPosition() + Vector( x, y, -0.01f );
-
- m_texture->deselect();
-
- vert.argb = m_palette[ color ];
- vert.oargb = 0;
-
- vert.flags = PLX_VERT;
- vert.x = tv.x - m_w / 2;
- vert.y = tv.y + h - m_h / 2;
- vert.z = tv.z;
- plx_prim( &vert, sizeof( vert ) );
-
- vert.y = tv.y - m_h / 2;
- plx_prim( &vert, sizeof( vert ) );
-
- vert.x = tv.x + w - m_w / 2;
- vert.y = tv.y + h - m_h / 2;
- plx_prim( &vert, sizeof( vert ) );
-
- vert.flags = PLX_VERT_EOS;
- vert.y = tv.y - m_h / 2;
- plx_prim( &vert, sizeof( vert ) );
+ m_palette[ color ].select();
+
+ glVertex3f(tv.x - (m_w / 2), tv.y + h - (m_h / 2), tv.z);
+ glVertex3f(tv.x - (m_w / 2), tv.y - (m_h / 2), tv.z);
+ glVertex3f(tv.x + w - (m_w / 2), tv.y - (m_h / 2), tv.z);
+ glVertex3f(tv.x + w - (m_w / 2), tv.y + h - (m_h / 2), tv.z);
}
void ConsoleText::draw( ObjType list )
@@ -313,23 +270,33 @@
float y_step = ( m_h / m_rows );
#if TIKI_PLAT != TIKI_NDS
-
glDisable( GL_DEPTH_TEST );
#endif
-
- for ( y = 0; y < m_rows; y++ )
- {
- for ( x = 0; x < m_cols; x++ )
+ if ( list == Trans )
+ { //Characters!
+ m_texture->select();
+ glBegin(GL_QUADS);
+ for ( y = 0; y < m_rows; y++ )
{
- if ( list == Trans )
- { //Characters!
+ for ( x = 0; x < m_cols; x++ )
+ {
renderCharacter( x * x_step, y * y_step, x_step, y_step, m_charData[ y * ( m_cols ) + x ], m_colorData[ y * ( m_cols ) + x ] );
}
- else
- { //Background blocks!
+ }
+ glEnd();
+ }
+ else
+ { //Background blocks!
+ m_texture->deselect();
+ glBegin(GL_QUADS);
+ for ( y = 0; y < m_rows; y++ )
+ {
+ for ( x = 0; x < m_cols; x++ )
+ {
renderBackground( x * x_step, y * y_step, x_step, y_step, ( m_colorData[ y * ( m_cols ) + x ] >> 8 ) & 0x07 );
}
}
+ glEnd();
}
}
Modified: tiki/src/gl/drawables/pointerArrow.cpp
===================================================================
--- tiki/src/gl/drawables/pointerArrow.cpp 2007-10-25 23:42:44 UTC (rev 515)
+++ tiki/src/gl/drawables/pointerArrow.cpp 2007-10-26 19:19:14 UTC (rev 516)
@@ -29,40 +29,20 @@
Texture::deselect();
if(list==Trans) {
- vert.argb = Color(0,0,0);
- vert.z = tv.z;
+ Color black = Color(0,0,0);
+ black.select();
- vert.flags = PLX_VERT;
- vert.x = tv.x-2;
- vert.y = tv.y-4;
- plx_prim(&vert, sizeof(vert));
+ glBegin(GL_TRIANGLE_STRIP);
+ glVertex3f(tv.x - 2, tv.y - 4, tv.z);
+ glVertex3f(tv.x + 18, tv.y + 16, tv.z);
+ glVertex3f(tv.x - 2, tv.y + 24, tv.z);
+ glEnd();
- vert.flags = PLX_VERT;
- vert.x = tv.x+18;
- vert.y = tv.y+16;
- plx_prim(&vert, sizeof(vert));
-
- vert.flags = PLX_VERT_EOS;
- vert.x = tv.x-2;
- vert.y = tv.y+24;
- plx_prim(&vert, sizeof(vert));
-
- vert.argb = getTint();
- vert.z = tv.z + 0.01f;
-
- vert.flags = PLX_VERT;
- vert.x = tv.x;
- vert.y = tv.y;
- plx_prim(&vert, sizeof(vert));
-
- vert.flags = PLX_VERT;
- vert.x = tv.x+15;
- vert.y = tv.y+15;
- plx_prim(&vert, sizeof(vert));
-
- vert.flags = PLX_VERT_EOS;
- vert.x = tv.x;
- vert.y = tv.y+21;
- plx_prim(&vert, sizeof(vert));
+ getTint().select();
+ glBegin(GL_TRIANGLE_STRIP);
+ glVertex3f(tv.x, tv.y, tv.z + 0.01f);
+ glVertex3f(tv.x + 15, tv.y + 15, tv.z + 0.01f);
+ glVertex3f(tv.x, tv.y + 21, tv.z + 0.01f);
+ glEnd();
}
}
Modified: tiki/src/gl/gl.cpp
===================================================================
--- tiki/src/gl/gl.cpp 2007-10-25 23:42:44 UTC (rev 515)
+++ tiki/src/gl/gl.cpp 2007-10-26 19:19:14 UTC (rev 516)
@@ -37,11 +37,9 @@
glDepthMask( GL_TRUE );
glShadeModel( GL_SMOOTH );
glDisable( GL_CULL_FACE );
-#endif
set2d();
-#if TIKI_PLAT != TIKI_NDS
glViewport( 0, 0, 640, 480 );
glClearDepth( 0.0f );
#if TIKI_PLAT != TIKI_DC
@@ -51,13 +49,12 @@
#endif
#else // TIKI_NDS
- //glViewport( 0, 0, 255, 191 );
- //glClearDepth( 0x7FFFF );
- //glClearColor( 0, 0, 0, 31 );
+
+ // the DS is not happy in ortho mode, so force back to 3d
+ set3d();
#endif
- glLoadIdentity();
-
+ glLoadIdentity();
transDisable();
}
@@ -67,7 +64,7 @@
#if TIKI_PLAT != TIKI_NDS
glOrtho( 0, 640, 480, 0, 1.0f, -1.0f );
#else
- glOrtho( 0, 256, 192, 0, 0.1f, 100.0f );
+ glOrtho( 0, 256, 192, 0, 0.1f, 100.0f );
#endif
glMatrixMode( GL_MODELVIEW );
}
@@ -98,6 +95,8 @@
#endif
glEnable( GL_BLEND );
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
+#else // TIKI_NDS
+ glPolyFmt(POLY_ALPHA(31) | POLY_CULL_NONE);
#endif
}
@@ -105,6 +104,8 @@
// glEnable(GL_DEPTH_TEST);
#if TIKI_PLAT != TIKI_NDS
glDisable( GL_BLEND );
+#else
+ glPolyFmt(POLY_ALPHA(0) | POLY_CULL_NONE);
#endif
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <at...@us...> - 2007-10-27 01:19:22
|
Revision: 517
http://cadcdev.svn.sourceforge.net/cadcdev/?rev=517&view=rev
Author: atani
Date: 2007-10-26 18:19:20 -0700 (Fri, 26 Oct 2007)
Log Message:
-----------
* removed plxcompat
* removed TikiTest, will replace with new version soon
* set svn:ignore on various directories
Modified Paths:
--------------
tiki/dc/Makefile
tiki/dc/src/init_shutdown.cpp
tiki/dc/src/platgl.cpp
tiki/examples/Makefile
tiki/examples/console/TikiSnake/src/snake.cpp
tiki/examples/nehe/lesson02/src/main.cpp
tiki/examples/nehe/lesson03/src/main.cpp
tiki/examples/nehe/lesson04/src/main.cpp
tiki/examples/nehe/lesson05/src/main.cpp
tiki/examples/net/httpclient/src/main.cpp
tiki/include/Tiki/TikiAll.h
tiki/include/Tiki/drawable.h
tiki/include/Tiki/drawables/console.h
tiki/include/Tiki/gl.h
tiki/include/Tiki/vector.h
tiki/nds/Makefile
tiki/nds/src/init_shutdown.cpp
tiki/nds/src/platgl.cpp
tiki/nds/tiki.cbp
tiki/osx/Makefile
tiki/osx/Tiki.xcodeproj/project.pbxproj
tiki/osx/src/init_shutdown.cpp
tiki/osx/src/platgl.cpp
tiki/sdl/Makefile
tiki/sdl/TikiSDL.cbp
tiki/sdl/src/init_shutdown.cpp
tiki/sdl/src/platgl.cpp
tiki/src/gl/drawable.cpp
tiki/src/gl/drawables/banner.cpp
tiki/src/gl/drawables/console.cpp
tiki/src/gl/drawables/label.cpp
tiki/src/gl/drawables/pointerArrow.cpp
tiki/src/gl/drawables/texturetile.cpp
tiki/src/gl/font.cpp
tiki/win32/Makefile
tiki/win32/src/init_shutdown.cpp
tiki/win32/src/platgl.cpp
tiki/win32/tiki.cbp
tiki/win32/tiki.vcproj
Removed Paths:
-------------
tiki/examples/TikiTest/
tiki/include/Tiki/plxcompat.h
tiki/src/gl/plxcompat.cpp
Property Changed:
----------------
tiki/examples/console/TikiSnake/
tiki/examples/nehe/lesson02/
tiki/examples/nehe/lesson03/
tiki/examples/nehe/lesson04/
tiki/examples/nehe/lesson05/
tiki/examples/net/basic/
tiki/examples/net/chat/
tiki/examples/net/chatd/
tiki/examples/net/httpclient/
tiki/nds/tikiarm7/
Modified: tiki/dc/Makefile
===================================================================
--- tiki/dc/Makefile 2007-10-26 19:19:14 UTC (rev 516)
+++ tiki/dc/Makefile 2007-10-27 01:19:20 UTC (rev 517)
@@ -37,7 +37,6 @@
-x "*/.svn/*"
cd .. && \
zip -9ru dist/$(SVN_VERSION)/tiki-$(SVN_VERSION)-dc.zip \
- examples/TikiTest/tikitest.elf \
examples/console/TikiSnake/tikisnake.elf \
-x "*/.svn/*"
Modified: tiki/dc/src/init_shutdown.cpp
===================================================================
--- tiki/dc/src/init_shutdown.cpp 2007-10-26 19:19:14 UTC (rev 516)
+++ tiki/dc/src/init_shutdown.cpp 2007-10-27 01:19:20 UTC (rev 517)
@@ -11,7 +11,6 @@
#include "Tiki/tiki.h"
#include "Tiki/sound.h"
#include "Tiki/stream.h"
-#include "Tiki/plxcompat.h"
#include "Tiki/hid.h"
static pvr_init_params_t params = {
@@ -30,7 +29,6 @@
glKosInit();
snd_stream_init();
- GL::Plxcompat::plx_mat3d_init( 640, 480 );
Hid::init();
return true;
Modified: tiki/dc/src/platgl.cpp
===================================================================
--- tiki/dc/src/platgl.cpp 2007-10-26 19:19:14 UTC (rev 516)
+++ tiki/dc/src/platgl.cpp 2007-10-27 01:19:20 UTC (rev 517)
@@ -15,14 +15,26 @@
using namespace Tiki;
-float Tiki::GL::Frame::getFrameRate() {
+namespace Tiki {
+namespace GL {
+namespace Frame {
+
+float getFrameRate() {
pvr_stats_t stats;
pvr_get_stats( &stats );
return stats.frame_rate;
}
-void Tiki::GL::Frame::setFrameRateLimit( int rate ) {}
+void setFrameRateLimit( int rate ) {}
+Vector getScreenExtents() {
+ return Vector( 640.0f, 480.0f, 0.0f );
+}
+
+}
+}
+}
+
extern "C" {
void tiki_wait_if_needed() {
Modified: tiki/examples/Makefile
===================================================================
--- tiki/examples/Makefile 2007-10-26 19:19:14 UTC (rev 516)
+++ tiki/examples/Makefile 2007-10-27 01:19:20 UTC (rev 517)
@@ -1,5 +1,5 @@
-SUBDIRS = TikiTest console net nehe
+SUBDIRS = console net nehe
TIKI_DIR ?= $(CURDIR)/../
include $(TIKI_DIR)$(TIKI_PLAT)/Makefile.rules
Property changes on: tiki/examples/console/TikiSnake
___________________________________________________________________
Name: svn:ignore
- Debug
Release
*.user
*.nds
*.ds.gba
*.elf
+ Debug
Release
*.user
*.nds
*.ds.gba
*.elf
tikisnake
Modified: tiki/examples/console/TikiSnake/src/snake.cpp
===================================================================
--- tiki/examples/console/TikiSnake/src/snake.cpp 2007-10-26 19:19:14 UTC (rev 516)
+++ tiki/examples/console/TikiSnake/src/snake.cpp 2007-10-27 01:19:20 UTC (rev 517)
@@ -7,7 +7,6 @@
*/
#include <Tiki/tiki.h>
-#include <Tiki/plxcompat.h>
#include <Tiki/gl.h>
#include <Tiki/hid.h>
#include <Tiki/tikitime.h>
@@ -69,15 +68,17 @@
Hid::callbackReg( tkCallback, NULL );
//initialize the screen
- ConsoleText *ct = new ConsoleText( 80, 25, new Texture( "pc-ascii.png", true ) );
-
-#if TIKI_PLAT != TIKI_NDS
- ct->setSize( 640, 480 );
- ct->translate( Vector( 320, 240, 0 ) );
-#else
- ct->setSize( 256, 192);
- ct->translate( Vector( 128, 96, 0 ) );
-#endif
+#if TIKI_PLAT == TIKI_DC
+ RefPtr<Texture> cf = new Texture("/rd/pc-ascii.png", true);
+#else
+ RefPtr<Texture> cf = new Texture("pc-ascii.png", true);
+#endif
+ RefPtr<Console> ct = new Console( 80, 25, cf );
+
+ Vector screenExtents = Frame::getScreenExtents();
+ ct->setSize(screenExtents.x, screenExtents.y);
+ screenExtents *= 0.5f;
+ ct->setTranslate(screenExtents);
ct->setAutoScroll( 0 );
ct->setAutoWrap( 0 );
Property changes on: tiki/examples/nehe/lesson02
___________________________________________________________________
Name: svn:ignore
+ *.nds
*.ds.gba
nehe_lesson02
Modified: tiki/examples/nehe/lesson02/src/main.cpp
===================================================================
--- tiki/examples/nehe/lesson02/src/main.cpp 2007-10-26 19:19:14 UTC (rev 516)
+++ tiki/examples/nehe/lesson02/src/main.cpp 2007-10-27 01:19:20 UTC (rev 517)
@@ -5,17 +5,30 @@
#include <Tiki/tiki.h>
#include <Tiki/gl.h>
+#include <Tiki/hid.h>
using namespace Tiki;
using namespace Tiki::GL;
void DrawGLScene();
+// Tiki Specific
+volatile bool g_quitting = false;
+void tkCallback( const Hid::Event & evt, void * data ) {
+ if ( evt.type == Hid::Event::EvtQuit ) {
+ g_quitting = true;
+ }
+ else if (evt.type == Hid::Event::EvtKeypress && evt.key == Hid::Event::KeyEsc) {
+ g_quitting = true;
+ }
+}
+
int main(int argc, char *argv[])
{
Tiki::init(argc, argv);
+ Hid::callbackReg( tkCallback, NULL );
- while (1)
+ while (!g_quitting)
{
Frame::begin();
Property changes on: tiki/examples/nehe/lesson03
___________________________________________________________________
Name: svn:ignore
+ *.nds
*.ds.gba
nehe_lesson03
Modified: tiki/examples/nehe/lesson03/src/main.cpp
===================================================================
--- tiki/examples/nehe/lesson03/src/main.cpp 2007-10-26 19:19:14 UTC (rev 516)
+++ tiki/examples/nehe/lesson03/src/main.cpp 2007-10-27 01:19:20 UTC (rev 517)
@@ -5,17 +5,30 @@
#include <Tiki/tiki.h>
#include <Tiki/gl.h>
+#include <Tiki/hid.h>
using namespace Tiki;
using namespace Tiki::GL;
void DrawGLScene();
+// Tiki Specific
+volatile bool g_quitting = false;
+void tkCallback( const Hid::Event & evt, void * data ) {
+ if ( evt.type == Hid::Event::EvtQuit ) {
+ g_quitting = true;
+ }
+ else if (evt.type == Hid::Event::EvtKeypress && evt.key == Hid::Event::KeyEsc) {
+ g_quitting = true;
+ }
+}
+
int main(int argc, char *argv[])
{
Tiki::init(argc, argv);
+ Hid::callbackReg( tkCallback, NULL );
- while (1)
+ while (!g_quitting)
{
Frame::begin();
Frame::set3d();
Property changes on: tiki/examples/nehe/lesson04
___________________________________________________________________
Name: svn:ignore
- *.nds
*.ds.gba
+ *.nds
*.ds.gba
nehe_lesson04
Modified: tiki/examples/nehe/lesson04/src/main.cpp
===================================================================
--- tiki/examples/nehe/lesson04/src/main.cpp 2007-10-26 19:19:14 UTC (rev 516)
+++ tiki/examples/nehe/lesson04/src/main.cpp 2007-10-27 01:19:20 UTC (rev 517)
@@ -6,6 +6,7 @@
// include your ndslib
#include <Tiki/tiki.h>
#include <Tiki/gl.h>
+#include <Tiki/hid.h>
using namespace Tiki;
using namespace Tiki::GL;
@@ -16,14 +17,23 @@
float rtri; // Angle For The Triangle ( NEW )
float rquad; // Angle For The Quad ( NEW )
+// Tiki Specific
+volatile bool g_quitting = false;
+void tkCallback( const Hid::Event & evt, void * data ) {
+ if ( evt.type == Hid::Event::EvtQuit ) {
+ g_quitting = true;
+ }
+ else if (evt.type == Hid::Event::EvtKeypress && evt.key == Hid::Event::KeyEsc) {
+ g_quitting = true;
+ }
+}
+
int main(int argc, char *argv[])
{
Tiki::init(argc, argv);
+ Hid::callbackReg( tkCallback, NULL );
- // Set the current matrix to be the model matrix
- glMatrixMode(GL_MODELVIEW);
-
- while (1)
+ while (!g_quitting)
{
Frame::begin();
Frame::set3d();
Property changes on: tiki/examples/nehe/lesson05
___________________________________________________________________
Name: svn:ignore
- *.nds
*.ds.gba
+ *.nds
*.ds.gba
nehe_lesson05
Modified: tiki/examples/nehe/lesson05/src/main.cpp
===================================================================
--- tiki/examples/nehe/lesson05/src/main.cpp 2007-10-26 19:19:14 UTC (rev 516)
+++ tiki/examples/nehe/lesson05/src/main.cpp 2007-10-27 01:19:20 UTC (rev 517)
@@ -6,6 +6,7 @@
// include your ndslib
#include <Tiki/tiki.h>
#include <Tiki/gl.h>
+#include <Tiki/hid.h>
using namespace Tiki;
using namespace Tiki::GL;
@@ -15,11 +16,23 @@
float rtri; // Angle For The Triangle ( NEW )
float rquad; // Angle For The Quad ( NEW )
+// Tiki Specific
+volatile bool g_quitting = false;
+void tkCallback( const Hid::Event & evt, void * data ) {
+ if ( evt.type == Hid::Event::EvtQuit ) {
+ g_quitting = true;
+ }
+ else if (evt.type == Hid::Event::EvtKeypress && evt.key == Hid::Event::KeyEsc) {
+ g_quitting = true;
+ }
+}
+
int main(int argc, char *argv[])
{
- Tiki::init(argc, argv);
+ Tiki::init(argc, argv);
+ Hid::callbackReg( tkCallback, NULL );
- while (1)
+ while (!g_quitting)
{
Frame::begin();
Frame::set3d();
@@ -32,6 +45,7 @@
Frame::finish();
}
+ Tiki::shutdown();
return 0;
}
Property changes on: tiki/examples/net/basic
___________________________________________________________________
Name: svn:ignore
- Debug
Release
*.user
*.nds
*.ds.gba
+ Debug
Release
*.user
*.nds
*.ds.gba
basic
Property changes on: tiki/examples/net/chat
___________________________________________________________________
Name: svn:ignore
- Debug
Release
*.user
*.nds
*.ds.gba
+ Debug
Release
*.user
*.nds
*.ds.gba
chat
Property changes on: tiki/examples/net/chatd
___________________________________________________________________
Name: svn:ignore
- Debug
Release
*.user
*.nds
*.ds.gba
+ Debug
Release
*.user
*.nds
*.ds.gba
chatd
Property changes on: tiki/examples/net/httpclient
___________________________________________________________________
Name: svn:ignore
- Debug
Release
*.user
*.nds
*.ds.gba
+ Debug
Release
*.user
*.nds
*.ds.gba
httpclient
Modified: tiki/examples/net/httpclient/src/main.cpp
===================================================================
--- tiki/examples/net/httpclient/src/main.cpp 2007-10-26 19:19:14 UTC (rev 516)
+++ tiki/examples/net/httpclient/src/main.cpp 2007-10-27 01:19:20 UTC (rev 517)
@@ -54,16 +54,16 @@
#else
RefPtr<Texture> cf = new Texture("pc-ascii.png", true);
#endif
- ConsoleText *console = new ConsoleText(80, 25, cf);
-#if TIKI_PLAT != TIKI_NDS
- console->setSize(640, 480);
- console->setTranslate( Vector( 320, 240, 0 ) );
-#else
- console->setSize(255, 191);
- console->setTranslate( Vector( 128, 96, 0 ) );
-#endif
+ RefPtr<Console> console = new Console(80, 25, cf);
+
+ Vector screenExtents = Frame::getScreenExtents();
+ console->setSize(screenExtents.x, screenExtents.y);
+ screenExtents *= 0.5f;
+ console->setTranslate(screenExtents);
console->setAutoWrap( true );
console->setAutoScroll( true );
+ console->color( BLACK, GREY );
+ console->clear();
console->printf("Sending request: %s\n", request->getUrl().c_str());
Response *response = useragent->get(request);
Modified: tiki/include/Tiki/TikiAll.h
===================================================================
--- tiki/include/Tiki/TikiAll.h 2007-10-26 19:19:14 UTC (rev 516)
+++ tiki/include/Tiki/TikiAll.h 2007-10-27 01:19:20 UTC (rev 517)
@@ -25,7 +25,6 @@
#include <Tiki/matrix.h>
#include <Tiki/object.h>
#include <Tiki/oggvorbis.h>
-#include <Tiki/plxcompat.h>
#include <Tiki/refcnt.h>
#include <Tiki/scene.h>
#include <Tiki/sound.h>
Modified: tiki/include/Tiki/drawable.h
===================================================================
--- tiki/include/Tiki/drawable.h 2007-10-26 19:19:14 UTC (rev 516)
+++ tiki/include/Tiki/drawable.h 2007-10-27 01:19:20 UTC (rev 517)
@@ -179,14 +179,6 @@
}
protected:
- /// Setup a transform matrix, taking into account the
- /// parent relative rotation and scaling parameters. Pushes the old
- /// matrix onto the stack.
- void pushTransformMatrix() const;
-
- /// Pops the old matrix off the stack.
- void popTransformMatrix() const;
-
bool m_t_prelative; ///< Is translation parent-relative?
bool m_r_prelative; ///< Is rotation parent-relative?
bool m_s_prelative; ///< Is scaling parent-relative?
Modified: tiki/include/Tiki/drawables/console.h
===================================================================
--- tiki/include/Tiki/drawables/console.h 2007-10-26 19:19:14 UTC (rev 516)
+++ tiki/include/Tiki/drawables/console.h 2007-10-27 01:19:20 UTC (rev 517)
@@ -6,8 +6,8 @@
Copyright (C)2001 - 2006 Sam Steele
*/
-#ifndef __TIKI_DRW_CONSOLETEXT_H
-#define __TIKI_DRW_CONSOLETEXT_H
+#ifndef __TIKI_DRW_CONSOLE_H
+#define __TIKI_DRW_CONSOLE_H
#include "Tiki/gl.h"
#include "Tiki/drawable.h"
@@ -41,10 +41,10 @@
};
/** ConsoleText -- ConsoleText displays an array of fixed width characters. */
- class ConsoleText : public Drawable {
+ class Console : public Drawable {
public:
- ConsoleText(int cols, int rows, Texture * texture);
- virtual ~ConsoleText();
+ Console(int cols, int rows, Texture * texture);
+ virtual ~Console();
void setTexture(Texture * txr);
void setSize(float w, float h);
@@ -92,31 +92,31 @@
m_colorData[(y*m_cols) + x] = attr;
}
- ConsoleText& operator <<(std::string input) {
+ Console& operator <<(std::string input) {
printf("%s",input.c_str());
return *this;
}
- ConsoleText& operator <<(const char *input) {
+ Console& operator <<(const char *input) {
printf("%s",input);
return *this;
}
- ConsoleText& operator <<(int input) {
+ Console& operator <<(int input) {
printf("%i",input);
return *this;
}
- ConsoleText& operator <<(char input) {
+ Console& operator <<(char input) {
printf("%c",input);
return *this;
}
- ConsoleText& operator <<(float input) {
+ Console& operator <<(float input) {
printf("%f",input);
return *this;
Modified: tiki/include/Tiki/gl.h
===================================================================
--- tiki/include/Tiki/gl.h 2007-10-26 19:19:14 UTC (rev 516)
+++ tiki/include/Tiki/gl.h 2007-10-27 01:19:20 UTC (rev 517)
@@ -9,7 +9,9 @@
#ifndef __TIKI_GL_H
#define __TIKI_GL_H
+#include "Tiki/tiki.h"
#include "Tiki/glhdrs.h"
+#include "Tiki/vector.h"
namespace Tiki {
namespace GL {
@@ -38,6 +40,10 @@
// number of frames per second allowed. The default is 60.
void setFrameRateLimit( int rate );
+// Returns the max size of the screen in pixels
+// defaults to window size for platform.
+Tiki::Math::Vector getScreenExtents();
+
}
}
}
Deleted: tiki/include/Tiki/plxcompat.h
===================================================================
--- tiki/include/Tiki/plxcompat.h 2007-10-26 19:19:14 UTC (rev 516)
+++ tiki/include/Tiki/plxcompat.h 2007-10-27 01:19:20 UTC (rev 517)
@@ -1,808 +0,0 @@
-/*
- Tiki
-
- plxcompat.h
-
- Copyright (C)2002,2004 Dan Potter
- Copyright (C)2005 Cryptic Allusion, LLC
-*/
-
-#ifndef __TIKI_PLXCOMPAT_H
-#define __TIKI_PLXCOMPAT_H
-
-// These convenience methods are just an easier way to submit commands to
-// OpenGL. These are based on Parallax's prim.h, matrix.h, and sprite.h files,
-// and are mostly shortcut methods for porting old code.
-
-#include "Tiki/color.h"
-#include "Tiki/vector.h"
-#include "Tiki/matrix.h"
-#include "Tiki/glhdrs.h"
-
-namespace Tiki {
-namespace GL {
-
-class Texture;
-
-namespace Plxcompat {
-
-////////////////////////////////////////////////////////////////////////////////////
-// dr.h
-
-typedef void * plx_dr_state_t;
-static inline void plx_dr_init( plx_dr_state_t * t ) { }
-
-////////////////////////////////////////////////////////////////////////////////////
-// context.h
-
-/**
- Select a texture for use with the context system. If you delete the
- texture this has selected and then try to use contexts without
- setting another texture, you'll probably get some gross garbage
- on your output. Specify a NULL texture here to disable texturing.
- */
-void plx_cxt_texture( Texture * txr );
-
-/**
- Set the blending mode to use with the context. What's available is
- platform dependent, but we have defines for DC below.
- */
-void plx_cxt_blending( int src, int dst );
-// glBlendFunc
-
-/* Constants for blending modes */
-#define PLX_BLEND_ZERO GL_ZERO
-#define PLX_BLEND_ONE GL_ONE
-#define PLX_BLEND_DESTCOLOR GL_DST_COLOR
-#define PLX_BLEND_INVDESTCOLOR GL_ONE_MINUS_DST_COLOR
-#define PLX_BLEND_SRCALPHA GL_SRC_ALPHA
-#define PLX_BLEND_INVSRCALPHA GL_ONE_MINUS_SRC_ALPHA
-#define PLX_BLEND_DESTALPHA GL_DST_ALPHA
-#define PLX_BLEND_INVDESTALPHA GL_ONE_MINUS_DST_ALPHA
-
-/**
- Set the culling mode.
- */
-void plx_cxt_culling( int type );
-// glCullFace
-// glFrontFace
-
-/* Constants for culling modes */
-#define PLX_CULL_NONE GL_FRONT_AND_BACK /**< Show everything */
-#define PLX_CULL_CW GL_BACK /**< Remove clockwise polys */
-#define PLX_CULL_CCW GL_FRONT /**< Remove counter-clockwise polys */
-
-/**
- Submit the selected context for rendering.
- */
-static inline void plx_cxt_send( int /*foo*/ ) { }
-
-
-////////////////////////////////////////////////////////////////////////////////////
-// matrix.h
-
-// This isn't perfect but will catch most uses by client code.
-typedef Matrix matrix_t;
-typedef Vector vector_t;
-typedef Vector point_t;
-
-/* Copy the internal matrix out to a memory one */
-void mat_store( matrix_t *out );
-
-/* Copy a memory matrix into the internal one */
-void mat_load( matrix_t *out );
-
-/* Clear internal to an identity matrix */
-void mat_identity();
-
-/* "Apply" a matrix: multiply a matrix onto the "internal" one */
-void mat_apply( matrix_t *src );
-
-/* Transform zero or more sets of vectors using the current internal
- matrix. Each vector is three floats long. */
-void mat_transform( vector_t *invecs, vector_t *outvecs, int veccnt, int vecskip );
-
-/* Inline mat_transform which works on the three coordinates passed in;
- this works most efficiently if you've already got the three numbers
- (x,y,z) in the right registers (fr0,fr1,fr2). */
-void mat_trans_single( float & x, float & y, float & z );
-
-/* Same as above, but allows an input to and preserves the Z/W value */
-void mat_trans_single4( float & x, float & y, float & z, float & w );
-
-/* This is like mat_trans_single, but it leaves z/w instead of 1/w
- for the z component. */
-void mat_trans_single3( float & x, float & y, float & z );
-
-/* Transform vector, without any perspective division. */
-void mat_trans_nodiv( float & x, float & y, float & z, float & w );
-
-void mat_rotate_x( float r );
-void mat_rotate_y( float r );
-void mat_rotate_z( float r );
-void mat_rotate( float xr, float yr, float zr );
-void mat_translate( float x, float y, float z );
-void mat_scale( float x, float y, float z );
-
-static inline void plx_mat_store( matrix_t *out ) {
- mat_store( out );
-}
-static inline void plx_mat_load( matrix_t *out ) {
- mat_load( out );
-}
-static inline void plx_mat_identity() {
- mat_identity();
-}
-static inline void plx_mat_apply( matrix_t *src ) {
- mat_apply( src );
-}
-static inline void plx_mat_transform( vector_t *invecs, vector_t *outvecs, int veccnt, int vecskip ) {
- mat_transform( invecs, outvecs, veccnt, vecskip );
-}
-static inline void plx_mat_tfip_3d( float & x, float & y, float & z ) {
- mat_trans_single( x, y, z );
-}
-static inline void plx_mat_tfip_3dw( float & x, float & y, float & z, float & w ) {
- mat_trans_single4( x, y, z, w );
-}
-static inline void plx_mat_tfip_2d( float & x, float & y, float & z ) {
- mat_trans_single3( x, y, z );
-}
-
-static inline void plx_mat_rotate_x( float r ) {
- mat_rotate_x( r );
-}
-static inline void plx_mat_rotate_y( float r ) {
- mat_rotate_y( r );
-}
-static inline void plx_mat_rotate_z( float r ) {
- mat_rotate_z( r );
-}
-static inline void plx_mat_rotate( float xr, float yr, float zr ) {
- mat_rotate( xr, yr, zr );
-}
-static inline void plx_mat_translate( float x, float y, float z ) {
- mat_translate( x, y, z );
-}
-static inline void plx_mat_scale( float x, float y, float z ) {
- mat_scale( x, y, z );
-}
-
-/* The 3D matrix operations, somewhat simplified from KGL. All of these use
- the matrix regs, but do not primarily keep their values in them. To get
- the values out into the matrix regs (and usable) you'll want to set
- everything up and then call plx_mat3d_apply(). */
-
-/** Call before doing anything else, or after switching video
- modes to setup some basic parameters. */
-void plx_mat3d_init( int width, int height );
-
-/** Set which matrix we are working on */
-void plx_mat3d_mode( int mode );
-
-/* Constants for plx_mat3d_mode and plx_mat3d_apply */
-static const int PLX_MAT_PROJECTION = 0;
-static const int PLX_MAT_MODELVIEW = 1;
-static const int PLX_MAT_SCREENVIEW = 2;
-static const int PLX_MAT_SCRATCH = 3;
-static const int PLX_MAT_WORLDVIEW = 4;
-static const int PLX_MAT_COUNT = 5;
-
-/** Load an identity matrix */
-void plx_mat3d_identity();
-
-/** Load a raw matrix */
-void plx_mat3d_load( matrix_t * src );
-
-/** Save a raw matrix */
-void plx_mat3d_store( matrix_t * src );
-
-/** Setup viewport parameters */
-void plx_mat3d_viewport( int x1, int y1, int width, int height );
-
-void plx_mat3d_depthrange( float n, float f );
-
-/** Setup a perspective matrix */
-void plx_mat3d_perspective( float angle, float aspect, float znear, float zfar );
-
-/** Setup a frustum matrix */
-void plx_mat3d_frustum( float left, float right, float bottom, float top, float znear, float zfar );
-
-/** Push a matrix on the stack */
-void plx_mat3d_push();
-
-/** Pop a matrix from the stack and reload it */
-void plx_mat3d_pop();
-
-/** Reload a matrix from the top of the stack, but don't pop it */
-void plx_mat3d_peek();
-
-/** Rotation */
-void plx_mat3d_rotate( float angle, float x, float y, float z );
-
-/** Scaling */
-void plx_mat3d_scale( float x, float y, float z );
-
-/** Translation */
-void plx_mat3d_translate( float x, float y, float z );
-
-/** Do a camera "look at" */
-void plx_mat3d_lookat( const point_t * eye, const point_t * center, const vector_t * up );
-
-/** Apply a matrix from one of the matrix modes to the matrix regs */
-void plx_mat3d_apply( int mode );
-
-/** Manually apply a matrix */
-void plx_mat3d_apply_mat( matrix_t * src );
-
-/** Apply all the matrices for a normal 3D scene */
-void plx_mat3d_apply_all();
-
-
-////////////////////////////////////////////////////////////////////////////////////
-// prim.h
-
-static const int PLX_VERT = 0;
-static const int PLX_VERT_EOS = 1;
-
-typedef struct {
- int flags;
- float x, y, z;
- float u, v;
- uint32 argb;
- uint32 oargb; // no one is using this.. probably..
-}
-plx_vertex_t;
-
-// Incoming Z coords will be divided by this number, to ensure they
-// stay inside the ortho depth limits.
-static const float zscale = 1000.0f;
-#define PRIMPRE() do { \
- if (!stripping) \
- glBegin(GL_TRIANGLE_STRIP); \
-} while(0)
-
-#define PRIMPOST(flags) do { \
- if (flags == PLX_VERT_EOS) { \
- glEnd(); \
- stripping = false; \
- } else { \
- stripping = true; \
- } \
-} while(0)
-
-static inline void glColoru32( uint32 argb ) {
- uint8 r = ( uint8 ) ( ( argb >> 16 ) & 0xff );
- uint8 g = ( uint8 ) ( ( argb >> 8 ) & 0xff );
- uint8 b = ( uint8 ) ( ( argb >> 0 ) & 0xff );
-#if TIKI_PLAT != TIKI_NDS
- uint8 a = ( uint8 ) ( ( argb >> 24 ) & 0xff );
- glColor4ub( r, g, b, a );
-#else
- glColor3b( r, g, b );
-#endif
-}
-
-// This function will handle the meat of the Parallax emulation. Note
-// that it's invalid with this design to have cross-module vertex submission
-// within a single strip, but that generally shouldn't be happening anyway.
-static bool stripping = false;
-static inline void plx_prim( plx_vertex_t * vert, int size = 0 ) {
- PRIMPRE();
- glColoru32( vert->argb );
- glTexCoord2f( vert->u, vert->v );
- glVertex3f( vert->x, vert->y, vert->z / zscale );
- PRIMPOST( vert->flags );
-}
-
-void plx_xform( float & x, float & y, float & z );
-static inline void plx_xform( plx_vertex_t * vert ) {
- plx_xform( vert->x, vert->y, vert->z );
-}
-static inline uint32 plx_pack_color( float a, float r, float g, float b ) {
- return Color::pack( a, r, g, b );
-}
-
-
-/**
- This simple primitive function will fill a vertex structure for
- you from parameters. It uses floating point numbers for the color
- values and no u/v coordinates. The "vert" parameter may be a DR target.
- */
-static inline void plx_vert_fnn( plx_vertex_t * vert, int flags, float x, float y, float z,
- float a, float r, float g, float b ) {
- vert->flags = flags;
- vert->x = x;
- vert->y = y;
- vert->z = z;
- vert->u = vert->v = 0.0f;
- vert->argb = plx_pack_color( a, r, g, b );
- vert->oargb = 0;
-}
-
-/**
- Like plx_vert_fnn, but it takes a pre-packed integer color value.
- */
-static inline void plx_vert_inn( plx_vertex_t * vert, int flags, float x, float y, float z,
- uint32 color ) {
- vert->flags = flags;
- vert->x = x;
- vert->y = y;
- vert->z = z;
- vert->u = vert->v = 0.0f;
- vert->argb = color;
- vert->oargb = 0;
-}
-
-/**
- Like plx_vert_fnn, but it takes u/v texture coordinates as well.
- */
-static inline void plx_vert_ffn( plx_vertex_t * vert, int flags, float x, float y, float z,
- float a, float r, float g, float b, float u, float v ) {
- vert->flags = flags;
- vert->x = x;
- vert->y = y;
- vert->z = z;
- vert->u = u;
- vert->v = v;
- vert->argb = plx_pack_color( a, r, g, b );
- vert->oargb = 0;
-}
-
-/**
- Like plx_vert_fnn, but it takes u/v texture coordinates and a pre-packed integer
- color value.
- */
-static inline void plx_vert_ifn( plx_vertex_t * vert, int flags, float x, float y, float z,
- uint32 color, float u, float v ) {
- vert->flags = flags;
- vert->x = x;
- vert->y = y;
- vert->z = z;
- vert->u = u;
- vert->v = v;
- vert->argb = color;
- vert->oargb = 0;
-}
-
-/****************************************************** PLX_PRIM VERTEX ****/
-// In PX, these are pretty much all implemented as GL at the low level.
-
-/**
- Like plx_vert_fnp, but submits the point using plx_prim.
- */
-static inline void plx_vert_fnp( int flags, float x, float y, float z, float a, float r, float g, float b ) {
- PRIMPRE();
-#if TIKI_PLAT != TIKI_NDS
- glColor4f( r, g, b, a );
-#else
- glColor3f( r, g, b );
-#endif
- glVertex3f( x, y, z / zscale );
- PRIMPOST( flags );
-}
-
-/**
- Like plx_vert_inn, but submits the point using plx_prim.
- */
-static inline void plx_vert_inp( int flags, float x, float y, float z, uint32 color ) {
- PRIMPRE();
- glColoru32( color );
- glVertex3f( x, y, z / zscale );
- PRIMPOST( flags );
-}
-
-/**
- Like plx_vert_indm3, but uses plx_prim.
- */
-static inline void plx_vert_inpm3( int flags, float x, float y, float z, uint32 color ) {
- PRIMPRE();
- glColoru32( color );
- plx_xform( x, y, z );
- glVertex3f( x, y, z / zscale );
- PRIMPOST( flags );
-}
-
-/**
- Like plx_vert_ifpm3, but uses plx_prim.
- */
-static inline void plx_vert_ifpm3( int flags, float x, float y, float z, uint32 color, float u, float v ) {
- PRIMPRE();
- glColoru32( color );
- glTexCoord2f( u, v );
- glVertex3f( x, y, z / zscale );
- PRIMPOST( flags );
-}
-
-/**
- Like plx_vert_ffn, but submits the point using plx_prim.
- */
-static inline void plx_vert_ffp( int flags, float x, float y, float z,
- float a, float r, float g, float b, float u, float v ) {
- PRIMPRE();
-#if TIKI_PLAT != TIKI_NDS
- glColor4f( r, g, b, a );
-#else
- glColor3f( r, g, b );
-#endif
- glTexCoord2f( u, v );
- glVertex3f( x, y, z / zscale );
- PRIMPOST( flags );
-}
-
-/**
- Like plx_vert_ifn, but submits the point using plx_prim.
- */
-static inline void plx_vert_ifp( int flags, float x, float y, float z, uint32 color, float u, float v ) {
- PRIMPRE();
- glColoru32( color );
- glTexCoord2f( u, v );
- glVertex3f( x, y, z / zscale );
- PRIMPOST( flags );
-}
-
-/********************************************************* DR VERTEX ****/
-// In PX, these are just wrappers for the p versions.
-
-/**
- Like plx_vert_fnn, but submits the point using DR.
- */
-static inline void plx_vert_fnd( plx_dr_state_t * state, int flags, float x, float y, float z,
- float a, float r, float g, float b ) {
- plx_vert_fnp( flags, x, y, z, a, r, g, b );
-}
-
-/**
- Like plx_vert_inn, but submits the point using DR.
- */
-static inline void plx_vert_ind( plx_dr_state_t * state, int flags, float...
[truncated message content] |
|
From: <at...@us...> - 2007-10-27 02:10:45
|
Revision: 518
http://cadcdev.svn.sourceforge.net/cadcdev/?rev=518&view=rev
Author: atani
Date: 2007-10-26 19:10:42 -0700 (Fri, 26 Oct 2007)
Log Message:
-----------
* win32 projects for NeHe examples
* removed lingering ref to TikiTest
Modified Paths:
--------------
tiki/examples/nehe/lesson02/src/main.cpp
tiki/examples/nehe/lesson03/src/main.cpp
tiki/examples/nehe/lesson04/src/main.cpp
tiki/examples/nehe/lesson05/src/main.cpp
tiki/win32/src/init_shutdown.cpp
tiki/win32/src/platgl.cpp
tiki/win32/tiki.sln
Added Paths:
-----------
tiki/examples/nehe/lesson02/nehe02.vcproj
tiki/examples/nehe/lesson02/src/NeHe02.cpp
tiki/examples/nehe/lesson03/nehe03.vcproj
tiki/examples/nehe/lesson03/src/NeHe03.cpp
tiki/examples/nehe/lesson04/nehe04.vcproj
tiki/examples/nehe/lesson04/src/NeHe04.cpp
tiki/examples/nehe/lesson05/nehe05.vcproj
tiki/examples/nehe/lesson05/src/NeHe05.cpp
Property Changed:
----------------
tiki/examples/nehe/lesson02/
tiki/examples/nehe/lesson03/
tiki/examples/nehe/lesson04/
tiki/examples/nehe/lesson05/
Property changes on: tiki/examples/nehe/lesson02
___________________________________________________________________
Name: svn:ignore
- *.nds
*.ds.gba
nehe_lesson02
+ *.nds
*.ds.gba
nehe_lesson02
Release
*.user
Debug
Added: tiki/examples/nehe/lesson02/nehe02.vcproj
===================================================================
--- tiki/examples/nehe/lesson02/nehe02.vcproj (rev 0)
+++ tiki/examples/nehe/lesson02/nehe02.vcproj 2007-10-27 02:10:42 UTC (rev 518)
@@ -0,0 +1,205 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="NeHe02"
+ ProjectGUID="{088EA2EE-469C-4306-905F-CB4AE857504D}"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(ProjectDir)\..\..\..\win32\include;$(ProjectDir)\..\..\..\include;"C:\Program Files\OpenAL 1.1 SDK\include""
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;"
+ 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="gdi32.lib kernel32.lib user32.lib opengl32.lib glu32.lib comdlg32.lib ws2_32.lib"
+ LinkIncremental="2"
+ AdditionalLibraryDirectories="$(ProjectDir)\..\..\..\win32\Debug;"C:\Program Files\OpenAL 1.1 SDK\libs\Win32""
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="$(ProjectDir)\..\..\..\win32\include;$(ProjectDir)\..\..\..\include;"C:\Program Files\OpenAL 1.1 SDK\include""
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;"
+ RuntimeLibrary="0"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="gdi32.lib kernel32.lib user32.lib opengl32.lib glu32.lib comdlg32.lib ws2_32.lib"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories="$(ProjectDir)\..\..\..\win32\Release;C:\Program Files\OpenAL 1.1 SDK\libs\Win32"
+ IgnoreDefaultLibraryNames=""
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+ >
+ </Filter>
+ <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\main.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\src\NeHe02.cpp"
+ >
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
Added: tiki/examples/nehe/lesson02/src/NeHe02.cpp
===================================================================
--- tiki/examples/nehe/lesson02/src/NeHe02.cpp (rev 0)
+++ tiki/examples/nehe/lesson02/src/NeHe02.cpp 2007-10-27 02:10:42 UTC (rev 518)
@@ -0,0 +1,27 @@
+/*
+* Basic.cpp
+* Basic Network test
+*
+* Copyright (C)2007 Atani Software
+*
+*/
+
+#include <Tiki/tiki.h>
+#include <pch.h>
+
+#if TIKI_PLAT == TIKI_WIN32
+#include <windows.h>
+
+static char szAppName[] = "NeHe02";
+int APIENTRY WinMain( HINSTANCE hInst, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow )
+#else
+extern "C" int tiki_main( int argc, char *argv[] );
+int main( int argc, char *argv[] )
+#endif
+{
+#if TIKI_PLAT != TIKI_WIN32
+ return tiki_main( argc, argv );
+#else
+ return Tiki::DoMain( szAppName, hInst, hPrevInstance, lpCmdLine, nCmdShow );
+#endif
+}
Modified: tiki/examples/nehe/lesson02/src/main.cpp
===================================================================
--- tiki/examples/nehe/lesson02/src/main.cpp 2007-10-27 01:19:20 UTC (rev 517)
+++ tiki/examples/nehe/lesson02/src/main.cpp 2007-10-27 02:10:42 UTC (rev 518)
@@ -23,7 +23,7 @@
}
}
-int main(int argc, char *argv[])
+extern "C" int tiki_main(int argc, char *argv[])
{
Tiki::init(argc, argv);
Hid::callbackReg( tkCallback, NULL );
Property changes on: tiki/examples/nehe/lesson03
___________________________________________________________________
Name: svn:ignore
- *.nds
*.ds.gba
nehe_lesson03
+ *.nds
*.ds.gba
nehe_lesson03
Release
*.user
Debug
Added: tiki/examples/nehe/lesson03/nehe03.vcproj
===================================================================
--- tiki/examples/nehe/lesson03/nehe03.vcproj (rev 0)
+++ tiki/examples/nehe/lesson03/nehe03.vcproj 2007-10-27 02:10:42 UTC (rev 518)
@@ -0,0 +1,205 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="NeHe03"
+ ProjectGUID="{03954CA9-79FF-4A27-8A90-8984ABFA9307}"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(ProjectDir)\..\..\..\win32\include;$(ProjectDir)\..\..\..\include;"C:\Program Files\OpenAL 1.1 SDK\include""
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;"
+ 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="gdi32.lib kernel32.lib user32.lib opengl32.lib glu32.lib comdlg32.lib ws2_32.lib"
+ LinkIncremental="2"
+ AdditionalLibraryDirectories="$(ProjectDir)\..\..\..\win32\Debug;"C:\Program Files\OpenAL 1.1 SDK\libs\Win32""
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="$(ProjectDir)\..\..\..\win32\include;$(ProjectDir)\..\..\..\include;"C:\Program Files\OpenAL 1.1 SDK\include""
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;"
+ RuntimeLibrary="0"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="gdi32.lib kernel32.lib user32.lib opengl32.lib glu32.lib comdlg32.lib ws2_32.lib"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories="$(ProjectDir)\..\..\..\win32\Release;C:\Program Files\OpenAL 1.1 SDK\libs\Win32"
+ IgnoreDefaultLibraryNames=""
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+ >
+ </Filter>
+ <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\main.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\src\NeHe03.cpp"
+ >
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
Added: tiki/examples/nehe/lesson03/src/NeHe03.cpp
===================================================================
--- tiki/examples/nehe/lesson03/src/NeHe03.cpp (rev 0)
+++ tiki/examples/nehe/lesson03/src/NeHe03.cpp 2007-10-27 02:10:42 UTC (rev 518)
@@ -0,0 +1,27 @@
+/*
+* NeHe03.cpp
+* Entry point for NeHe03
+*
+* Copyright (C)2007 Atani Software
+*
+*/
+
+#include <Tiki/tiki.h>
+#include <pch.h>
+
+#if TIKI_PLAT == TIKI_WIN32
+#include <windows.h>
+
+static char szAppName[] = "NeHe03";
+int APIENTRY WinMain( HINSTANCE hInst, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow )
+#else
+extern "C" int tiki_main( int argc, char *argv[] );
+int main( int argc, char *argv[] )
+#endif
+{
+#if TIKI_PLAT != TIKI_WIN32
+ return tiki_main( argc, argv );
+#else
+ return Tiki::DoMain( szAppName, hInst, hPrevInstance, lpCmdLine, nCmdShow );
+#endif
+}
Modified: tiki/examples/nehe/lesson03/src/main.cpp
===================================================================
--- tiki/examples/nehe/lesson03/src/main.cpp 2007-10-27 01:19:20 UTC (rev 517)
+++ tiki/examples/nehe/lesson03/src/main.cpp 2007-10-27 02:10:42 UTC (rev 518)
@@ -1,5 +1,5 @@
/****************************************
- * NDS NeHe Lesson 01 *
+ * NDS NeHe Lesson 03 *
* Author: Dovoto *
****************************************/
@@ -23,7 +23,7 @@
}
}
-int main(int argc, char *argv[])
+extern "C" int tiki_main(int argc, char *argv[])
{
Tiki::init(argc, argv);
Hid::callbackReg( tkCallback, NULL );
Property changes on: tiki/examples/nehe/lesson04
___________________________________________________________________
Name: svn:ignore
- *.nds
*.ds.gba
nehe_lesson04
+ *.nds
*.ds.gba
nehe_lesson04
Release
*.user
Debug
Added: tiki/examples/nehe/lesson04/nehe04.vcproj
===================================================================
--- tiki/examples/nehe/lesson04/nehe04.vcproj (rev 0)
+++ tiki/examples/nehe/lesson04/nehe04.vcproj 2007-10-27 02:10:42 UTC (rev 518)
@@ -0,0 +1,205 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="NeHe04"
+ ProjectGUID="{7B823C96-860C-4578-95FF-1087A45AF1AA}"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(ProjectDir)\..\..\..\win32\include;$(ProjectDir)\..\..\..\include;"C:\Program Files\OpenAL 1.1 SDK\include""
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;"
+ 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="gdi32.lib kernel32.lib user32.lib opengl32.lib glu32.lib comdlg32.lib ws2_32.lib"
+ LinkIncremental="2"
+ AdditionalLibraryDirectories="$(ProjectDir)\..\..\..\win32\Debug;"C:\Program Files\OpenAL 1.1 SDK\libs\Win32""
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="$(ProjectDir)\..\..\..\win32\include;$(ProjectDir)\..\..\..\include;"C:\Program Files\OpenAL 1.1 SDK\include""
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;"
+ RuntimeLibrary="0"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="gdi32.lib kernel32.lib user32.lib opengl32.lib glu32.lib comdlg32.lib ws2_32.lib"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories="$(ProjectDir)\..\..\..\win32\Release;C:\Program Files\OpenAL 1.1 SDK\libs\Win32"
+ IgnoreDefaultLibraryNames=""
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+ >
+ </Filter>
+ <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\NeHe04.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\src\main.cpp"
+ >
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
Added: tiki/examples/nehe/lesson04/src/NeHe04.cpp
===================================================================
--- tiki/examples/nehe/lesson04/src/NeHe04.cpp (rev 0)
+++ tiki/examples/nehe/lesson04/src/NeHe04.cpp 2007-10-27 02:10:42 UTC (rev 518)
@@ -0,0 +1,27 @@
+/*
+* Basic.cpp
+* Basic Network test
+*
+* Copyright (C)2007 Atani Software
+*
+*/
+
+#include <Tiki/tiki.h>
+#include <pch.h>
+
+#if TIKI_PLAT == TIKI_WIN32
+#include <windows.h>
+
+static char szAppName[] = "NeHe04";
+int APIENTRY WinMain( HINSTANCE hInst, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow )
+#else
+extern "C" int tiki_main( int argc, char *argv[] );
+int main( int argc, char *argv[] )
+#endif
+{
+#if TIKI_PLAT != TIKI_WIN32
+ return tiki_main( argc, argv );
+#else
+ return Tiki::DoMain( szAppName, hInst, hPrevInstance, lpCmdLine, nCmdShow );
+#endif
+}
Modified: tiki/examples/nehe/lesson04/src/main.cpp
===================================================================
--- tiki/examples/nehe/lesson04/src/main.cpp 2007-10-27 01:19:20 UTC (rev 517)
+++ tiki/examples/nehe/lesson04/src/main.cpp 2007-10-27 02:10:42 UTC (rev 518)
@@ -28,7 +28,7 @@
}
}
-int main(int argc, char *argv[])
+extern "C" int tiki_main(int argc, char *argv[])
{
Tiki::init(argc, argv);
Hid::callbackReg( tkCallback, NULL );
Property changes on: tiki/examples/nehe/lesson05
___________________________________________________________________
Name: svn:ignore
- *.nds
*.ds.gba
nehe_lesson05
+ *.nds
*.ds.gba
nehe_lesson05
Release
*.user
Debug
Added: tiki/examples/nehe/lesson05/nehe05.vcproj
===================================================================
--- tiki/examples/nehe/lesson05/nehe05.vcproj (rev 0)
+++ tiki/examples/nehe/lesson05/nehe05.vcproj 2007-10-27 02:10:42 UTC (rev 518)
@@ -0,0 +1,205 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="NeHe05"
+ ProjectGUID="{7B823C96-860C-4578-95BB-1087A45AF1AA}"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(ProjectDir)\..\..\..\win32\include;$(ProjectDir)\..\..\..\include;"C:\Program Files\OpenAL 1.1 SDK\include""
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;"
+ 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="gdi32.lib kernel32.lib user32.lib opengl32.lib glu32.lib comdlg32.lib ws2_32.lib"
+ LinkIncremental="2"
+ AdditionalLibraryDirectories="$(ProjectDir)\..\..\..\win32\Debug;"C:\Program Files\OpenAL 1.1 SDK\libs\Win32""
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="$(ProjectDir)\..\..\..\win32\include;$(ProjectDir)\..\..\..\include;"C:\Program Files\OpenAL 1.1 SDK\include""
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;"
+ RuntimeLibrary="0"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="gdi32.lib kernel32.lib user32.lib opengl32.lib glu32.lib comdlg32.lib ws2_32.lib"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories="$(ProjectDir)\..\..\..\win32\Release;C:\Program Files\OpenAL 1.1 SDK\libs\Win32"
+ IgnoreDefaultLibraryNames=""
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+ >
+ </Filter>
+ <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\main.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\src\NeHe05.cpp"
+ >
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
Added: tiki/examples/nehe/lesson05/src/NeHe05.cpp
===================================================================
--- tiki/examples/nehe/lesson05/src/NeHe05.cpp (rev 0)
+++ tiki/examples/nehe/lesson05/src/NeHe05.cpp 2007-10-27 02:10:42 UTC (rev 518)
@@ -0,0 +1,27 @@
+/*
+* NeHe05.cpp
+* Entry point for NeHe05
+*
+* Copyright (C)2007 Atani Software
+*
+*/
+
+#include <Tiki/tiki.h>
+#include <pch.h>
+
+#if TIKI_PLAT == TIKI_WIN32
+#include <windows.h>
+
+static char szAppName[] = "NeHe05";
+int APIENTRY WinMain( HINSTANCE hInst, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow )
+#else
+extern "C" int tiki_main( int argc, char *argv[] );
+int main( int argc, char *argv[] )
+#endif
+{
+#if TIKI_PLAT != TIKI_WIN32
+ return tiki_main( argc, argv );
+#else
+ return Tiki::DoMain( szAppName, hInst, hPrevInstance, lpCmdLine, nCmdShow );
+#endif
+}
Modified: tiki/examples/nehe/lesson05/src/main.cpp
===================================================================
--- tiki/examples/nehe/lesson05/src/main.cpp 2007-10-27 01:19:20 UTC (rev 517)
+++ tiki/examples/nehe/lesson05/src/main.cpp 2007-10-27 02:10:42 UTC (rev 518)
@@ -27,7 +27,7 @@
}
}
-int main(int argc, char *argv[])
+extern "C" int tiki_main(int argc, char *argv[])
{
Tiki::init(argc, argv);
Hid::callbackReg( tkCallback, NULL );
Modified: tiki/win32/src/init_shutdown.cpp
===================================================================
--- tiki/win32/src/init_shutdown.cpp 2007-10-27 01:19:20 UTC (rev 517)
+++ tiki/win32/src/init_shutdown.cpp 2007-10-27 02:10:42 UTC (rev 518)
@@ -1,5 +1,6 @@
#include "pch.h"
+#include "Tiki/gl.h"
#include "Tiki/hid.h"
#include "Tiki/sound.h"
#include "Tiki/stream.h"
Modified: tiki/win32/src/platgl.cpp
===================================================================
--- tiki/win32/src/platgl.cpp 2007-10-27 01:19:20 UTC (rev 517)
+++ tiki/win32/src/platgl.cpp 2007-10-27 02:10:42 UTC (rev 518)
@@ -321,7 +321,7 @@
}
Vector getScreenExtents() {
- return Vector( 640.0f, 480.0f, 0.0f );
+ return Vector( static_cast<float>(m_targetW), static_cast<float>(m_targetH), 0.0f );
}
}
Modified: tiki/win32/tiki.sln
===================================================================
--- tiki/win32/tiki.sln 2007-10-27 01:19:20 UTC (rev 517)
+++ tiki/win32/tiki.sln 2007-10-27 02:10:42 UTC (rev 518)
@@ -3,11 +3,6 @@
# Visual C++ Express 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tiki", "tiki.vcproj", "{F2816CAC-B560-4ED9-8A73-9635F832943C}"
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TikiTest", "..\examples\TikiTest\TikiTest.vcproj", "{7B823C96-860C-4578-95BB-1087A45AF1AA}"
- ProjectSection(ProjectDependencies) = postProject
- {F2816CAC-B560-4ED9-8A73-9635F832943C} = {F2816CAC-B560-4ED9-8A73-9635F832943C}
- EndProjectSection
-EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TikiSnake", "..\examples\console\TikiSnake\TikiSnake.vcproj", "{FCAE4EF3-7B5D-4C0D-8793-4157F7D8709F}"
ProjectSection(ProjectDependencies) = postProject
{F2816CAC-B560-4ED9-8A73-9635F832943C} = {F2816CAC-B560-4ED9-8A73-9635F832943C}
@@ -33,6 +28,26 @@
{F2816CAC-B560-4ED9-8A73-9635F832943C} = {F2816CAC-B560-4ED9-8A73-9635F832943C}
EndProjectSection
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "NeHe02", "..\examples\nehe\lesson02\nehe02.vcproj", "{088EA2EE-469C-4306-905F-CB4AE857504D}"
+ ProjectSection(ProjectDependencies) = postProject
+ {F2816CAC-B560-4ED9-8A73-9635F832943C} = {F2816CAC-B560-4ED9-8A73-9635F832943C}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "NeHe03", "..\examples\nehe\lesson03\nehe03.vcproj", "{03954CA9-79FF-4A27-8A90-8984ABFA9307}"
+ ProjectSection(ProjectDependencies) = postProject
+ {F2816CAC-B560-4ED9-8A73-9635F832943C} = {F2816CAC-B560-4ED9-8A73-9635F832943C}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "NeHe04", "..\examples\nehe\lesson04\nehe04.vcproj", "{7B823C96-860C-4578-95FF-1087A45AF1AA}"
+ ProjectSection(ProjectDependencies) = postProject
+ {F2816CAC-B560-4ED9-8A73-9635F832943C} = {F281...
[truncated message content] |
|
From: <at...@us...> - 2007-10-28 18:38:49
|
Revision: 519
http://cadcdev.svn.sourceforge.net/cadcdev/?rev=519&view=rev
Author: atani
Date: 2007-10-28 11:38:46 -0700 (Sun, 28 Oct 2007)
Log Message:
-----------
Adding "events" example which is a stripped down version of the old TikiTest example.
Modified Paths:
--------------
tiki/examples/Makefile
tiki/win32/tiki.sln
Added Paths:
-----------
tiki/examples/events/
tiki/examples/events/English.lproj/
tiki/examples/events/English.lproj/InfoPlist.strings
tiki/examples/events/English.lproj/MainMenu.nib/
tiki/examples/events/English.lproj/MainMenu.nib/classes.nib
tiki/examples/events/English.lproj/MainMenu.nib/info.nib
tiki/examples/events/English.lproj/MainMenu.nib/objects.nib
tiki/examples/events/Info.plist
tiki/examples/events/Makefile
tiki/examples/events/events.cbp
tiki/examples/events/events.vcproj
tiki/examples/events/events.xcodeproj/
tiki/examples/events/events.xcodeproj/project.pbxproj
tiki/examples/events/events_Prefix.pch
tiki/examples/events/main.m
tiki/examples/events/src/
tiki/examples/events/src/Controller.h
tiki/examples/events/src/Controller.m
tiki/examples/events/src/TikiEvents.cpp
tiki/examples/events/src/test.cpp
tiki/examples/events/src/testobj.cpp
tiki/examples/events/src/testobj.h
tiki/examples/events/version.plist
Modified: tiki/examples/Makefile
===================================================================
--- tiki/examples/Makefile 2007-10-27 02:10:42 UTC (rev 518)
+++ tiki/examples/Makefile 2007-10-28 18:38:46 UTC (rev 519)
@@ -1,5 +1,5 @@
-SUBDIRS = console net nehe
+SUBDIRS = events console net nehe
TIKI_DIR ?= $(CURDIR)/../
include $(TIKI_DIR)$(TIKI_PLAT)/Makefile.rules
Property changes on: tiki/examples/events
___________________________________________________________________
Name: svn:ignore
+ Debug
*.user
Added: tiki/examples/events/English.lproj/InfoPlist.strings
===================================================================
(Binary files differ)
Property changes on: tiki/examples/events/English.lproj/InfoPlist.strings
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: tiki/examples/events/English.lproj/MainMenu.nib/classes.nib
===================================================================
--- tiki/examples/events/English.lproj/MainMenu.nib/classes.nib (rev 0)
+++ tiki/examples/events/English.lproj/MainMenu.nib/classes.nib 2007-10-28 18:38:46 UTC (rev 519)
@@ -0,0 +1,12 @@
+{
+ IBClasses = (
+ {
+ CLASS = Controller;
+ LANGUAGE = ObjC;
+ OUTLETS = {mainView = NSView; mainWindow = NSWindow; };
+ SUPERCLASS = NSObject;
+ },
+ {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }
+ );
+ IBVersion = 1;
+}
\ No newline at end of file
Added: tiki/examples/events/English.lproj/MainMenu.nib/info.nib
===================================================================
--- tiki/examples/events/English.lproj/MainMenu.nib/info.nib (rev 0)
+++ tiki/examples/events/English.lproj/MainMenu.nib/info.nib 2007-10-28 18:38:46 UTC (rev 519)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>IBDocumentLocation</key>
+ <string>87 99 356 240 0 0 1280 1002 </string>
+ <key>IBEditorPositions</key>
+ <dict>
+ <key>29</key>
+ <string>94 344 338 44 0 0 1280 1002 </string>
+ </dict>
+ <key>IBFramework Version</key>
+ <string>437.0</string>
+ <key>IBOpenObjects</key>
+ <array>
+ <integer>29</integer>
+ <integer>21</integer>
+ </array>
+ <key>IBSystem Version</key>
+ <string>8A428</string>
+</dict>
+</plist>
Added: tiki/examples/events/English.lproj/MainMenu.nib/objects.nib
===================================================================
(Binary files differ)
Property changes on: tiki/examples/events/English.lproj/MainMenu.nib/objects.nib
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: tiki/examples/events/Info.plist
===================================================================
--- tiki/examples/events/Info.plist (rev 0)
+++ tiki/examples/events/Info.plist 2007-10-28 18:38:46 UTC (rev 519)
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleExecutable</key>
+ <string>TikiEvents</string>
+ <key>CFBundleIconFile</key>
+ <string></string>
+ <key>CFBundleIdentifier</key>
+ <string>com.apple.myCocoaApp</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1.0</string>
+ <key>NSMainNibFile</key>
+ <string>MainMenu</string>
+ <key>NSPrincipalClass</key>
+ <string>NSApplication</string>
+</dict>
+</plist>
Added: tiki/examples/events/Makefile
===================================================================
--- tiki/examples/events/Makefile (rev 0)
+++ tiki/examples/events/Makefile 2007-10-28 18:38:46 UTC (rev 519)
@@ -0,0 +1,27 @@
+
+
+CFLAGS=-I$(TIKI_DIR)$(TIKI_PLAT)/include -I$(TIKI_DIR)include
+OBJS = $(patsubst %.cpp,%.o,$(wildcard src/*.cpp))
+
+ifeq ($(TIKI_PLAT),nds)
+NDS_CART_CODE ?= TKEV
+NDS_CART_ID ?= TK
+NDS_CART_NAME ?= TikiEvents
+NDS_CART_VERSION ?= 1
+endif
+
+all: tikievents
+tikievents: $(OBJS)
+ $(build_romdisk)
+ $(CXX) $(LDFLAGS) -L$(TIKI_DIR)$(TIKI_PLAT) -L$(TIKI_DIR)$(TIKI_PLAT)/lib $(OBJS) $(TIKI_BASE_LIBS) -o tikievents$(PLATFORM_BINARY_EXT) $(ROMDISK_OBJ)
+ $(post_build)
+
+clean:
+ -rm -f $(OBJS) tikievents$(PLATFORM_BINARY_EXT) $(ROMDISK_OBJ)
+ifeq ($(TIKI_PLAT),nds)
+ -rm -f tikievents.nds tikievents.ds.gba
+endif
+
+TIKI_DIR ?= $(CURDIR)/../../
+DEPSDIR=$(CURDIR)
+include $(TIKI_DIR)$(TIKI_PLAT)/Makefile.rules
Added: tiki/examples/events/events.cbp
===================================================================
--- tiki/examples/events/events.cbp (rev 0)
+++ tiki/examples/events/events.cbp 2007-10-28 18:38:46 UTC (rev 519)
@@ -0,0 +1,57 @@
+<?xml version="1.0"?>
+<!DOCTYPE CodeBlocks_project_file>
+<CodeBlocks_project_file>
+ <FileVersion major="1" minor="1"/>
+ <Project>
+ <Option title="TikiEvents"/>
+ <Option makefile="Makefile"/>
+ <Option makefile_is_custom="0"/>
+ <Option compiler="0"/>
+ <Build>
+ <Target title="default">
+ <Option output="tikievents.exe"/>
+ <Option working_dir="."/>
+ <Option object_output=".objs"/>
+ <Option deps_output=".deps"/>
+ <Option type="0"/>
+ <Option compiler="0"/>
+ <Option projectResourceIncludeDirsRelation="0"/>
+ </Target>
+ </Build>
+ <Compiler>
+ <Add directory="..\..\include"/>
+ <Add directory="..\..\win32\include"/>
+ </Compiler>
+ <Linker>
+ <Add library="gdi32"/>
+ <Add library="user32"/>
+ <Add library="kernel32"/>
+ <Add library="tiki"/>
+ <Add library="opengl32"/>
+ <Add library="alut"/>
+ <Add directory="..\..\win32"/>
+ <Add directory="C:\Program Files\OpenAL 1.1 SDK\libs\Win32"/>
+ </Linker>
+ <Unit filename="src\TikiEvents.cpp">
+ <Option compilerVar="CPP"/>
+ <Option objectName="TikiEvents.obj"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="src\test.cpp">
+ <Option compilerVar="CPP"/>
+ <Option objectName="test.obj"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="src\testobj.cpp">
+ <Option compilerVar="CPP"/>
+ <Option objectName="testobj.obj"/>
+ <Option target="default"/>
+ </Unit>
+ <Unit filename="src\testobj.h">
+ <Option compilerVar=""/>
+ <Option compile="0"/>
+ <Option link="0"/>
+ <Option target="default"/>
+ </Unit>
+ </Project>
+</CodeBlocks_project_file>
Added: tiki/examples/events/events.vcproj
===================================================================
--- tiki/examples/events/events.vcproj (rev 0)
+++ tiki/examples/events/events.vcproj 2007-10-28 18:38:46 UTC (rev 519)
@@ -0,0 +1,213 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="TikiEvents"
+ ProjectGUID="{16508E01-E2E1-47B1-9B3A-6991C0032E76}"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(ProjectDir)..\..\win32\include;$(ProjectDir)\..\..\include;"C:\Program Files\OpenAL 1.1 SDK\include""
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;"
+ 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="gdi32.lib kernel32.lib user32.lib opengl32.lib glu32.lib comdlg32.lib ws2_32.lib"
+ LinkIncremental="2"
+ AdditionalLibraryDirectories="$(ProjectDir)\..\..\win32\Debug;"C:\Program Files\OpenAL 1.1 SDK\libs\Win32""
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="$(ProjectDir)..\..\win32\include;$(ProjectDir)\..\..\include;"C:\Program Files\OpenAL 1.1 SDK\include""
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;"
+ RuntimeLibrary="0"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="gdi32.lib kernel32.lib user32.lib opengl32.lib glu32.lib comdlg32.lib ws2_32.lib"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories="$(ProjectDir)\..\..\win32\Release;C:\Program Files\OpenAL 1.1 SDK\libs\Win32"
+ IgnoreDefaultLibraryNames=""
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ <File
+ RelativePath=".\src\testobj.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+ >
+ </Filter>
+ <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\test.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\src\testobj.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\src\TikiEvents.cpp"
+ >
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
Added: tiki/examples/events/events.xcodeproj/project.pbxproj
===================================================================
--- tiki/examples/events/events.xcodeproj/project.pbxproj (rev 0)
+++ tiki/examples/events/events.xcodeproj/project.pbxproj 2007-10-28 18:38:46 UTC (rev 519)
@@ -0,0 +1,366 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 42;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ 8D11072A0486CEB800E47090 /* MainMenu.nib in Resources */ = {isa = PBXBuildFile; fileRef = 29B97318FDCFA39411CA2CEA /* MainMenu.nib */; };
+ 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; };
+ 8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; };
+ 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
+ C4332D17079B224F0025BF39 /* Tiki.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = C4F50D800799DE840001D0D0 /* Tiki.framework */; };
+ C47EB6A108366BE4009FA9BA /* testobj.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C47EB69F08366BE4009FA9BA /* testobj.cpp */; };
+ C4B588860794D44D004D22F2 /* test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C4B588850794D44D004D22F2 /* test.cpp */; };
+ C4F50D810799DE840001D0D0 /* Tiki.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C4F50D800799DE840001D0D0 /* Tiki.framework */; };
+ C4F50ECE0799E1350001D0D0 /* Controller.m in Sources */ = {isa = PBXBuildFile; fileRef = C4F50ECC0799E1350001D0D0 /* Controller.m */; };
+ C4F50EEF0799E5B40001D0D0 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C4F50EEE0799E5B40001D0D0 /* OpenGL.framework */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXCopyFilesBuildPhase section */
+ C4332D16079B22450025BF39 /* CopyFiles */ = {
+ isa = PBXCopyFilesBuildPhase;
+ buildActionMask = 2147483647;
+ dstPath = "";
+ dstSubfolderSpec = 10;
+ files = (
+ C4332D17079B224F0025BF39 /* Tiki.framework in CopyFiles */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXCopyFilesBuildPhase section */
+
+/* Begin PBXFileReference section */
+ 089C165DFE840E0CC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
+ 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
+ 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
+ 29B97319FDCFA39411CA2CEA /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/MainMenu.nib; sourceTree = "<group>"; };
+ 29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
+ 29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
+ 32CA4F630368D1EE00C91783 /* events_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = events_Prefix.pch; sourceTree = "<group>"; };
+ 8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
+ 8D1107320486CEB800E47090 /* TikiEvents.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TikiEvents.app; sourceTree = BUILT_PRODUCTS_DIR; };
+ C47EB69F08366BE4009FA9BA /* testobj.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = testobj.cpp; path = src/testobj.cpp; sourceTree = SOURCE_ROOT; };
+ C47EB6A008366BE4009FA9BA /* testobj.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = testobj.h; path = src/testobj.h; sourceTree = SOURCE_ROOT; };
+ C4B588850794D44D004D22F2 /* test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = test.cpp; path = src/test.cpp; sourceTree = "<group>"; };
+ C4F50D800799DE840001D0D0 /* Tiki.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Tiki.framework; path = ../../osx/build/Development/Tiki.framework; sourceTree = SOURCE_ROOT; };
+ C4F50ECB0799E1350001D0D0 /* Controller.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = Controller.h; path = src/Controller.h; sourceTree = SOURCE_ROOT; };
+ C4F50ECC0799E1350001D0D0 /* Controller.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = Controller.m; path = src/Controller.m; sourceTree = SOURCE_ROOT; };
+ C4F50EEE0799E5B40001D0D0 /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = /System/Library/Frameworks/OpenGL.framework; sourceTree = "<absolute>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 8D11072E0486CEB800E47090 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */,
+ C4F50D810799DE840001D0D0 /* Tiki.framework in Frameworks */,
+ C4F50EEF0799E5B40001D0D0 /* OpenGL.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 080E96DDFE201D6D7F000001 /* Classes */ = {
+ isa = PBXGroup;
+ children = (
+ C4F50ECB0799E1350001D0D0 /* Controller.h */,
+ C4F50ECC0799E1350001D0D0 /* Controller.m */,
+ C47EB6A008366BE4009FA9BA /* testobj.h */,
+ C47EB69F08366BE4009FA9BA /* testobj.cpp */,
+ C4B588850794D44D004D22F2 /* test.cpp */,
+ );
+ name = Classes;
+ sourceTree = "<group>";
+ };
+ 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ C4F50EEE0799E5B40001D0D0 /* OpenGL.framework */,
+ C4F50D800799DE840001D0D0 /* Tiki.framework */,
+ 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */,
+ );
+ name = "Linked Frameworks";
+ sourceTree = "<group>";
+ };
+ 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ 29B97325FDCFA39411CA2CEA /* Foundation.framework */,
+ 29B97324FDCFA39411CA2CEA /* AppKit.framework */,
+ );
+ name = "Other Frameworks";
+ sourceTree = "<group>";
+ };
+ 19C28FACFE9D520D11CA2CBB /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 8D1107320486CEB800E47090 /* TikiEvents.app */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+ 29B97314FDCFA39411CA2CEA /* TikiEvents */ = {
+ isa = PBXGroup;
+ children = (
+ 080E96DDFE201D6D7F000001 /* Classes */,
+ 29B97315FDCFA39411CA2CEA /* Other Sources */,
+ 29B97317FDCFA39411CA2CEA /* Resources */,
+ 29B97323FDCFA39411CA2CEA /* Frameworks */,
+ 19C28FACFE9D520D11CA2CBB /* Products */,
+ );
+ name = TikiEvents;
+ sourceTree = "<group>";
+ };
+ 29B97315FDCFA39411CA2CEA /* Other Sources */ = {
+ isa = PBXGroup;
+ children = (
+ 32CA4F630368D1EE00C91783 /* events_Prefix.pch */,
+ 29B97316FDCFA39411CA2CEA /* main.m */,
+ );
+ name = "Other Sources";
+ sourceTree = "<group>";
+ };
+ 29B97317FDCFA39411CA2CEA /* Resources */ = {
+ isa = PBXGroup;
+ children = (
+ 8D1107310486CEB800E47090 /* Info.plist */,
+ 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */,
+ 29B97318FDCFA39411CA2CEA /* MainMenu.nib */,
+ );
+ name = Resources;
+ sourceTree = "<group>";
+ };
+ 29B97323FDCFA39411CA2CEA /* Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */,
+ 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */,
+ );
+ name = Frameworks;
+ sourceTree = "<group>";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+ 8D1107260486CEB800E47090 /* TikiEvents */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 64FBB927092EA33F00427AD0 /* Build configuration list for PBXNativeTarget "TikiEvents" */;
+ buildPhases = (
+ 8D1107290486CEB800E47090 /* Resources */,
+ 8D11072C0486CEB800E47090 /* Sources */,
+ 8D11072E0486CEB800E47090 /* Frameworks */,
+ C4332D16079B22450025BF39 /* CopyFiles */,
+ C4332EE0079B242E0025BF39 /* ShellScript */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = TikiEvents;
+ productInstallPath = "$(HOME)/Applications";
+ productName = TikiEvents;
+ productReference = 8D1107320486CEB800E47090 /* TikiEvents.app */;
+ productType = "com.apple.product-type.application";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 29B97313FDCFA39411CA2CEA /* Project object */ = {
+ isa = PBXProject;
+ buildConfigurationList = 64FBB92B092EA33F00427AD0 /* Build configuration list for PBXProject "TikiEvents" */;
+ hasScannedForEncodings = 1;
+ mainGroup = 29B97314FDCFA39411CA2CEA /* TikiEvents */;
+ projectDirPath = "";
+ targets = (
+ 8D1107260486CEB800E47090 /* TikiEvents */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+ 8D1107290486CEB800E47090 /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 8D11072A0486CEB800E47090 /* MainMenu.nib in Resources */,
+ 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXShellScriptBuildPhase section */
+ C4332EE0079B242E0025BF39 /* ShellScript */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ );
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "# rm -rfv ${EXECUTABLE_FOLDER_PATH}/PrivateHeaders\n";
+ };
+/* End PBXShellScriptBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 8D11072C0486CEB800E47090 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 8D11072D0486CEB800E47090 /* main.m in Sources */,
+ C4B588860794D44D004D22F2 /* test.cpp in Sources */,
+ C4F50ECE0799E1350001D0D0 /* Controller.m in Sources */,
+ C47EB6A108366BE4009FA9BA /* testobj.cpp in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXVariantGroup section */
+ 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 089C165DFE840E0CC02AAC07 /* English */,
+ );
+ name = InfoPlist.strings;
+ sourceTree = "<group>";
+ };
+ 29B97318FDCFA39411CA2CEA /* MainMenu.nib */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 29B97319FDCFA39411CA2CEA /* English */,
+ );
+ name = MainMenu.nib;
+ sourceTree = "<group>";
+ };
+/* End PBXVariantGroup section */
+
+/* Begin XCBuildConfiguration section */
+ 64FBB928092EA33F00427AD0 /* Development */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ COPY_PHASE_STRIP = NO;
+ FRAMEWORK_SEARCH_PATHS = ../../osx/build/Development/;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_ENABLE_FIX_AND_CONTINUE = YES;
+ GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = events_Prefix.pch;
+ INFOPLIST_FILE = Info.plist;
+ INSTALL_PATH = "$(HOME)/Applications";
+ PREBINDING = NO;
+ PRODUCT_NAME = TikiEvents;
+ WRAPPER_EXTENSION = app;
+ ZERO_LINK = NO;
+ };
+ name = Development;
+ };
+ 64FBB929092EA33F00427AD0 /* Deployment */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ COPY_PHASE_STRIP = YES;
+ FRAMEWORK_SEARCH_PATHS = ../../osx/build/Deployment/;
+ GCC_ENABLE_FIX_AND_CONTINUE = NO;
+ GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = events_Prefix.pch;
+ INFOPLIST_FILE = Info.plist;
+ INSTALL_PATH = "$(HOME)/Applications";
+ PRODUCT_NAME = TikiEvents;
+ WRAPPER_EXTENSION = app;
+ ZERO_LINK = NO;
+ };
+ name = Deployment;
+ };
+ 64FBB92A092EA33F00427AD0 /* Default */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ FRAMEWORK_SEARCH_PATHS = ../../osx/build/Development/;
+ GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = events_Prefix.pch;
+ INFOPLIST_FILE = Info.plist;
+ INSTALL_PATH = "$(HOME)/Applications";
+ PRODUCT_NAME = TikiEvents;
+ WRAPPER_EXTENSION = app;
+ };
+ name = Default;
+ };
+ 64FBB92C092EA33F00427AD0 /* Development */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ HEADER_SEARCH_PATHS = (
+ ../../include,
+ ../../osx/include,
+ /sw/include,
+ ../../3rdparty/boost,
+ );
+ MACOSX_DEPLOYMENT_TARGET = 10.3;
+ SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
+ };
+ name = Development;
+ };
+ 64FBB92D092EA33F00427AD0 /* Deployment */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ HEADER_SEARCH_PATHS = (
+ ../../include,
+ ../../osx/include,
+ /sw/include,
+ ../../3rdparty/boost,
+ );
+ MACOSX_DEPLOYMENT_TARGET = 10.3;
+ SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
+ };
+ name = Deployment;
+ };
+ 64FBB92E092EA33F00427AD0 /* Default */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ HEADER_SEARCH_PATHS = (
+ ../../include,
+ ../../osx/include,
+ /sw/include,
+ ../../3rdparty/boost,
+ );
+ MACOSX_DEPLOYMENT_TARGET = 10.3;
+ SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
+ };
+ name = Default;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 64FBB927092EA33F00427AD0 /* Build configuration list for PBXNativeTarget "TikiEvents" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 64FBB928092EA33F00427AD0 /* Development */,
+ 64FBB929092EA33F00427AD0 /* Deployment */,
+ 64FBB92A092EA33F00427AD0 /* Default */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Default;
+ };
+ 64FBB92B092EA33F00427AD0 /* Build configuration list for PBXProject "TikiEvents" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 64FBB92C092EA33F00427AD0 /* Development */,
+ 64FBB92D092EA33F00427AD0 /* Deployment */,
+ 64FBB92E092EA33F00427AD0 /* Default */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Default;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 29B97313FDCFA39411CA2CEA /* Project object */;
+}
Added: tiki/examples/events/events_Prefix.pch
===================================================================
--- tiki/examples/events/events_Prefix.pch (rev 0)
+++ tiki/examples/events/events_Prefix.pch 2007-10-28 18:38:46 UTC (rev 519)
@@ -0,0 +1,7 @@
+//
+// Prefix header for all source files of the 'TikiTest' target in the 'TikiTest' project
+//
+
+#ifdef __OBJC__
+ #import <Cocoa/Cocoa.h>
+#endif
Added: tiki/examples/events/main.m
===================================================================
--- tiki/examples/events/main.m (rev 0)
+++ tiki/examples/events/main.m 2007-10-28 18:38:46 UTC (rev 519)
@@ -0,0 +1,14 @@
+//
+// main.m
+// TikiEvents
+//
+// Created by Dan Potter on 1/11/05.
+// Copyright Cryptic Allusion, LLC 2005. All rights reserved.
+//
+
+#import <Cocoa/Cocoa.h>
+
+int main(int argc, char *argv[])
+{
+ return NSApplicationMain(argc, (const char **) argv);
+}
Added: tiki/examples/events/src/Controller.h
===================================================================
--- tiki/examples/events/src/Controller.h (rev 0)
+++ tiki/examples/events/src/Controller.h 2007-10-28 18:38:46 UTC (rev 519)
@@ -0,0 +1,13 @@
+/* Controller */
+
+#import <Cocoa/Cocoa.h>
+#import <Tiki/TikiMain.h>
+
+@interface Controller : NSObject {
+ IBOutlet NSView *mainView;
+ IBOutlet NSWindow *mainWindow;
+
+ TikiMain * tm;
+ NSString * openFileName;
+}
+@end
Added: tiki/examples/events/src/Controller.m
===================================================================
--- tiki/examples/events/src/Controller.m (rev 0)
+++ tiki/examples/event...
[truncated message content] |