Compare commits

...

66 Commits

Author SHA1 Message Date
s_nakamoto
f93d5f9ffe automatically change displayed address whenever it receives anything,
added help and -? for daemon command line rpc commands,
only relay addr messages to 5 random nodes to save bandwidth,
started setting wtx.fFromMe flag,
trickle out tx inventory messages to protect privacy
 -- version 0.2.10

git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@81 1a98c847-1fd6-4fd8-948a-caf3550aa51b
2010-06-10 23:10:30 +00:00
s_nakamoto
2ca1758832 Dutch translation by Xunie (93% complete)
git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@80 1a98c847-1fd6-4fd8-948a-caf3550aa51b
2010-06-02 22:10:06 +00:00
s_nakamoto
1da44d2e96 Italian translation by Joozero
git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@79 1a98c847-1fd6-4fd8-948a-caf3550aa51b
2010-05-27 14:11:03 +00:00
s_nakamoto
42605ce8bc better prevention of inventory relaying during initial download,
message checksum between nodes with 0.2.9 or higher,
optimization level up from -O0 to -O2,
rpc functions: setlabel, getlabel, getaddressesbylabel, getreceivedbyaddress, getreceivedbylabel, listreceivedbyaddress, listreceivedbylabel
 -- version 0.2.9

git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@78 1a98c847-1fd6-4fd8-948a-caf3550aa51b
2010-05-26 00:05:26 +00:00
s_nakamoto
124baa4ccb build-osx.txt build instructions and makefile.osx from Laszlo
git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@77 1a98c847-1fd6-4fd8-948a-caf3550aa51b
2010-05-25 23:58:27 +00:00
s_nakamoto
2d98de1b3a Mac OS build fixes by laszlo
-- version 0.2.8

git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@76 1a98c847-1fd6-4fd8-948a-caf3550aa51b
2010-05-19 00:26:56 +00:00
s_nakamoto
966cca4bd4 misc
git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@75 1a98c847-1fd6-4fd8-948a-caf3550aa51b
2010-03-05 02:55:09 +00:00
s_nakamoto
2cffa7ce31 fixed runaway memory alloc bug on 64-bit in ParseString found by sirius-m
git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@74 1a98c847-1fd6-4fd8-948a-caf3550aa51b
2010-03-05 01:13:27 +00:00
s_nakamoto
d7d80a74d5 fix unsafe string handling in wxGetTranslation
git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@73 1a98c847-1fd6-4fd8-948a-caf3550aa51b
2010-02-28 15:00:32 +00:00
s_nakamoto
6557910ccf wx/utils.h and wx/clipbrd.h not needed on bitcoind wxbase build
git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@72 1a98c847-1fd6-4fd8-948a-caf3550aa51b
2010-02-26 16:09:43 +00:00
s_nakamoto
c2430126d7 GUI-less build target bitcoind that links to wxBase and shouldn't need GTK,
split init and shutdown from ui.cpp into init.cpp,
support wxUSE_GUI=0
-- version 0.2.7

git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@71 1a98c847-1fd6-4fd8-948a-caf3550aa51b
2010-02-25 21:55:27 +00:00
s_nakamoto
cb420a1dfc run as daemon without GUI,
hooked wxApp::Initialize to ignore gtk-init-check failure if no GUI,
fork to daemonize,
rpc getinfo, getconnectioncount, getbalance, getgenerate, setgenerate,
-- version 0.2.6

git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@70 1a98c847-1fd6-4fd8-948a-caf3550aa51b
2010-02-23 22:01:39 +00:00
s_nakamoto
0184604aaf transaction filter tabs instead of view->show generated
-- version 0.2.5

git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@69 1a98c847-1fd6-4fd8-948a-caf3550aa51b
2010-02-21 21:42:01 +00:00
s_nakamoto
75199de534 Address Book with tabs instead of separate Your Address book,
with live update of default address in main window, 
New... button on main window for creating new receiving address, 
made receiving address labels more visible, 
ask user before paying transaction fee, 
when sending to bitcoin address also use a bitcoin address for the change, 
added some event.Skip() to fix UI glitches 
-- version 0.2.4

git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@68 1a98c847-1fd6-4fd8-948a-caf3550aa51b
2010-02-20 21:59:59 +00:00
s_nakamoto
c6ab3cf6d9 safer wxGetTranslation wrapper
git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@67 1a98c847-1fd6-4fd8-948a-caf3550aa51b
2010-02-17 23:55:43 +00:00
s_nakamoto
e480659765 all builds are now with wxWidgets-2.9.0, we are now using UTF-8,
added support for language translation file locale/<lang>/LC_MESSAGES/bitcoin.mo 
-- version 0.2.2

git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@66 1a98c847-1fd6-4fd8-948a-caf3550aa51b
2010-02-17 17:22:01 +00:00
s_nakamoto
2b63e68bbf fix mingw makefile to use correct wxWidgets include,
this is the last version of makefile and makefile.vc for wxWidgets-2.8

git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@65 1a98c847-1fd6-4fd8-948a-caf3550aa51b
2010-02-15 20:36:55 +00:00
s_nakamoto
5253d1ab77 strip out unfinished product, review and market stuff,
enable _() instead of wxT() in uiproject.fbp so it uses wxGetTranslation for the wxFormBuilder generated part of the UI

git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@64 1a98c847-1fd6-4fd8-948a-caf3550aa51b
2010-02-15 04:03:07 +00:00
s_nakamoto
64a474a49b renamed a few rpc methods
git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@63 1a98c847-1fd6-4fd8-948a-caf3550aa51b
2010-02-14 22:27:13 +00:00
s_nakamoto
c4319e678f Workaround for bug on wxWidgets 2.9.0 Ubuntu 9.10 64-bit where first character of the hidden columns were displayed so status column had three numbers overprinted. Fixed by adding a leading space to the hidden columns. 64-bit compile with wxWidgets 2.9.0 seems to be fully working normally now.
git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@62 1a98c847-1fd6-4fd8-948a-caf3550aa51b
2010-02-14 00:08:27 +00:00
s_nakamoto
c85dfb148a updated build-unix.txt
git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@61 1a98c847-1fd6-4fd8-948a-caf3550aa51b
2010-02-13 02:09:07 +00:00
s_nakamoto
98500d70a8 command line and JSON-RPC first draft, requires Boost 1.35 or higher for boost::asio,
added SetBitcoinAddress and GetBitcoinAddress methods on CScript, 
critsect interlocks around mapAddressBook, 
added some random delays in tx broadcast to improve privacy, 
now compiles with MSVC 8.0

git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@60 1a98c847-1fd6-4fd8-948a-caf3550aa51b
2010-02-12 20:38:44 +00:00
s_nakamoto
fa9dbd6b62 better error message in check_type(), tell the types by name instead of by number
git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@59 1a98c847-1fd6-4fd8-948a-caf3550aa51b
2010-02-10 19:46:04 +00:00
s_nakamoto
75990a46a7 JSON Spirit library from http://www.codeproject.com/KB/recipes/JSON_Spirit.aspx, MIT license
git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@58 1a98c847-1fd6-4fd8-948a-caf3550aa51b
2010-02-10 19:41:22 +00:00
s_nakamoto
c41226d847 revert revision 56, going in different direction with boost::asio and JSON-RPC
git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@57 1a98c847-1fd6-4fd8-948a-caf3550aa51b
2010-02-10 19:33:04 +00:00
sirius-m
082e725b33 Added some basic IPC functionality using wxServer, wxClient and wxConnection.
Added the -blockamount command line option for an example of usage.


git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@56 1a98c847-1fd6-4fd8-948a-caf3550aa51b
2010-02-04 15:31:46 +00:00
s_nakamoto
53d508072b update fSpent flag on wallet transactions if they're seen spent in case copy of wallet.dat was used elsewhere or restored from backup,
better error dialog box if try to spend already spent coins, 
got rid of unused notebook with only one tab on main dialog, 
nicer looking About dialog, 
resize About dialog better on linux

git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@55 1a98c847-1fd6-4fd8-948a-caf3550aa51b
2010-02-03 22:58:40 +00:00
s_nakamoto
8be979d9ae now compiles on 64-bit Ubuntu Karmic with wxWidgets-2.9.0,
fixes for wxWidgets-2.9.0, 
added superfluous GetEventHandler()'s, 
there's still a bug on wx2.9.0 that the status number is mashed up for some reason otherwise seems to run fine

git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@54 1a98c847-1fd6-4fd8-948a-caf3550aa51b
2010-01-28 21:49:20 +00:00
s_nakamoto
cb0f89646f simplify AddAddress,
readcompactsize limit, 
fixed a 64-bit compile error in serialize.h, 
change status "# blocks" to "# confirmations" and widen the column.

git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@53 1a98c847-1fd6-4fd8-948a-caf3550aa51b
2010-01-28 00:31:00 +00:00
s_nakamoto
9a36562347 command line switch -noui
git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@52 1a98c847-1fd6-4fd8-948a-caf3550aa51b
2009-12-17 23:16:27 +00:00
s_nakamoto
312c2c42b6 a few header changes for freebsd from madhatter
git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@51 1a98c847-1fd6-4fd8-948a-caf3550aa51b
2009-12-17 18:15:50 +00:00
s_nakamoto
e2c2648c14 filter out duplicate getblocks and don't relay inv messages during initial block download -- 0.2 rc2
git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@49 1a98c847-1fd6-4fd8-948a-caf3550aa51b
2009-12-14 02:12:01 +00:00
s_nakamoto
adb50ffe32 misc
git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@48 1a98c847-1fd6-4fd8-948a-caf3550aa51b
2009-12-13 02:34:45 +00:00
s_nakamoto
e899779450 restrict file permissions on linux to the user only
git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@47 1a98c847-1fd6-4fd8-948a-caf3550aa51b
2009-12-13 02:13:43 +00:00
s_nakamoto
e39bc50eb4 misc exit code, updated setup.nsi
git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@46 1a98c847-1fd6-4fd8-948a-caf3550aa51b
2009-12-13 00:13:16 +00:00
s_nakamoto
651d335569 misc
git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@45 1a98c847-1fd6-4fd8-948a-caf3550aa51b
2009-12-11 17:19:51 +00:00
s_nakamoto
4ea3f3da1a retry IRC if name in use,
resize to fit ubuntu's giant default font, 
scroll debug.log, 
pause gen during initial block download

git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@44 1a98c847-1fd6-4fd8-948a-caf3550aa51b
2009-12-11 16:49:21 +00:00
s_nakamoto
b075bbf986 misc
git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@43 1a98c847-1fd6-4fd8-948a-caf3550aa51b
2009-12-06 00:38:11 +00:00
s_nakamoto
107d9e288d fix transaction fee bug in CreateTransaction, higher size cutoff for free transactions in GetMinFee
git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@42 1a98c847-1fd6-4fd8-948a-caf3550aa51b
2009-12-06 00:29:09 +00:00
s_nakamoto
52f4cb4859 minor fix to batched initial download in case requester has more than 500 block non-main branch
git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@41 1a98c847-1fd6-4fd8-948a-caf3550aa51b
2009-11-24 21:04:50 +00:00
s_nakamoto
c5c7911dab bugfix Db::open/close and zombie sockets bugs fix double-close of socket handle,
keep databases open,
close db cursors,
initial block download in batches of 500 blocks,
fix misc warnings,
subver linux-test8

git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@40 1a98c847-1fd6-4fd8-948a-caf3550aa51b
2009-11-18 19:19:41 +00:00
s_nakamoto
b349e3dca8 misc compile error
git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@39 1a98c847-1fd6-4fd8-948a-caf3550aa51b
2009-11-14 18:04:08 +00:00
s_nakamoto
70e79525c9 monitor ThreadSocketHandler and terminate and restart if hung, convert _beginthread to CreateThread wrapper, disconnect inactive connections, ping, break up long messages to speed up initial download, better priorities for initiating connections, track how many nodes have requested our blocks and transactions, status #/offline and warning message on unsent blocks, minimize on close as separate option -- linux-test5
git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@38 1a98c847-1fd6-4fd8-948a-caf3550aa51b
2009-11-13 01:23:08 +00:00
s_nakamoto
956468c29a Get local host IP on Linux, Shutdown() a little cleaner -- linux-0.1.6-test1 waypoint
git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@37 1a98c847-1fd6-4fd8-948a-caf3550aa51b
2009-11-08 04:24:52 +00:00
s_nakamoto
b4e235f9f2 ui tweaks, multiple xpm icon sizes
git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@36 1a98c847-1fd6-4fd8-948a-caf3550aa51b
2009-11-07 18:51:41 +00:00
s_nakamoto
8b4cefd324 UI tweaks, use BindListenPort to detect instance already running, setsockopt(SO_REUSEADDR) so can bind during TIME_WAIT after exit and restart
git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@35 1a98c847-1fd6-4fd8-948a-caf3550aa51b
2009-11-07 05:05:03 +00:00
s_nakamoto
8acda009d9 UIThreadCall, ThreadSafeMessageBox
git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@34 1a98c847-1fd6-4fd8-948a-caf3550aa51b
2009-11-06 18:53:26 +00:00
s_nakamoto
300d4608f2 got rid of CheckForShutdown, replaced some thread-unsafe wxWidgets calls, Linux fixes, socket send MSG_NOSIGNAL, bind INADDR_ANY, works reliably on Linux now except if wxMessageBox is used in a thread other than the GUI thread
git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@33 1a98c847-1fd6-4fd8-948a-caf3550aa51b
2009-11-06 05:50:05 +00:00
s_nakamoto
e4c05d3177 unix build merged in, bitmap resources from xpm instead of rc, better addr relay, better selection of addrs by time last seen for faster connect
git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@32 1a98c847-1fd6-4fd8-948a-caf3550aa51b
2009-11-05 04:41:36 +00:00
s_nakamoto
b7362c07ae renamed build.txt to build-msw.txt
git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@28 1a98c847-1fd6-4fd8-948a-caf3550aa51b
2009-11-04 04:58:46 +00:00
s_nakamoto
4ac57f013e move debug.log and db.log to data dir, portable GetDataDir, optimize GetBalance, fix repaint bogdown, -addnode and -? switches
git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@25 1a98c847-1fd6-4fd8-948a-caf3550aa51b
2009-11-01 01:16:51 +00:00
sirius-m
5750932cdf added wx/stdpaths.h
git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@24 1a98c847-1fd6-4fd8-948a-caf3550aa51b
2009-10-31 09:52:24 +00:00
sirius-m
fe9f3d626d Linux alternatives for the Windows headers and PerformanceCounter. Some typedefs and #defines for the Linux build. Fixed GetDataDir.
git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@23 1a98c847-1fd6-4fd8-948a-caf3550aa51b
2009-10-31 09:11:43 +00:00
s_nakamoto
32d490313b make CheckDiskSpace portable
git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@22 1a98c847-1fd6-4fd8-948a-caf3550aa51b
2009-10-30 00:57:05 +00:00
sirius-m
a0c17c03eb setup script removes startup shortcut and runs with highest exec level
git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@21 1a98c847-1fd6-4fd8-948a-caf3550aa51b
2009-10-30 00:45:35 +00:00
s_nakamoto
e8474beb6f better wallet.dat flush, consolidated QueryPerformanceCounter, PRI64d printf portability
git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@20 1a98c847-1fd6-4fd8-948a-caf3550aa51b
2009-10-29 20:10:46 +00:00
s_nakamoto
dc73b326f9 CCriticalSection using wxWidgets instead of Windows OS calls
git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@19 1a98c847-1fd6-4fd8-948a-caf3550aa51b
2009-10-29 05:55:56 +00:00
s_nakamoto
dd519206a6 addr relaying fixes, proxy option and privacy patches, detect connect to self, non-final tx locktime changes, fix hide unconfirmed generated
git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@18 1a98c847-1fd6-4fd8-948a-caf3550aa51b
2009-10-29 02:52:48 +00:00
s_nakamoto
fa2a0338d3 fix display of new generated coins, fix assertion in bitcoinminer
git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@17 1a98c847-1fd6-4fd8-948a-caf3550aa51b
2009-10-25 04:35:01 +00:00
sirius-m
e39dfe8ea6 Removed autorun regkey creation
git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@16 1a98c847-1fd6-4fd8-948a-caf3550aa51b
2009-10-24 16:50:39 +00:00
s_nakamoto
99cef996c7 flush wallet.dat, multi-proc, reorg options, revert to startup folder shortcut
git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@15 1a98c847-1fd6-4fd8-948a-caf3550aa51b
2009-10-21 01:08:05 +00:00
sirius-m
0cc05617d1 Fixed the installer script and made the autostart registry based.
git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@14 1a98c847-1fd6-4fd8-948a-caf3550aa51b
2009-10-04 11:38:29 +00:00
sirius-m
661f878002 Added NSIS installer generation script
git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@13 1a98c847-1fd6-4fd8-948a-caf3550aa51b
2009-10-03 17:02:59 +00:00
sirius-m
429187c6a8 Startup folder shortcut opens the program minimized. Restoring a minimized-to-tray window works correctly.
git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@12 1a98c847-1fd6-4fd8-948a-caf3550aa51b
2009-10-03 11:52:21 +00:00
sirius-m
6d97df0e99 startup shortcut works
git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@11 1a98c847-1fd6-4fd8-948a-caf3550aa51b
2009-10-02 10:14:05 +00:00
sirius-m
dba0fd9b6a tray icon + ask before closing
git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@10 1a98c847-1fd6-4fd8-948a-caf3550aa51b
2009-09-24 04:09:56 +00:00
71 changed files with 16912 additions and 14075 deletions

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2009 Satoshi Nakamoto
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Distributed under the MIT/X11 software license, see the accompanying
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
@@ -64,12 +64,6 @@ public:
}
}
explicit CBigNum(const std::string& str)
{
BN_init(this);
SetHex(str);
}
CBigNum& operator=(const CBigNum& b)
{
if (!BN_copy(this, &b))
@@ -309,6 +303,37 @@ public:
*this = 0 - *this;
}
std::string ToString(int nBase=10) const
{
CAutoBN_CTX pctx;
CBigNum bnBase = nBase;
CBigNum bn0 = 0;
string str;
CBigNum bn = *this;
BN_set_negative(&bn, false);
CBigNum dv;
CBigNum rem;
if (BN_cmp(&bn, &bn0) == 0)
return "0";
while (BN_cmp(&bn, &bn0) > 0)
{
if (!BN_div(&dv, &rem, &bn, &bnBase, pctx))
throw bignum_error("CBigNum::ToString() : BN_div failed");
bn = dv;
unsigned int c = rem.getulong();
str += "0123456789abcdef"[c];
}
if (BN_is_negative(this))
str += "-";
reverse(str.begin(), str.end());
return str;
}
std::string GetHex() const
{
return ToString(16);
}
unsigned int GetSerializeSize(int nType=0, int nVersion=VERSION) const
{
return ::GetSerializeSize(getvch(), nType, nVersion);
@@ -376,6 +401,7 @@ public:
CBigNum& operator>>=(unsigned int shift)
{
// Note: BN_rshift segfaults on 64-bit ubuntu 9.10 if 2^shift is greater than the number
if (!BN_rshift(this, this, shift))
throw bignum_error("CBigNum:operator>>= : BN_rshift failed");
return *this;
@@ -485,6 +511,7 @@ inline const CBigNum operator<<(const CBigNum& a, unsigned int shift)
inline const CBigNum operator>>(const CBigNum& a, unsigned int shift)
{
CBigNum r;
// Note: BN_rshift segfaults on 64-bit ubuntu 9.10 if 2^shift is greater than the number
if (!BN_rshift(&r, &a, shift))
throw bignum_error("CBigNum:operator>> : BN_rshift failed");
return r;

2
bugs.txt Normal file
View File

@@ -0,0 +1,2 @@
Known bugs:
- Window flickers when blocks are added (problem with repainting?)

116
build-msw.txt Normal file
View File

@@ -0,0 +1,116 @@
Bitcoin v0.2.0 BETA
Copyright (c) 2009-2010 Satoshi Nakamoto
Distributed under the MIT/X11 software license, see the accompanying
file license.txt or http://www.opensource.org/licenses/mit-license.php.
This product includes software developed by the OpenSSL Project for use in
the OpenSSL Toolkit (http://www.openssl.org/). This product includes
cryptographic software written by Eric Young (eay@cryptsoft.com).
WINDOWS BUILD NOTES
===================
Compilers Supported
-------------------
MinGW GCC (recommended)
MSVC 6.0 SP6: You'll need Boost version 1.34 because they dropped support
for MSVC 6.0 after that. However, they didn't add Asio until 1.35.
You should still be able to build with MSVC 6.0 by adding Asio to 1.34 by
unpacking boost_asio_*.zip into the boost directory:
http://sourceforge.net/projects/asio/files/asio
MSVC 8.0 (2005) SP1 has been tested. Note: MSVC 7.0 and up have a habit of
linking to runtime DLLs that are not installed on XP by default.
Dependencies
------------
Libraries you need to download separately and build:
default path download
wxWidgets-2.9 \wxwidgets http://www.wxwidgets.org/downloads/
OpenSSL \openssl http://www.openssl.org/source/
Berkeley DB \db http://www.oracle.com/technology/software/products/berkeley-db/index.html
Boost \boost http://www.boost.org/users/download/
Their licenses:
wxWidgets LGPL 2.1 with very liberal exceptions
OpenSSL Old BSD license with the problematic advertising requirement
Berkeley DB New BSD license with additional requirement that linked software must be free open source
Boost MIT-like license
Versions used in this release:
MinGW GCC 3.4.5
wxWidgets 2.9.0
OpenSSL 0.9.8k
Berkeley DB 4.7.25.NC
Boost 1.42.1
Notes
-----
The UI layout is edited with wxFormBuilder. The project file is
uiproject.fbp. It generates uibase.cpp and uibase.h, which define base
classes that do the rote work of constructing all the UI elements.
The release is built with GCC and then "strip bitcoin.exe" to strip the debug
symbols, which reduces the executable size by about 90%.
wxWidgets
---------
cd \wxwidgets\build\msw
make -f makefile.gcc
or
nmake -f makefile.vc
OpenSSL
-------
Bitcoin does not use any encryption. If you want to do a no-everything
build of OpenSSL to exclude encryption routines, a few patches are required.
(instructions for OpenSSL v0.9.8k)
Edit engines\e_gmp.c and engines\e_capi.c and add this #ifndef around
the openssl/rsa.h include:
#ifndef OPENSSL_NO_RSA
#include <openssl/rsa.h>
#endif
Edit ms\mingw32.bat and replace the Configure line's parameters with this
no-everything list. You have to put this in the batch file because batch
files can't take more than nine command line parameters.
perl Configure mingw threads no-rc2 no-rc4 no-rc5 no-idea no-des no-bf no-cast no-aes no-camellia no-seed no-rsa no-dh
Also REM out the following line in ms\mingw32.bat after the mingw32-make
line. The build fails after it's already finished building libeay32, which
is all we care about, but the failure aborts the script before it runs
dllwrap to generate libeay32.dll.
REM if errorlevel 1 goto end
Build
cd \openssl
ms\mingw32.bat
If you want to use it with MSVC, generate the .lib file
lib /machine:i386 /def:ms\libeay32.def /out:out\libeay32.lib
Berkeley DB
-----------
Using MinGW and MSYS:
cd \db\build_unix
sh ../dist/configure --enable-mingw --enable-cxx
make
Boost
-----
download bjam.exe from
http://sourceforge.net/project/showfiles.php?group_id=7586&package_id=72941
cd \boost
bjam toolset=gcc --build-type=complete stage
or
bjam toolset=msvc --build-type=complete stage

209
build-osx.txt Normal file
View File

@@ -0,0 +1,209 @@
Mac OS X build instructions
Laszlo Hanyecz (solar@heliacal.net)
Tested on 10.5 and 10.6 intel. PPC is not supported because it's big-endian.
All of the commands should be executed in Terminal.app.. it's in
/Applications/Utilities
You need to install XCode with all the options checked so that the compiler
and everything is available in /usr not just /Developer
I think it comes on the DVD but you can get the current version from
http://developer.apple.com
1. Pick a directory to work inside.. something like ~/bitcoin works. The
structure I use looks like this:
(~ is your home directory)
~/bitcoin
~/bitcoin/trunk # source code
~/bitcoin/deps # dependencies.. like libraries and headers needed to compile
~/bitcoin/Bitcoin.app # the application bundle where you can run the app
Just execute: mkdir ~/bitcoin
This will create the top dir for you..
WARNING: do not use the ~ notation with the configure scripts.. use the full
name of the directory, for example /Users/james/bitcoin/deps for a user named
'james'. In my examples I am using 'macosuser' so make sure you change that.
2. Check out the trunk version of the bitcoin code from subversion:
cd ~/bitcoin
svn checkout https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk
This will make ~/bitcoin/trunk for you with all the files from subversion.
3. Get and build the dependencies
Boost
-----
Download from http://www.boost.org/users/download/
I'm assuming it ended up in ~/Downloads..
mkdir ~/bitcoin/deps
cd ~/bitcoin/deps
tar xvjf ~/Downloads/boost_1_42_0.tar.bz2
cd boost_1_42_0
./bootstrap.sh
./bjam architecture=combined address-model=32_64 macosx-version=10.6 macosx-version-min=10.5 link=static runtime-link=static --toolset=darwin --prefix=/Users/macosuser/bitcoin/deps install
This part takes a while.. use your judgement and fix it if something doesn't
build for some reason.
Change the prefix to whatever your directory is (my username in this example
is macosuser). I'm also running on 10.6 so i have macosx-version=10.6 change
to 10.5 if you're using leopard.
This is what my output looked like at the end:
...failed updating 2 targets...
...skipped 144 targets...
...updated 8074 targets...
OpenSSL
-------
Download from http://www.openssl.org/source/
We would like to build this as a 32 bit/64 bit library so we actually build it
2 times and join it together here.. If you downloaded with safari it already
uncompressed it so it will just be a tar not a tar.gz
cd ~/bitcoin/deps
tar xvf ~/Downloads/openssl-1.0.0.tar
mv openssl-1.0.0 openssl-1.0.0-i386
tar xvf ~/Downloads/openssl-1.0.0.tar
mv openssl-1.0.0 openssl-1.0.0-x86_64
# build i386 (32 bit intel) binary
cd openssl-1.0.0-i386
./Configure --prefix=/Users/macosuser/bitcoin/deps --openssldir=/Users/macosuser/deps/openssl darwin-i386-cc && make
make install # only do this on one of the architectures, to install the headers
cd ..
# build x86_64 (64 bit intel) binary
cd openssl-1.0.0-x86_64
./Configure --prefix=/Users/macosuser/bitcoin/deps --openssldir=/Users/macosuser/deps/openssl darwin64-x86_64-cc && make
cd ..
# combine the libs
cd ~/bitcoin/deps
lipo -arch i386 openssl-1.0.0-i386/libcrypto.a -arch x86_64 openssl-1.0.0-x86_64/libcrypto.a -o lib/libcrypto.a -create
lipo -arch i386 openssl-1.0.0-i386/libssl.a -arch x86_64 openssl-1.0.0-x86_64/libssl.a -o lib/libssl.a -create
Verify your binaries
file lib/libcrypto.a
output should look like this:
ib/libcrypto.a: Mach-O universal binary with 2 architectures
lib/libcrypto.a (for architecture i386): current ar archive random library
lib/libcrypto.a (for architecture x86_64): current ar archive random library
Berkeley DB
-----------
Download from http://freshmeat.net/projects/berkeleydb/
cd ~/bitcoin/deps
tar xvf ~/Downloads/db-4.8.26.tar
cd db-4.8.26/build_unix
../dist/configure --prefix=/Users/macosuser/bitcoin/deps --enable-cxx && make && make install
wxWidgets
---------
This is the big one..
Check it out from svn
cd ~/bitcoin/deps
svn checkout http://svn.wxwidgets.org/svn/wx/wxWidgets/trunk wxWidgets-trunk
This will make a wxWidgets-trunk directory in deps.
Use this script snippet, change your prefix to whatever your dir is:
PREFIX=~/bitcoin/deps
SRCDIR="$PREFIX/wxWidgets-trunk"
BUILDDIR="$SRCDIR/macbuild"
cd "$PREFIX" &&
#svn checkout http://svn.wxwidgets.org/svn/wx/wxWidgets/trunk wxWidgets-trunk &&
cd "$SRCDIR" &&
[ -f include/wx/hashmap.h.orig ] || cp include/wx/hashmap.h include/wx/hashmap.h.orig &&
sed 's/if wxUSE_STL/if 0 \&\& wxUSE_STL/g' < include/wx/hashmap.h.orig > include/wx/hashmap.h &&
[ -f include/wx/hashset.h.orig ] || cp include/wx/hashset.h include/wx/hashset.h.orig &&
sed 's/if wxUSE_STL/if 0 \&\& wxUSE_STL/g' < include/wx/hashset.h.orig > include/wx/hashset.h &&
rm -vrf "$BUILDDIR" &&
mkdir "$BUILDDIR" &&
cd "$BUILDDIR" &&
../configure --prefix="$PREFIX" \
--with-osx_cocoa \
--disable-shared \
--disable-debug_flag \
--with-macosx-version-min=10.5 \
--enable-stl \
--enable-utf8 \
--enable-universal_binary \
--with-libjpeg=builtin \
--with-libpng=builtin \
--with-regex=builtin \
--with-libtiff=builtin \
--with-zlib=builtin \
--with-expat=builtin \
--with-macosx-sdk=/Developer/SDKs/MacOSX10.5.sdk &&
find . -name Makefile |
while read i; do
echo $i;
sed 's/-arch i386/-arch i386 -arch x86_64/g' < "$i" > "$i".new &&
mv "$i" "$i".old &&
mv "$i".new "$i";
done
make &&
make install
Now you should be able to build bitcoin
cd ~/bitcoin/trunk
make -f makefile.osx bitcoin
Before you can run it, you need to create an application bundle for Mac OS.
Create the directories in terminal using mkdir and copy the files into place.
They are available at http://heliacal.net/~solar/bitcoin/mac-build/
You need the Info.plist and the .ins file. The Contents/MacOS/bitcoin file is
the output of the build.
Your directory structure should look like this:
Bitcoin.app
Bitcoin.app/Contents
Bitcoin.app/Contents/Info.plist
Bitcoin.app/Contents/MacOS
Bitcoin.app/Contents/MacOS/bitcoin
Bitcoin.app/Contents/Resources
Bitcoin.app/Contents/Resources/BitcoinAppIcon.icns
To run it you can just click the Bitcoin.app in Finder, or just do open
~/bitcoin/Bitcoin.app
If you want to run it with arguments you can just run it without backgrounding
by specifying the full name in terminal:
~/bitcoin/Bitcoin.app/Contents/MacOS/bitcoin -addnode=192.75.207.66

76
build-unix.txt Normal file
View File

@@ -0,0 +1,76 @@
Bitcoin v0.2.0 BETA
Copyright (c) 2009-2010 Satoshi Nakamoto
Distributed under the MIT/X11 software license, see the accompanying
file license.txt or http://www.opensource.org/licenses/mit-license.php.
This product includes software developed by the OpenSSL Project for use in
the OpenSSL Toolkit (http://www.openssl.org/). This product includes
cryptographic software written by Eric Young (eay@cryptsoft.com).
UNIX BUILD NOTES
================
Dependencies
------------
sudo apt-get install build-essential
sudo apt-get install libgtk2.0-dev
sudo apt-get install libssl-dev
sudo apt-get install libdb4.7-dev
sudo apt-get install libdb4.7++-dev
sudo apt-get install libboost-dev
We're now using wxWidgets 2.9, which uses UTF-8.
There isn't currently a debian package of wxWidgets we can use. The 2.8
packages for Karmic are UTF-16 unicode and won't work for us, and we've had
trouble building 2.8 on 64-bit.
You need to download wxWidgets from http://www.wxwidgets.org/downloads/
and build it yourself. See the build instructions and configure parameters
below.
Licenses of statically linked libraries:
wxWidgets LGPL 2.1 with very liberal exceptions
Berkeley DB New BSD license with additional requirement that linked software must be free open source
Boost MIT-like license
Versions used in this release:
GCC 4.3.3
OpenSSL 0.9.8k
wxWidgets 2.9.0
Berkeley DB 4.7.25.NC
Boost 1.38.0
Notes
-----
The UI layout is edited with wxFormBuilder. The project file is
uiproject.fbp. It generates uibase.cpp and uibase.h, which define base
classes that do the rote work of constructing all the UI elements.
The release is built with GCC and then "strip bitcoin" to strip the debug
symbols, which reduces the executable size by about 90%.
wxWidgets
---------
cd /usr/local
tar -xzvf wxWidgets-2.9.0.tar.gz
cd /usr/local/wxWidgets-2.9.0
mkdir buildgtk
cd buildgtk
../configure --with-gtk --enable-debug --disable-shared --enable-monolithic
make
sudo su
make install
ldconfig
Boost
-----
If you want to build Boost yourself,
cd /usr/local/boost_1_38_0
su
./bootstrap.sh
./bjam install

View File

@@ -1,2 +1,7 @@
Changes after 0.1.5:
--------------------
+ Options dialog layout changed - added the UI options panel
+ Minimize to tray feature
+ Startup on system boot feature
+ Ask before closing
+ NSIS installer

311
db.cpp
View File

@@ -1,11 +1,14 @@
// Copyright (c) 2009 Satoshi Nakamoto
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Distributed under the MIT/X11 software license, see the accompanying
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
#include "headers.h"
void ThreadFlushWalletDB(void* parg);
unsigned int nWalletDBUpdated;
@@ -17,6 +20,7 @@ static CCriticalSection cs_db;
static bool fDbEnvInit = false;
DbEnv dbenv(0);
static map<string, int> mapFileUseCount;
static map<string, Db*> mapDb;
class CDBInit
{
@@ -36,38 +40,37 @@ public:
instance_of_cdbinit;
CDB::CDB(const char* pszFile, const char* pszMode, bool fTxn) : pdb(NULL)
CDB::CDB(const char* pszFile, const char* pszMode) : pdb(NULL)
{
int ret;
if (pszFile == NULL)
return;
fReadOnly = (!strchr(pszMode, '+') && !strchr(pszMode, 'w'));
bool fCreate = strchr(pszMode, 'c');
bool fReadOnly = (!strchr(pszMode, '+') && !strchr(pszMode, 'w'));
unsigned int nFlags = DB_THREAD;
if (fCreate)
nFlags |= DB_CREATE;
else if (fReadOnly)
nFlags |= DB_RDONLY;
if (!fReadOnly || fTxn)
nFlags |= DB_AUTO_COMMIT;
CRITICAL_BLOCK(cs_db)
{
if (!fDbEnvInit)
{
string strAppDir = GetAppDir();
string strLogDir = strAppDir + "\\database";
if (fShutdown)
return;
string strDataDir = GetDataDir();
string strLogDir = strDataDir + "/database";
_mkdir(strLogDir.c_str());
printf("dbenv.open strAppDir=%s\n", strAppDir.c_str());
string strErrorFile = strDataDir + "/db.log";
printf("dbenv.open strLogDir=%s strErrorFile=%s\n", strLogDir.c_str(), strErrorFile.c_str());
dbenv.set_lg_dir(strLogDir.c_str());
dbenv.set_lg_max(10000000);
dbenv.set_lk_max_locks(10000);
dbenv.set_lk_max_objects(10000);
dbenv.set_errfile(fopen("db.log", "a")); /// debug
///dbenv.log_set_config(DB_LOG_AUTO_REMOVE, 1); /// causes corruption
ret = dbenv.open(strAppDir.c_str(),
dbenv.set_errfile(fopen(strErrorFile.c_str(), "a")); /// debug
dbenv.set_flags(DB_AUTO_COMMIT, 1);
ret = dbenv.open(strDataDir.c_str(),
DB_CREATE |
DB_INIT_LOCK |
DB_INIT_LOG |
@@ -76,7 +79,7 @@ CDB::CDB(const char* pszFile, const char* pszMode, bool fTxn) : pdb(NULL)
DB_THREAD |
DB_PRIVATE |
DB_RECOVER,
0);
S_IRUSR | S_IWUSR);
if (ret > 0)
throw runtime_error(strprintf("CDB() : error %d opening database environment\n", ret));
fDbEnvInit = true;
@@ -84,31 +87,39 @@ CDB::CDB(const char* pszFile, const char* pszMode, bool fTxn) : pdb(NULL)
strFile = pszFile;
++mapFileUseCount[strFile];
pdb = mapDb[strFile];
if (pdb == NULL)
{
pdb = new Db(&dbenv, 0);
ret = pdb->open(NULL, // Txn pointer
pszFile, // Filename
"main", // Logical db name
DB_BTREE, // Database type
nFlags, // Flags
0);
if (ret > 0)
{
delete pdb;
pdb = NULL;
CRITICAL_BLOCK(cs_db)
--mapFileUseCount[strFile];
strFile = "";
throw runtime_error(strprintf("CDB() : can't open database file %s, error %d\n", pszFile, ret));
}
if (fCreate && !Exists(string("version")))
{
bool fTmp = fReadOnly;
fReadOnly = false;
WriteVersion(VERSION);
fReadOnly = fTmp;
}
mapDb[strFile] = pdb;
}
}
pdb = new Db(&dbenv, 0);
ret = pdb->open(NULL, // Txn pointer
pszFile, // Filename
"main", // Logical db name
DB_BTREE, // Database type
nFlags, // Flags
0);
if (ret > 0)
{
delete pdb;
pdb = NULL;
CRITICAL_BLOCK(cs_db)
--mapFileUseCount[strFile];
strFile = "";
throw runtime_error(strprintf("CDB() : can't open database file %s, error %d\n", pszFile, ret));
}
if (fCreate && !Exists(string("version")))
WriteVersion(VERSION);
RandAddSeed();
}
void CDB::Close()
@@ -118,32 +129,49 @@ void CDB::Close()
if (!vTxn.empty())
vTxn.front()->abort();
vTxn.clear();
pdb->close(0);
delete pdb;
pdb = NULL;
dbenv.txn_checkpoint(0, 0, 0);
CRITICAL_BLOCK(cs_db)
--mapFileUseCount[strFile];
}
RandAddSeed();
void CloseDb(const string& strFile)
{
CRITICAL_BLOCK(cs_db)
{
if (mapDb[strFile] != NULL)
{
// Close the database handle
Db* pdb = mapDb[strFile];
pdb->close(0);
delete pdb;
mapDb[strFile] = NULL;
}
}
}
void DBFlush(bool fShutdown)
{
// Flush log data to the actual data file
// on all files that are not in use
printf("DBFlush(%s)\n", fShutdown ? "true" : "false");
printf("DBFlush(%s)%s\n", fShutdown ? "true" : "false", fDbEnvInit ? "" : " db not started");
if (!fDbEnvInit)
return;
CRITICAL_BLOCK(cs_db)
{
dbenv.txn_checkpoint(0, 0, 0);
map<string, int>::iterator mi = mapFileUseCount.begin();
while (mi != mapFileUseCount.end())
{
string strFile = (*mi).first;
int nRefCount = (*mi).second;
printf("%s refcount=%d\n", strFile.c_str(), nRefCount);
if (nRefCount == 0)
{
// Move log data to the dat file
CloseDb(strFile);
dbenv.txn_checkpoint(0, 0, 0);
printf("%s flush\n", strFile.c_str());
dbenv.lsn_reset(strFile.c_str(), 0);
mapFileUseCount.erase(mi++);
}
@@ -230,7 +258,10 @@ bool CTxDB::ReadOwnerTxes(uint160 hash160, int nMinHeight, vector<CTransaction>&
if (ret == DB_NOTFOUND)
break;
else if (ret != 0)
{
pcursor->close();
return false;
}
// Unserialize
string strType;
@@ -247,9 +278,14 @@ bool CTxDB::ReadOwnerTxes(uint160 hash160, int nMinHeight, vector<CTransaction>&
{
vtx.resize(vtx.size()+1);
if (!vtx.back().ReadFromDisk(pos))
{
pcursor->close();
return false;
}
}
}
pcursor->close();
return true;
}
@@ -371,19 +407,20 @@ bool CTxDB::LoadBlockIndex()
break;
}
}
pcursor->close();
if (!ReadHashBestChain(hashBestChain))
{
if (pindexGenesisBlock == NULL)
return true;
return error("CTxDB::LoadBlockIndex() : hashBestChain not found\n");
return error("CTxDB::LoadBlockIndex() : hashBestChain not found");
}
if (!mapBlockIndex.count(hashBestChain))
return error("CTxDB::LoadBlockIndex() : blockindex for hashBestChain not found\n");
return error("CTxDB::LoadBlockIndex() : blockindex for hashBestChain not found");
pindexBest = mapBlockIndex[hashBestChain];
nBestHeight = pindexBest->nHeight;
printf("LoadBlockIndex(): hashBestChain=%s height=%d\n", hashBestChain.ToString().substr(0,14).c_str(), nBestHeight);
printf("LoadBlockIndex(): hashBestChain=%s height=%d\n", hashBestChain.ToString().substr(0,16).c_str(), nBestHeight);
return true;
}
@@ -403,11 +440,10 @@ bool CAddrDB::WriteAddress(const CAddress& addr)
bool CAddrDB::LoadAddresses()
{
CRITICAL_BLOCK(cs_mapIRCAddresses)
CRITICAL_BLOCK(cs_mapAddresses)
{
// Load user provided addresses
CAutoFile filein = fopen("addr.txt", "rt");
CAutoFile filein = fopen((GetDataDir() + "/addr.txt").c_str(), "rt");
if (filein)
{
try
@@ -416,11 +452,9 @@ bool CAddrDB::LoadAddresses()
while (fgets(psz, sizeof(psz), filein))
{
CAddress addr(psz, NODE_NETWORK);
if (addr.ip != 0)
{
AddAddress(*this, addr);
mapIRCAddresses.insert(make_pair(addr.GetKey(), addr));
}
addr.nTime = 0; // so it won't relay unless successfully connected
if (addr.IsValid())
AddAddress(addr);
}
}
catch (...) { }
@@ -452,12 +486,9 @@ bool CAddrDB::LoadAddresses()
mapAddresses.insert(make_pair(addr.GetKey(), addr));
}
}
pcursor->close();
//// debug print
printf("mapAddresses:\n");
foreach(const PAIRTYPE(vector<unsigned char>, CAddress)& item, mapAddresses)
item.second.print();
printf("-----\n");
printf("Loaded %d addresses\n", mapAddresses.size());
// Fix for possible bug that manifests in mapAddresses.count in irc.cpp,
// just need to call count here and it doesn't happen there. The bug was the
@@ -476,34 +507,21 @@ bool LoadAddresses()
//
// CReviewDB
//
bool CReviewDB::ReadReviews(uint256 hash, vector<CReview>& vReviews)
{
vReviews.size(); // msvc workaround, just need to do anything with vReviews
return Read(make_pair(string("reviews"), hash), vReviews);
}
bool CReviewDB::WriteReviews(uint256 hash, const vector<CReview>& vReviews)
{
return Write(make_pair(string("reviews"), hash), vReviews);
}
//
// CWalletDB
//
bool CWalletDB::LoadWallet(vector<unsigned char>& vchDefaultKeyRet)
bool CWalletDB::LoadWallet()
{
vchDefaultKeyRet.clear();
vchDefaultKey.clear();
int nFileVersion = 0;
// Modify defaults
#ifndef __WXMSW__
// Tray icon sometimes disappears on 9.10 karmic koala 64-bit, leaving no way to access the program
fMinimizeToTray = false;
fMinimizeOnClose = false;
#endif
//// todo: shouldn't we catch exceptions and try to recover and continue?
CRITICAL_BLOCK(cs_mapKeys)
@@ -550,47 +568,91 @@ bool CWalletDB::LoadWallet(vector<unsigned char>& vchDefaultKeyRet)
//printf("LoadWallet %s\n", wtx.GetHash().ToString().c_str());
//printf(" %12I64d %s %s %s\n",
// wtx.vout[0].nValue,
// DateTimeStr(wtx.nTime).c_str(),
// wtx.hashBlock.ToString().substr(0,14).c_str(),
// DateTimeStrFormat("%x %H:%M:%S", wtx.nTime).c_str(),
// wtx.hashBlock.ToString().substr(0,16).c_str(),
// wtx.mapValue["message"].c_str());
}
else if (strType == "key")
else if (strType == "key" || strType == "wkey")
{
vector<unsigned char> vchPubKey;
ssKey >> vchPubKey;
CPrivKey vchPrivKey;
ssValue >> vchPrivKey;
CWalletKey wkey;
if (strType == "key")
ssValue >> wkey.vchPrivKey;
else
ssValue >> wkey;
mapKeys[vchPubKey] = vchPrivKey;
mapKeys[vchPubKey] = wkey.vchPrivKey;
mapPubKeys[Hash160(vchPubKey)] = vchPubKey;
}
else if (strType == "defaultkey")
{
ssValue >> vchDefaultKeyRet;
ssValue >> vchDefaultKey;
}
else if (strType == "setting") /// or settings or option or options or config?
else if (strType == "version")
{
ssValue >> nFileVersion;
}
else if (strType == "setting")
{
string strKey;
ssKey >> strKey;
// Menu state
if (strKey == "fGenerateBitcoins") ssValue >> fGenerateBitcoins;
// Options
if (strKey == "nTransactionFee") ssValue >> nTransactionFee;
if (strKey == "addrIncoming") ssValue >> addrIncoming;
if (strKey == "fLimitProcessors") ssValue >> fLimitProcessors;
if (strKey == "nLimitProcessors") ssValue >> nLimitProcessors;
if (strKey == "fMinimizeToTray") ssValue >> fMinimizeToTray;
if (strKey == "fMinimizeOnClose") ssValue >> fMinimizeOnClose;
if (strKey == "fUseProxy") ssValue >> fUseProxy;
if (strKey == "addrProxy") ssValue >> addrProxy;
}
}
pcursor->close();
}
printf("nFileVersion = %d\n", nFileVersion);
printf("fGenerateBitcoins = %d\n", fGenerateBitcoins);
printf("nTransactionFee = %I64d\n", nTransactionFee);
printf("nTransactionFee = %"PRI64d"\n", nTransactionFee);
printf("addrIncoming = %s\n", addrIncoming.ToString().c_str());
printf("fMinimizeToTray = %d\n", fMinimizeToTray);
printf("fMinimizeOnClose = %d\n", fMinimizeOnClose);
printf("fUseProxy = %d\n", fUseProxy);
printf("addrProxy = %s\n", addrProxy.ToString().c_str());
// The transaction fee setting won't be needed for many years to come.
// Setting it to zero here in case they set it to something in an earlier version.
if (nTransactionFee != 0)
{
nTransactionFee = 0;
WriteSetting("nTransactionFee", nTransactionFee);
}
// Upgrade
if (nFileVersion < VERSION)
{
// Get rid of old debug.log file in current directory
if (nFileVersion <= 105 && !pszSetDataDir[0])
unlink("debug.log");
WriteVersion(VERSION);
}
return true;
}
bool LoadWallet()
bool LoadWallet(bool& fFirstRunRet)
{
vector<unsigned char> vchDefaultKey;
if (!CWalletDB("cr").LoadWallet(vchDefaultKey))
fFirstRunRet = false;
if (!CWalletDB("cr+").LoadWallet())
return false;
fFirstRunRet = vchDefaultKey.empty();
if (mapKeys.count(vchDefaultKey))
{
@@ -601,7 +663,7 @@ bool LoadWallet()
else
{
// Create new keyUser and set as default key
RandAddSeed(true);
RandAddSeedPerfmon();
keyUser.MakeNewKey();
if (!AddKey(keyUser))
return false;
@@ -610,5 +672,66 @@ bool LoadWallet()
CWalletDB().WriteDefaultKey(keyUser.GetPubKey());
}
CreateThread(ThreadFlushWalletDB, NULL);
return true;
}
void ThreadFlushWalletDB(void* parg)
{
static bool fOneThread;
if (fOneThread)
return;
fOneThread = true;
if (mapArgs.count("-noflushwallet"))
return;
unsigned int nLastSeen = nWalletDBUpdated;
unsigned int nLastFlushed = nWalletDBUpdated;
int64 nLastWalletUpdate = GetTime();
while (!fShutdown)
{
Sleep(500);
if (nLastSeen != nWalletDBUpdated)
{
nLastSeen = nWalletDBUpdated;
nLastWalletUpdate = GetTime();
}
if (nLastFlushed != nWalletDBUpdated && GetTime() - nLastWalletUpdate >= 2)
{
TRY_CRITICAL_BLOCK(cs_db)
{
// Don't do this if any databases are in use
int nRefCount = 0;
map<string, int>::iterator mi = mapFileUseCount.begin();
while (mi != mapFileUseCount.end())
{
nRefCount += (*mi).second;
mi++;
}
if (nRefCount == 0 && !fShutdown)
{
string strFile = "wallet.dat";
map<string, int>::iterator mi = mapFileUseCount.find(strFile);
if (mi != mapFileUseCount.end())
{
printf("%s ", DateTimeStrFormat("%x %H:%M:%S", GetTime()).c_str());
printf("Flushing wallet.dat\n");
nLastFlushed = nWalletDBUpdated;
int64 nStart = GetTimeMillis();
// Flush wallet.dat so it's self contained
CloseDb(strFile);
dbenv.txn_checkpoint(0, 0, 0);
dbenv.lsn_reset(strFile.c_str(), 0);
mapFileUseCount.erase(mi++);
printf("Flushed wallet.dat %"PRI64d"ms\n", GetTimeMillis() - nStart);
}
}
}
}
}
}

82
db.h
View File

@@ -1,8 +1,7 @@
// Copyright (c) 2009 Satoshi Nakamoto
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Distributed under the MIT/X11 software license, see the accompanying
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
#include <db_cxx.h>
class CTransaction;
class CTxIndex;
class CDiskBlockIndex;
@@ -14,10 +13,16 @@ class CAddress;
class CWalletTx;
extern map<string, string> mapAddressBook;
extern CCriticalSection cs_mapAddressBook;
extern vector<unsigned char> vchDefaultKey;
extern bool fClient;
extern unsigned int nWalletDBUpdated;
extern DbEnv dbenv;
extern void DBFlush(bool fShutdown);
@@ -29,8 +34,9 @@ protected:
Db* pdb;
string strFile;
vector<DbTxn*> vTxn;
bool fReadOnly;
explicit CDB(const char* pszFile, const char* pszMode="r+", bool fTxn=false);
explicit CDB(const char* pszFile, const char* pszMode="r+");
~CDB() { Close(); }
public:
void Close();
@@ -74,6 +80,8 @@ protected:
{
if (!pdb)
return false;
if (fReadOnly)
assert(("Write called on database in read-only mode", false));
// Key
CDataStream ssKey(SER_DISK);
@@ -101,6 +109,8 @@ protected:
{
if (!pdb)
return false;
if (fReadOnly)
assert(("Erase called on database in read-only mode", false));
// Key
CDataStream ssKey(SER_DISK);
@@ -251,7 +261,7 @@ public:
class CTxDB : public CDB
{
public:
CTxDB(const char* pszMode="r+", bool fTxn=false) : CDB(!fClient ? "blkindex.dat" : NULL, pszMode, fTxn) { }
CTxDB(const char* pszMode="r+") : CDB(!fClient ? "blkindex.dat" : NULL, pszMode) { }
private:
CTxDB(const CTxDB&);
void operator=(const CTxDB&);
@@ -277,49 +287,10 @@ public:
class CReviewDB : public CDB
{
public:
CReviewDB(const char* pszMode="r+", bool fTxn=false) : CDB("reviews.dat", pszMode, fTxn) { }
private:
CReviewDB(const CReviewDB&);
void operator=(const CReviewDB&);
public:
bool ReadUser(uint256 hash, CUser& user)
{
return Read(make_pair(string("user"), hash), user);
}
bool WriteUser(uint256 hash, const CUser& user)
{
return Write(make_pair(string("user"), hash), user);
}
bool ReadReviews(uint256 hash, vector<CReview>& vReviews);
bool WriteReviews(uint256 hash, const vector<CReview>& vReviews);
};
class CMarketDB : public CDB
{
public:
CMarketDB(const char* pszMode="r+", bool fTxn=false) : CDB("market.dat", pszMode, fTxn) { }
private:
CMarketDB(const CMarketDB&);
void operator=(const CMarketDB&);
};
class CAddrDB : public CDB
{
public:
CAddrDB(const char* pszMode="r+", bool fTxn=false) : CDB("addr.dat", pszMode, fTxn) { }
CAddrDB(const char* pszMode="r+") : CDB("addr.dat", pszMode) { }
private:
CAddrDB(const CAddrDB&);
void operator=(const CAddrDB&);
@@ -334,10 +305,11 @@ bool LoadAddresses();
class CWalletDB : public CDB
{
public:
CWalletDB(const char* pszMode="r+", bool fTxn=false) : CDB("wallet.dat", pszMode, fTxn) { }
CWalletDB(const char* pszMode="r+") : CDB("wallet.dat", pszMode) { }
private:
CWalletDB(const CWalletDB&);
void operator=(const CWalletDB&);
@@ -350,13 +322,19 @@ public:
bool WriteName(const string& strAddress, const string& strName)
{
mapAddressBook[strAddress] = strName;
CRITICAL_BLOCK(cs_mapAddressBook)
mapAddressBook[strAddress] = strName;
nWalletDBUpdated++;
return Write(make_pair(string("name"), strAddress), strName);
}
bool EraseName(const string& strAddress)
{
mapAddressBook.erase(strAddress);
// This should only be used for sending addresses, never for receiving addresses,
// receiving addresses must always have an address book entry if they're not change return.
CRITICAL_BLOCK(cs_mapAddressBook)
mapAddressBook.erase(strAddress);
nWalletDBUpdated++;
return Erase(make_pair(string("name"), strAddress));
}
@@ -367,11 +345,13 @@ public:
bool WriteTx(uint256 hash, const CWalletTx& wtx)
{
nWalletDBUpdated++;
return Write(make_pair(string("tx"), hash), wtx);
}
bool EraseTx(uint256 hash)
{
nWalletDBUpdated++;
return Erase(make_pair(string("tx"), hash));
}
@@ -383,6 +363,7 @@ public:
bool WriteKey(const vector<unsigned char>& vchPubKey, const CPrivKey& vchPrivKey)
{
nWalletDBUpdated++;
return Write(make_pair(string("key"), vchPubKey), vchPrivKey, false);
}
@@ -394,6 +375,8 @@ public:
bool WriteDefaultKey(const vector<unsigned char>& vchPubKey)
{
vchDefaultKey = vchPubKey;
nWalletDBUpdated++;
return Write(string("defaultkey"), vchPubKey);
}
@@ -406,13 +389,14 @@ public:
template<typename T>
bool WriteSetting(const string& strKey, const T& value)
{
nWalletDBUpdated++;
return Write(make_pair(string("setting"), strKey), value);
}
bool LoadWallet(vector<unsigned char>& vchDefaultKeyRet);
bool LoadWallet();
};
bool LoadWallet();
bool LoadWallet(bool& fFirstRunRet);
inline bool SetAddressBookName(const string& strAddress, const string& strName)
{

View File

@@ -1,39 +1,45 @@
// Copyright (c) 2009 Satoshi Nakamoto
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Distributed under the MIT/X11 software license, see the accompanying
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
#ifdef _MSC_VER
#pragma warning(disable:4786)
#pragma warning(disable:4804)
#pragma warning(disable:4805)
#pragma warning(disable:4717)
#endif
#ifdef _WIN32_WINNT
#undef _WIN32_WINNT
#endif
#define _WIN32_WINNT 0x0400
#ifdef _WIN32_IE
#undef _WIN32_IE
#endif
#define _WIN32_IE 0x0400
#define WIN32_LEAN_AND_MEAN 1
#define __STDC_LIMIT_MACROS // to enable UINT64_MAX from stdint.h
#include <wx/wx.h>
#include <wx/clipbrd.h>
#include <wx/stdpaths.h>
#include <wx/snglinst.h>
#if wxUSE_GUI
#include <wx/utils.h>
#include <wx/clipbrd.h>
#include <wx/taskbar.h>
#endif
#include <openssl/ecdsa.h>
#include <openssl/evp.h>
#include <openssl/rand.h>
#include <openssl/sha.h>
#include <openssl/ripemd.h>
#include <windows.h>
#include <winsock2.h>
#include <mswsock.h>
#include <db_cxx.h>
#include <stdio.h>
#include <stdlib.h>
#include <io.h>
#include <math.h>
#include <limits.h>
#include <float.h>
#include <assert.h>
#include <process.h>
#include <malloc.h>
#include <memory>
#define BOUNDSCHECK 1
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
@@ -49,12 +55,41 @@
#include <boost/tuple/tuple_comparison.hpp>
#include <boost/tuple/tuple_io.hpp>
#include <boost/array.hpp>
#include <boost/bind.hpp>
#include <boost/function.hpp>
#include <boost/filesystem.hpp>
#include <boost/algorithm/string.hpp>
#ifdef __WXMSW__
#include <windows.h>
#include <winsock2.h>
#include <mswsock.h>
#include <shlobj.h>
#include <shlwapi.h>
#include <io.h>
#include <process.h>
#include <malloc.h>
#else
#include <sys/time.h>
#include <sys/resource.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <unistd.h>
#include <errno.h>
#include <net/if.h>
#include <ifaddrs.h>
#endif
#ifdef __BSD__
#include <netinet/in.h>
#endif
#pragma hdrstop
using namespace std;
using namespace boost;
#include "strlcpy.h"
#include "serialize.h"
#include "uint256.h"
#include "util.h"
@@ -66,6 +101,21 @@ using namespace boost;
#include "net.h"
#include "irc.h"
#include "main.h"
#include "market.h"
#include "rpc.h"
#if wxUSE_GUI
#include "uibase.h"
#endif
#include "ui.h"
#include "init.h"
#include "xpm/addressbook16.xpm"
#include "xpm/addressbook20.xpm"
#include "xpm/bitcoin16.xpm"
#include "xpm/bitcoin20.xpm"
#include "xpm/bitcoin32.xpm"
#include "xpm/bitcoin48.xpm"
#include "xpm/check.xpm"
#include "xpm/send16.xpm"
#include "xpm/send16noshadow.xpm"
#include "xpm/send20.xpm"
#include "xpm/about.xpm"

635
init.cpp Normal file
View File

@@ -0,0 +1,635 @@
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Distributed under the MIT/X11 software license, see the accompanying
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
#include "headers.h"
void ExitTimeout(void* parg)
{
#ifdef __WXMSW__
Sleep(5000);
ExitProcess(0);
#endif
}
void Shutdown(void* parg)
{
static CCriticalSection cs_Shutdown;
static bool fTaken;
bool fFirstThread;
CRITICAL_BLOCK(cs_Shutdown)
{
fFirstThread = !fTaken;
fTaken = true;
}
static bool fExit;
if (fFirstThread)
{
fShutdown = true;
nTransactionsUpdated++;
DBFlush(false);
StopNode();
DBFlush(true);
CreateThread(ExitTimeout, NULL);
Sleep(50);
printf("Bitcoin exiting\n\n");
fExit = true;
exit(0);
}
else
{
while (!fExit)
Sleep(500);
Sleep(100);
ExitThread(0);
}
}
//////////////////////////////////////////////////////////////////////////////
//
// Startup folder
//
#ifdef __WXMSW__
typedef WINSHELLAPI BOOL (WINAPI *PSHGETSPECIALFOLDERPATHA)(HWND hwndOwner, LPSTR lpszPath, int nFolder, BOOL fCreate);
string MyGetSpecialFolderPath(int nFolder, bool fCreate)
{
char pszPath[MAX_PATH+100] = "";
// SHGetSpecialFolderPath is not usually available on NT 4.0
HMODULE hShell32 = LoadLibraryA("shell32.dll");
if (hShell32)
{
PSHGETSPECIALFOLDERPATHA pSHGetSpecialFolderPath =
(PSHGETSPECIALFOLDERPATHA)GetProcAddress(hShell32, "SHGetSpecialFolderPathA");
if (pSHGetSpecialFolderPath)
(*pSHGetSpecialFolderPath)(NULL, pszPath, nFolder, fCreate);
FreeModule(hShell32);
}
// Backup option
if (pszPath[0] == '\0')
{
if (nFolder == CSIDL_STARTUP)
{
strcpy(pszPath, getenv("USERPROFILE"));
strcat(pszPath, "\\Start Menu\\Programs\\Startup");
}
else if (nFolder == CSIDL_APPDATA)
{
strcpy(pszPath, getenv("APPDATA"));
}
}
return pszPath;
}
string StartupShortcutPath()
{
return MyGetSpecialFolderPath(CSIDL_STARTUP, true) + "\\Bitcoin.lnk";
}
bool GetStartOnSystemStartup()
{
return wxFileExists(StartupShortcutPath());
}
void SetStartOnSystemStartup(bool fAutoStart)
{
// If the shortcut exists already, remove it for updating
remove(StartupShortcutPath().c_str());
if (fAutoStart)
{
CoInitialize(NULL);
// Get a pointer to the IShellLink interface.
IShellLink* psl = NULL;
HRESULT hres = CoCreateInstance(CLSID_ShellLink, NULL,
CLSCTX_INPROC_SERVER, IID_IShellLink,
reinterpret_cast<void**>(&psl));
if (SUCCEEDED(hres))
{
// Get the current executable path
TCHAR pszExePath[MAX_PATH];
GetModuleFileName(NULL, pszExePath, sizeof(pszExePath));
// Set the path to the shortcut target
psl->SetPath(pszExePath);
PathRemoveFileSpec(pszExePath);
psl->SetWorkingDirectory(pszExePath);
psl->SetShowCmd(SW_SHOWMINNOACTIVE);
// Query IShellLink for the IPersistFile interface for
// saving the shortcut in persistent storage.
IPersistFile* ppf = NULL;
hres = psl->QueryInterface(IID_IPersistFile,
reinterpret_cast<void**>(&ppf));
if (SUCCEEDED(hres))
{
WCHAR pwsz[MAX_PATH];
// Ensure that the string is ANSI.
MultiByteToWideChar(CP_ACP, 0, StartupShortcutPath().c_str(), -1, pwsz, MAX_PATH);
// Save the link by calling IPersistFile::Save.
hres = ppf->Save(pwsz, TRUE);
ppf->Release();
}
psl->Release();
}
CoUninitialize();
}
}
#else
bool GetStartOnSystemStartup() { return false; }
void SetStartOnSystemStartup(bool fAutoStart) { }
#endif
//////////////////////////////////////////////////////////////////////////////
//
// CMyApp
//
// Define a new application
class CMyApp: public wxApp
{
public:
wxLocale m_locale;
CMyApp(){};
~CMyApp(){};
bool OnInit();
bool OnInit2();
int OnExit();
// Hook Initialize so we can start without GUI
virtual bool Initialize(int& argc, wxChar** argv);
// 2nd-level exception handling: we get all the exceptions occurring in any
// event handler here
virtual bool OnExceptionInMainLoop();
// 3rd, and final, level exception handling: whenever an unhandled
// exception is caught, this function is called
virtual void OnUnhandledException();
// and now for something different: this function is called in case of a
// crash (e.g. dereferencing null pointer, division by 0, ...)
virtual void OnFatalException();
};
IMPLEMENT_APP(CMyApp)
bool CMyApp::Initialize(int& argc, wxChar** argv)
{
if (argc > 1 && argv[1][0] != '-' && (!fWindows || argv[1][0] != '/') &&
wxString(argv[1]) != "start")
{
fCommandLine = true;
}
else if (!fGUI)
{
fDaemon = true;
}
else
{
// wxApp::Initialize will remove environment-specific parameters,
// so it's too early to call ParseParameters yet
for (int i = 1; i < argc; i++)
{
wxString str = argv[i];
#ifdef __WXMSW__
if (str.size() >= 1 && str[0] == '/')
str[0] = '-';
str = str.MakeLower();
#endif
// haven't decided which argument to use for this yet
if (str == "-daemon" || str == "-d" || str == "start")
fDaemon = true;
}
}
#ifdef __WXGTK__
if (fDaemon || fCommandLine)
{
// Call the original Initialize while suppressing error messages
// and ignoring failure. If unable to initialize GTK, it fails
// near the end so hopefully the last few things don't matter.
{
wxLogNull logNo;
wxApp::Initialize(argc, argv);
}
if (fDaemon)
{
// Daemonize
pid_t pid = fork();
if (pid < 0)
{
fprintf(stderr, "Error: fork() returned %d errno %d\n", pid, errno);
return false;
}
if (pid > 0)
pthread_exit((void*)0);
}
return true;
}
#endif
return wxApp::Initialize(argc, argv);
}
bool CMyApp::OnInit()
{
bool fRet = false;
try
{
fRet = OnInit2();
}
catch (std::exception& e) {
PrintException(&e, "OnInit()");
} catch (...) {
PrintException(NULL, "OnInit()");
}
if (!fRet)
Shutdown(NULL);
return fRet;
}
extern int g_isPainting;
bool CMyApp::OnInit2()
{
#ifdef _MSC_VER
// Turn off microsoft heap dump noise
_CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
_CrtSetReportFile(_CRT_WARN, CreateFileA("NUL", GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, 0));
#endif
#if _MSC_VER >= 1400
// Disable confusing "helpful" text message on abort, ctrl-c
_set_abort_behavior(0, _WRITE_ABORT_MSG | _CALL_REPORTFAULT);
#endif
#if defined(__WXMSW__) && defined(__WXDEBUG__) && wxUSE_GUI
// Disable malfunctioning wxWidgets debug assertion
g_isPainting = 10000;
#endif
#if wxUSE_GUI
wxImage::AddHandler(new wxPNGHandler);
#endif
#if defined(__WXMSW__ ) || defined(__WXMAC__)
SetAppName("Bitcoin");
#else
SetAppName("bitcoin");
#endif
#ifndef __WXMSW__
umask(077);
#endif
#ifdef __WXMSW__
#if wxUSE_UNICODE
// Hack to set wxConvLibc codepage to UTF-8 on Windows,
// may break if wxMBConv_win32 implementation in strconv.cpp changes.
class wxMBConv_win32 : public wxMBConv
{
public:
long m_CodePage;
size_t m_minMBCharWidth;
};
if (((wxMBConv_win32*)&wxConvLibc)->m_CodePage == CP_ACP)
((wxMBConv_win32*)&wxConvLibc)->m_CodePage = CP_UTF8;
#endif
#endif
// Load locale/<lang>/LC_MESSAGES/bitcoin.mo language file
m_locale.Init(wxLANGUAGE_DEFAULT, 0);
m_locale.AddCatalogLookupPathPrefix("locale");
if (!fWindows)
{
m_locale.AddCatalogLookupPathPrefix("/usr/share/locale");
m_locale.AddCatalogLookupPathPrefix("/usr/local/share/locale");
}
m_locale.AddCatalog("wxstd"); // wxWidgets standard translations, if any
m_locale.AddCatalog("bitcoin");
//
// Parameters
//
if (fCommandLine)
{
int ret = CommandLineRPC(argc, argv);
exit(ret);
}
ParseParameters(argc, argv);
if (mapArgs.count("-?") || mapArgs.count("--help"))
{
wxString strUsage = string() +
_("Usage:") + "\t\t\t\t\t\t\t\t\t\t\n" +
" bitcoin [options] \t" + "\n" +
" bitcoin [command] \t" + _("Send command to bitcoin running with -server or -daemon\n") +
" bitcoin [command] -? \t" + _("Get help for a command\n") +
" bitcoin help \t" + _("List commands\n") +
_("Options:\n") +
" -gen \t " + _("Generate coins\n") +
" -gen=0 \t " + _("Don't generate coins\n") +
" -min \t " + _("Start minimized\n") +
" -datadir=<dir> \t " + _("Specify data directory\n") +
" -proxy=<ip:port>\t " + _("Connect through socks4 proxy\n") +
" -addnode=<ip> \t " + _("Add a node to connect to\n") +
" -connect=<ip> \t " + _("Connect only to the specified node\n") +
" -server \t " + _("Accept command line and JSON-RPC commands\n") +
" -daemon \t " + _("Run in the background as a daemon and accept commands\n") +
" -? \t " + _("This help message\n");
if (fWindows && fGUI)
{
// Tabs make the columns line up in the message box
wxMessageBox(strUsage, "Bitcoin", wxOK);
}
else
{
// Remove tabs
strUsage.Replace("\t", "");
fprintf(stderr, "%s", ((string)strUsage).c_str());
}
return false;
}
if (mapArgs.count("-datadir"))
strlcpy(pszSetDataDir, mapArgs["-datadir"].c_str(), sizeof(pszSetDataDir));
if (mapArgs.count("-debug"))
fDebug = true;
if (mapArgs.count("-printtodebugger"))
fPrintToDebugger = true;
if (!fDebug && !pszSetDataDir[0])
ShrinkDebugFile();
printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
printf("Bitcoin version 0.%d.%d%s beta, OS version %s\n", VERSION/100, VERSION%100, pszSubVer, ((string)wxGetOsDescription()).c_str());
printf("System default language is %d %s\n", m_locale.GetSystemLanguage(), ((string)m_locale.GetSysName()).c_str());
printf("Language file %s (%s)\n", (string("locale/") + (string)m_locale.GetCanonicalName() + "/LC_MESSAGES/bitcoin.mo").c_str(), ((string)m_locale.GetLocale()).c_str());
if (mapArgs.count("-loadblockindextest"))
{
CTxDB txdb("r");
txdb.LoadBlockIndex();
PrintBlockTree();
return false;
}
//
// Limit to single instance per user
// Required to protect the database files if we're going to keep deleting log.*
//
#ifdef __WXMSW__
// todo: wxSingleInstanceChecker wasn't working on Linux, never deleted its lock file
// maybe should go by whether successfully bind port 8333 instead
wxString strMutexName = wxString("bitcoin_running.") + getenv("HOMEPATH");
for (int i = 0; i < strMutexName.size(); i++)
if (!isalnum(strMutexName[i]))
strMutexName[i] = '.';
wxSingleInstanceChecker* psingleinstancechecker = new wxSingleInstanceChecker(strMutexName);
if (psingleinstancechecker->IsAnotherRunning())
{
printf("Existing instance found\n");
unsigned int nStart = GetTime();
loop
{
// TODO: find out how to do this in Linux, or replace with wxWidgets commands
// Show the previous instance and exit
HWND hwndPrev = FindWindowA("wxWindowClassNR", "Bitcoin");
if (hwndPrev)
{
if (IsIconic(hwndPrev))
ShowWindow(hwndPrev, SW_RESTORE);
SetForegroundWindow(hwndPrev);
return false;
}
if (GetTime() > nStart + 60)
return false;
// Resume this instance if the other exits
delete psingleinstancechecker;
Sleep(1000);
psingleinstancechecker = new wxSingleInstanceChecker(strMutexName);
if (!psingleinstancechecker->IsAnotherRunning())
break;
}
}
#endif
// Bind to the port early so we can tell if another instance is already running.
// This is a backup to wxSingleInstanceChecker, which doesn't work on Linux.
string strErrors;
if (!BindListenPort(strErrors))
{
wxMessageBox(strErrors, "Bitcoin");
return false;
}
//
// Load data files
//
if (fDaemon)
fprintf(stdout, "bitcoin server starting\n");
strErrors = "";
int64 nStart;
printf("Loading addresses...\n");
nStart = GetTimeMillis();
if (!LoadAddresses())
strErrors += _("Error loading addr.dat \n");
printf(" addresses %15"PRI64d"ms\n", GetTimeMillis() - nStart);
printf("Loading block index...\n");
nStart = GetTimeMillis();
if (!LoadBlockIndex())
strErrors += _("Error loading blkindex.dat \n");
printf(" block index %15"PRI64d"ms\n", GetTimeMillis() - nStart);
printf("Loading wallet...\n");
nStart = GetTimeMillis();
bool fFirstRun;
if (!LoadWallet(fFirstRun))
strErrors += _("Error loading wallet.dat \n");
printf(" wallet %15"PRI64d"ms\n", GetTimeMillis() - nStart);
printf("Done loading\n");
//// debug print
printf("mapBlockIndex.size() = %d\n", mapBlockIndex.size());
printf("nBestHeight = %d\n", nBestHeight);
printf("mapKeys.size() = %d\n", mapKeys.size());
printf("mapPubKeys.size() = %d\n", mapPubKeys.size());
printf("mapWallet.size() = %d\n", mapWallet.size());
printf("mapAddressBook.size() = %d\n", mapAddressBook.size());
if (!strErrors.empty())
{
wxMessageBox(strErrors, "Bitcoin");
return false;
}
// Add wallet transactions that aren't already in a block to mapTransactions
ReacceptWalletTransactions();
//
// Parameters
//
if (mapArgs.count("-printblockindex") || mapArgs.count("-printblocktree"))
{
PrintBlockTree();
return false;
}
if (mapArgs.count("-printblock"))
{
string strMatch = mapArgs["-printblock"];
int nFound = 0;
for (map<uint256, CBlockIndex*>::iterator mi = mapBlockIndex.begin(); mi != mapBlockIndex.end(); ++mi)
{
uint256 hash = (*mi).first;
if (strncmp(hash.ToString().c_str(), strMatch.c_str(), strMatch.size()) == 0)
{
CBlockIndex* pindex = (*mi).second;
CBlock block;
block.ReadFromDisk(pindex);
block.BuildMerkleTree();
block.print();
printf("\n");
nFound++;
}
}
if (nFound == 0)
printf("No blocks matching %s were found\n", strMatch.c_str());
return false;
}
if (mapArgs.count("-gen"))
{
if (mapArgs["-gen"].empty())
fGenerateBitcoins = true;
else
fGenerateBitcoins = (atoi(mapArgs["-gen"].c_str()) != 0);
}
if (mapArgs.count("-proxy"))
{
fUseProxy = true;
addrProxy = CAddress(mapArgs["-proxy"]);
if (!addrProxy.IsValid())
{
wxMessageBox(_("Invalid -proxy address"), "Bitcoin");
return false;
}
}
if (mapArgs.count("-addnode"))
{
foreach(string strAddr, mapMultiArgs["-addnode"])
{
CAddress addr(strAddr, NODE_NETWORK);
addr.nTime = 0; // so it won't relay unless successfully connected
if (addr.IsValid())
AddAddress(addr);
}
}
//
// Create the main window and start the node
//
if (!fDaemon)
CreateMainWindow();
if (!CheckDiskSpace())
return false;
RandAddSeedPerfmon();
if (!CreateThread(StartNode, NULL))
wxMessageBox("Error: CreateThread(StartNode) failed", "Bitcoin");
if (mapArgs.count("-server") || fDaemon)
CreateThread(ThreadRPCServer, NULL);
if (fFirstRun)
SetStartOnSystemStartup(true);
return true;
}
int CMyApp::OnExit()
{
Shutdown(NULL);
return wxApp::OnExit();
}
bool CMyApp::OnExceptionInMainLoop()
{
try
{
throw;
}
catch (std::exception& e)
{
PrintException(&e, "CMyApp::OnExceptionInMainLoop()");
wxLogWarning("Exception %s %s", typeid(e).name(), e.what());
Sleep(1000);
throw;
}
catch (...)
{
PrintException(NULL, "CMyApp::OnExceptionInMainLoop()");
wxLogWarning("Unknown exception");
Sleep(1000);
throw;
}
return true;
}
void CMyApp::OnUnhandledException()
{
// this shows how we may let some exception propagate uncaught
try
{
throw;
}
catch (std::exception& e)
{
PrintException(&e, "CMyApp::OnUnhandledException()");
wxLogWarning("Exception %s %s", typeid(e).name(), e.what());
Sleep(1000);
throw;
}
catch (...)
{
PrintException(NULL, "CMyApp::OnUnhandledException()");
wxLogWarning("Unknown exception");
Sleep(1000);
throw;
}
}
void CMyApp::OnFatalException()
{
wxMessageBox(_("Program has crashed and will terminate. "), "Bitcoin", wxOK | wxICON_ERROR);
}

7
init.h Normal file
View File

@@ -0,0 +1,7 @@
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Distributed under the MIT/X11 software license, see the accompanying
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
void Shutdown(void* parg);
bool GetStartOnSystemStartup();
void SetStartOnSystemStartup(bool fAutoStart);

95
irc.cpp
View File

@@ -1,13 +1,10 @@
// Copyright (c) 2009 Satoshi Nakamoto
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Distributed under the MIT/X11 software license, see the accompanying
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
#include "headers.h"
map<vector<unsigned char>, CAddress> mapIRCAddresses;
CCriticalSection cs_mapIRCAddresses;
int nGotIRCAddresses = 0;
@@ -40,7 +37,7 @@ bool DecodeAddress(string str, CAddress& addr)
return false;
memcpy(&tmp, &vch[0], sizeof(tmp));
addr = CAddress(tmp.ip, tmp.port);
addr = CAddress(tmp.ip, tmp.port, NODE_NETWORK);
return true;
}
@@ -52,12 +49,12 @@ bool DecodeAddress(string str, CAddress& addr)
static bool Send(SOCKET hSocket, const char* pszSend)
{
if (strstr(pszSend, "PONG") != pszSend)
printf("SENDING: %s\n", pszSend);
printf("IRC SENDING: %s\n", pszSend);
const char* psz = pszSend;
const char* pszEnd = psz + strlen(psz);
while (psz < pszEnd)
{
int ret = send(hSocket, psz, pszEnd - psz, 0);
int ret = send(hSocket, psz, pszEnd - psz, MSG_NOSIGNAL);
if (ret < 0)
return false;
psz += ret;
@@ -79,6 +76,8 @@ bool RecvLine(SOCKET hSocket, string& strLine)
if (c == '\r')
return true;
strLine += c;
if (strLine.size() >= 9000)
return true;
}
else if (nBytes <= 0)
{
@@ -112,7 +111,7 @@ bool RecvLineIRC(SOCKET hSocket, string& strLine)
return false;
vector<string> vWords;
ParseString(strLine, ' ', vWords);
if (vWords[0] == "PING")
if (vWords.size() >= 1 && vWords[0] == "PING")
{
strLine[1] = 'O';
strLine += '\r';
@@ -124,20 +123,20 @@ bool RecvLineIRC(SOCKET hSocket, string& strLine)
}
}
bool RecvUntil(SOCKET hSocket, const char* psz1, const char* psz2=NULL, const char* psz3=NULL)
int RecvUntil(SOCKET hSocket, const char* psz1, const char* psz2=NULL, const char* psz3=NULL)
{
loop
{
string strLine;
if (!RecvLineIRC(hSocket, strLine))
return false;
return 0;
printf("IRC %s\n", strLine.c_str());
if (psz1 && strLine.find(psz1) != -1)
return true;
return 1;
if (psz2 && strLine.find(psz2) != -1)
return true;
return 2;
if (psz3 && strLine.find(psz3) != -1)
return true;
return 3;
}
}
@@ -145,7 +144,7 @@ bool Wait(int nSeconds)
{
if (fShutdown)
return false;
printf("Waiting %d seconds to reconnect to IRC\n", nSeconds);
printf("IRC waiting %d seconds to reconnect\n", nSeconds);
for (int i = 0; i < nSeconds; i++)
{
if (fShutdown)
@@ -159,16 +158,21 @@ bool Wait(int nSeconds)
void ThreadIRCSeed(void* parg)
{
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_NORMAL);
printf("ThreadIRCSeed started\n");
int nErrorWait = 10;
int nRetryWait = 10;
bool fNameInUse = false;
bool fTOR = (fUseProxy && addrProxy.port == htons(9050));
while (!fShutdown)
{
CAddress addrConnect("216.155.130.130:6667");
struct hostent* phostent = gethostbyname("chat.freenode.net");
if (phostent && phostent->h_addr_list && phostent->h_addr_list[0])
addrConnect = CAddress(*(u_long*)phostent->h_addr_list[0], htons(6667));
if (!fTOR)
{
struct hostent* phostent = gethostbyname("chat.freenode.net");
if (phostent && phostent->h_addr_list && phostent->h_addr_list[0])
addrConnect = CAddress(*(u_long*)phostent->h_addr_list[0], htons(6667));
}
SOCKET hSocket;
if (!ConnectSocket(addrConnect, hSocket))
@@ -184,6 +188,7 @@ void ThreadIRCSeed(void* parg)
if (!RecvUntil(hSocket, "Found your hostname", "using your IP address instead", "Couldn't look up your hostname"))
{
closesocket(hSocket);
hSocket = INVALID_SOCKET;
nErrorWait = nErrorWait * 11 / 10;
if (Wait(nErrorWait += 60))
continue;
@@ -191,18 +196,28 @@ void ThreadIRCSeed(void* parg)
return;
}
string strMyName = EncodeAddress(addrLocalHost);
if (!addrLocalHost.IsRoutable())
string strMyName;
if (addrLocalHost.IsRoutable() && !fUseProxy && !fNameInUse)
strMyName = EncodeAddress(addrLocalHost);
else
strMyName = strprintf("x%u", GetRand(1000000000));
Send(hSocket, strprintf("NICK %s\r", strMyName.c_str()).c_str());
Send(hSocket, strprintf("USER %s 8 * : %s\r", strMyName.c_str(), strMyName.c_str()).c_str());
if (!RecvUntil(hSocket, " 004 "))
int nRet = RecvUntil(hSocket, " 004 ", " 433 ");
if (nRet != 1)
{
closesocket(hSocket);
hSocket = INVALID_SOCKET;
if (nRet == 2)
{
printf("IRC name already in use\n");
fNameInUse = true;
Wait(10);
continue;
}
nErrorWait = nErrorWait * 11 / 10;
if (Wait(nErrorWait += 60))
continue;
@@ -220,7 +235,6 @@ void ThreadIRCSeed(void* parg)
{
if (strLine.empty() || strLine.size() > 900 || strLine[0] != ':')
continue;
printf("IRC %s\n", strLine.c_str());
vector<string> vWords;
ParseString(strLine, ' ', vWords);
@@ -234,17 +248,17 @@ void ThreadIRCSeed(void* parg)
{
// index 7 is limited to 16 characters
// could get full length name at index 10, but would be different from join messages
strcpy(pszName, vWords[7].c_str());
printf("GOT WHO: [%s] ", pszName);
strlcpy(pszName, vWords[7].c_str(), sizeof(pszName));
printf("IRC got who\n");
}
if (vWords[1] == "JOIN" && vWords[0].size() > 1)
{
// :username!username@50000007.F000000B.90000002.IP JOIN :#channelname
strcpy(pszName, vWords[0].c_str() + 1);
strlcpy(pszName, vWords[0].c_str() + 1, sizeof(pszName));
if (strchr(pszName, '!'))
*strchr(pszName, '!') = '\0';
printf("GOT JOIN: [%s] ", pszName);
printf("IRC got join\n");
}
if (pszName[0] == 'u')
@@ -252,28 +266,23 @@ void ThreadIRCSeed(void* parg)
CAddress addr;
if (DecodeAddress(pszName, addr))
{
CAddrDB addrdb;
if (AddAddress(addrdb, addr))
printf("new ");
else
{
// make it try connecting again
CRITICAL_BLOCK(cs_mapAddresses)
if (mapAddresses.count(addr.GetKey()))
mapAddresses[addr.GetKey()].nLastFailed = 0;
}
addr.print();
CRITICAL_BLOCK(cs_mapIRCAddresses)
mapIRCAddresses.insert(make_pair(addr.GetKey(), addr));
addr.nTime = GetAdjustedTime() - 51 * 60;
if (AddAddress(addr))
printf("IRC got new address\n");
nGotIRCAddresses++;
}
else
{
printf("decode failed\n");
printf("IRC decode failed\n");
}
}
}
closesocket(hSocket);
hSocket = INVALID_SOCKET;
// IRC usually blocks TOR, so only try once
if (fTOR)
return;
if (GetTime() - nStart > 20 * 60)
{

10
irc.h
View File

@@ -1,10 +1,8 @@
// Copyright (c) 2009 Satoshi Nakamoto
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Distributed under the MIT/X11 software license, see the accompanying
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
extern bool RecvLine(SOCKET hSocket, string& strLine);
extern void ThreadIRCSeed(void* parg);
extern bool fRestartIRCSeed;
bool RecvLine(SOCKET hSocket, string& strLine);
void ThreadIRCSeed(void* parg);
extern map<vector<unsigned char>, CAddress> mapIRCAddresses;
extern CCriticalSection cs_mapIRCAddresses;
extern int nGotIRCAddresses;

24
json/LICENSE.txt Normal file
View File

@@ -0,0 +1,24 @@
The MIT License
Copyright (c) 2007 - 2009 John W. Wilkinson
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

18
json/json_spirit.h Normal file
View File

@@ -0,0 +1,18 @@
#ifndef JSON_SPIRIT
#define JSON_SPIRIT
// Copyright John W. Wilkinson 2007 - 2009.
// Distributed under the MIT License, see accompanying file LICENSE.txt
// json spirit version 4.03
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#endif
#include "json_spirit_value.h"
#include "json_spirit_reader.h"
#include "json_spirit_writer.h"
#include "json_spirit_utils.h"
#endif

View File

@@ -0,0 +1,54 @@
#ifndef JSON_SPIRIT_ERROR_POSITION
#define JSON_SPIRIT_ERROR_POSITION
// Copyright John W. Wilkinson 2007 - 2009.
// Distributed under the MIT License, see accompanying file LICENSE.txt
// json spirit version 4.03
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#endif
#include <string>
namespace json_spirit
{
// An Error_position exception is thrown by the "read_or_throw" functions below on finding an error.
// Note the "read_or_throw" functions are around 3 times slower than the standard functions "read"
// functions that return a bool.
//
struct Error_position
{
Error_position();
Error_position( unsigned int line, unsigned int column, const std::string& reason );
bool operator==( const Error_position& lhs ) const;
unsigned int line_;
unsigned int column_;
std::string reason_;
};
inline Error_position::Error_position()
: line_( 0 )
, column_( 0 )
{
}
inline Error_position::Error_position( unsigned int line, unsigned int column, const std::string& reason )
: line_( line )
, column_( column )
, reason_( reason )
{
}
inline bool Error_position::operator==( const Error_position& lhs ) const
{
if( this == &lhs ) return true;
return ( reason_ == lhs.reason_ ) &&
( line_ == lhs.line_ ) &&
( column_ == lhs.column_ );
}
}
#endif

137
json/json_spirit_reader.cpp Normal file
View File

@@ -0,0 +1,137 @@
// Copyright John W. Wilkinson 2007 - 2009.
// Distributed under the MIT License, see accompanying file LICENSE.txt
// json spirit version 4.03
#include "json_spirit_reader.h"
#include "json_spirit_reader_template.h"
using namespace json_spirit;
bool json_spirit::read( const std::string& s, Value& value )
{
return read_string( s, value );
}
void json_spirit::read_or_throw( const std::string& s, Value& value )
{
read_string_or_throw( s, value );
}
bool json_spirit::read( std::istream& is, Value& value )
{
return read_stream( is, value );
}
void json_spirit::read_or_throw( std::istream& is, Value& value )
{
read_stream_or_throw( is, value );
}
bool json_spirit::read( std::string::const_iterator& begin, std::string::const_iterator end, Value& value )
{
return read_range( begin, end, value );
}
void json_spirit::read_or_throw( std::string::const_iterator& begin, std::string::const_iterator end, Value& value )
{
begin = read_range_or_throw( begin, end, value );
}
#ifndef BOOST_NO_STD_WSTRING
bool json_spirit::read( const std::wstring& s, wValue& value )
{
return read_string( s, value );
}
void json_spirit::read_or_throw( const std::wstring& s, wValue& value )
{
read_string_or_throw( s, value );
}
bool json_spirit::read( std::wistream& is, wValue& value )
{
return read_stream( is, value );
}
void json_spirit::read_or_throw( std::wistream& is, wValue& value )
{
read_stream_or_throw( is, value );
}
bool json_spirit::read( std::wstring::const_iterator& begin, std::wstring::const_iterator end, wValue& value )
{
return read_range( begin, end, value );
}
void json_spirit::read_or_throw( std::wstring::const_iterator& begin, std::wstring::const_iterator end, wValue& value )
{
begin = read_range_or_throw( begin, end, value );
}
#endif
bool json_spirit::read( const std::string& s, mValue& value )
{
return read_string( s, value );
}
void json_spirit::read_or_throw( const std::string& s, mValue& value )
{
read_string_or_throw( s, value );
}
bool json_spirit::read( std::istream& is, mValue& value )
{
return read_stream( is, value );
}
void json_spirit::read_or_throw( std::istream& is, mValue& value )
{
read_stream_or_throw( is, value );
}
bool json_spirit::read( std::string::const_iterator& begin, std::string::const_iterator end, mValue& value )
{
return read_range( begin, end, value );
}
void json_spirit::read_or_throw( std::string::const_iterator& begin, std::string::const_iterator end, mValue& value )
{
begin = read_range_or_throw( begin, end, value );
}
#ifndef BOOST_NO_STD_WSTRING
bool json_spirit::read( const std::wstring& s, wmValue& value )
{
return read_string( s, value );
}
void json_spirit::read_or_throw( const std::wstring& s, wmValue& value )
{
read_string_or_throw( s, value );
}
bool json_spirit::read( std::wistream& is, wmValue& value )
{
return read_stream( is, value );
}
void json_spirit::read_or_throw( std::wistream& is, wmValue& value )
{
read_stream_or_throw( is, value );
}
bool json_spirit::read( std::wstring::const_iterator& begin, std::wstring::const_iterator end, wmValue& value )
{
return read_range( begin, end, value );
}
void json_spirit::read_or_throw( std::wstring::const_iterator& begin, std::wstring::const_iterator end, wmValue& value )
{
begin = read_range_or_throw( begin, end, value );
}
#endif

62
json/json_spirit_reader.h Normal file
View File

@@ -0,0 +1,62 @@
#ifndef JSON_SPIRIT_READER
#define JSON_SPIRIT_READER
// Copyright John W. Wilkinson 2007 - 2009.
// Distributed under the MIT License, see accompanying file LICENSE.txt
// json spirit version 4.03
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#endif
#include "json_spirit_value.h"
#include "json_spirit_error_position.h"
#include <iostream>
namespace json_spirit
{
// functions to reads a JSON values
bool read( const std::string& s, Value& value );
bool read( std::istream& is, Value& value );
bool read( std::string::const_iterator& begin, std::string::const_iterator end, Value& value );
void read_or_throw( const std::string& s, Value& value );
void read_or_throw( std::istream& is, Value& value );
void read_or_throw( std::string::const_iterator& begin, std::string::const_iterator end, Value& value );
#ifndef BOOST_NO_STD_WSTRING
bool read( const std::wstring& s, wValue& value );
bool read( std::wistream& is, wValue& value );
bool read( std::wstring::const_iterator& begin, std::wstring::const_iterator end, wValue& value );
void read_or_throw( const std::wstring& s, wValue& value );
void read_or_throw( std::wistream& is, wValue& value );
void read_or_throw( std::wstring::const_iterator& begin, std::wstring::const_iterator end, wValue& value );
#endif
bool read( const std::string& s, mValue& value );
bool read( std::istream& is, mValue& value );
bool read( std::string::const_iterator& begin, std::string::const_iterator end, mValue& value );
void read_or_throw( const std::string& s, mValue& value );
void read_or_throw( std::istream& is, mValue& value );
void read_or_throw( std::string::const_iterator& begin, std::string::const_iterator end, mValue& value );
#ifndef BOOST_NO_STD_WSTRING
bool read( const std::wstring& s, wmValue& value );
bool read( std::wistream& is, wmValue& value );
bool read( std::wstring::const_iterator& begin, std::wstring::const_iterator end, wmValue& value );
void read_or_throw( const std::wstring& s, wmValue& value );
void read_or_throw( std::wistream& is, wmValue& value );
void read_or_throw( std::wstring::const_iterator& begin, std::wstring::const_iterator end, wmValue& value );
#endif
}
#endif

View File

@@ -0,0 +1,612 @@
#ifndef JSON_SPIRIT_READER_TEMPLATE
#define JSON_SPIRIT_READER_TEMPLATE
// Copyright John W. Wilkinson 2007 - 2009.
// Distributed under the MIT License, see accompanying file LICENSE.txt
// json spirit version 4.03
#include "json_spirit_value.h"
#include "json_spirit_error_position.h"
//#define BOOST_SPIRIT_THREADSAFE // uncomment for multithreaded use, requires linking to boost.thread
#include <boost/bind.hpp>
#include <boost/function.hpp>
#include <boost/version.hpp>
#if BOOST_VERSION >= 103800
#include <boost/spirit/include/classic_core.hpp>
#include <boost/spirit/include/classic_confix.hpp>
#include <boost/spirit/include/classic_escape_char.hpp>
#include <boost/spirit/include/classic_multi_pass.hpp>
#include <boost/spirit/include/classic_position_iterator.hpp>
#define spirit_namespace boost::spirit::classic
#else
#include <boost/spirit/core.hpp>
#include <boost/spirit/utility/confix.hpp>
#include <boost/spirit/utility/escape_char.hpp>
#include <boost/spirit/iterator/multi_pass.hpp>
#include <boost/spirit/iterator/position_iterator.hpp>
#define spirit_namespace boost::spirit
#endif
namespace json_spirit
{
const spirit_namespace::int_parser < boost::int64_t > int64_p = spirit_namespace::int_parser < boost::int64_t >();
const spirit_namespace::uint_parser< boost::uint64_t > uint64_p = spirit_namespace::uint_parser< boost::uint64_t >();
template< class Iter_type >
bool is_eq( Iter_type first, Iter_type last, const char* c_str )
{
for( Iter_type i = first; i != last; ++i, ++c_str )
{
if( *c_str == 0 ) return false;
if( *i != *c_str ) return false;
}
return true;
}
template< class Char_type >
Char_type hex_to_num( const Char_type c )
{
if( ( c >= '0' ) && ( c <= '9' ) ) return c - '0';
if( ( c >= 'a' ) && ( c <= 'f' ) ) return c - 'a' + 10;
if( ( c >= 'A' ) && ( c <= 'F' ) ) return c - 'A' + 10;
return 0;
}
template< class Char_type, class Iter_type >
Char_type hex_str_to_char( Iter_type& begin )
{
const Char_type c1( *( ++begin ) );
const Char_type c2( *( ++begin ) );
return ( hex_to_num( c1 ) << 4 ) + hex_to_num( c2 );
}
template< class Char_type, class Iter_type >
Char_type unicode_str_to_char( Iter_type& begin )
{
const Char_type c1( *( ++begin ) );
const Char_type c2( *( ++begin ) );
const Char_type c3( *( ++begin ) );
const Char_type c4( *( ++begin ) );
return ( hex_to_num( c1 ) << 12 ) +
( hex_to_num( c2 ) << 8 ) +
( hex_to_num( c3 ) << 4 ) +
hex_to_num( c4 );
}
template< class String_type >
void append_esc_char_and_incr_iter( String_type& s,
typename String_type::const_iterator& begin,
typename String_type::const_iterator end )
{
typedef typename String_type::value_type Char_type;
const Char_type c2( *begin );
switch( c2 )
{
case 't': s += '\t'; break;
case 'b': s += '\b'; break;
case 'f': s += '\f'; break;
case 'n': s += '\n'; break;
case 'r': s += '\r'; break;
case '\\': s += '\\'; break;
case '/': s += '/'; break;
case '"': s += '"'; break;
case 'x':
{
if( end - begin >= 3 ) // expecting "xHH..."
{
s += hex_str_to_char< Char_type >( begin );
}
break;
}
case 'u':
{
if( end - begin >= 5 ) // expecting "uHHHH..."
{
s += unicode_str_to_char< Char_type >( begin );
}
break;
}
}
}
template< class String_type >
String_type substitute_esc_chars( typename String_type::const_iterator begin,
typename String_type::const_iterator end )
{
typedef typename String_type::const_iterator Iter_type;
if( end - begin < 2 ) return String_type( begin, end );
String_type result;
result.reserve( end - begin );
const Iter_type end_minus_1( end - 1 );
Iter_type substr_start = begin;
Iter_type i = begin;
for( ; i < end_minus_1; ++i )
{
if( *i == '\\' )
{
result.append( substr_start, i );
++i; // skip the '\'
append_esc_char_and_incr_iter( result, i, end );
substr_start = i + 1;
}
}
result.append( substr_start, end );
return result;
}
template< class String_type >
String_type get_str_( typename String_type::const_iterator begin,
typename String_type::const_iterator end )
{
assert( end - begin >= 2 );
typedef typename String_type::const_iterator Iter_type;
Iter_type str_without_quotes( ++begin );
Iter_type end_without_quotes( --end );
return substitute_esc_chars< String_type >( str_without_quotes, end_without_quotes );
}
inline std::string get_str( std::string::const_iterator begin, std::string::const_iterator end )
{
return get_str_< std::string >( begin, end );
}
inline std::wstring get_str( std::wstring::const_iterator begin, std::wstring::const_iterator end )
{
return get_str_< std::wstring >( begin, end );
}
template< class String_type, class Iter_type >
String_type get_str( Iter_type begin, Iter_type end )
{
const String_type tmp( begin, end ); // convert multipass iterators to string iterators
return get_str( tmp.begin(), tmp.end() );
}
// this class's methods get called by the spirit parse resulting
// in the creation of a JSON object or array
//
// NB Iter_type could be a std::string iterator, wstring iterator, a position iterator or a multipass iterator
//
template< class Value_type, class Iter_type >
class Semantic_actions
{
public:
typedef typename Value_type::Config_type Config_type;
typedef typename Config_type::String_type String_type;
typedef typename Config_type::Object_type Object_type;
typedef typename Config_type::Array_type Array_type;
typedef typename String_type::value_type Char_type;
Semantic_actions( Value_type& value )
: value_( value )
, current_p_( 0 )
{
}
void begin_obj( Char_type c )
{
assert( c == '{' );
begin_compound< Object_type >();
}
void end_obj( Char_type c )
{
assert( c == '}' );
end_compound();
}
void begin_array( Char_type c )
{
assert( c == '[' );
begin_compound< Array_type >();
}
void end_array( Char_type c )
{
assert( c == ']' );
end_compound();
}
void new_name( Iter_type begin, Iter_type end )
{
assert( current_p_->type() == obj_type );
name_ = get_str< String_type >( begin, end );
}
void new_str( Iter_type begin, Iter_type end )
{
add_to_current( get_str< String_type >( begin, end ) );
}
void new_true( Iter_type begin, Iter_type end )
{
assert( is_eq( begin, end, "true" ) );
add_to_current( true );
}
void new_false( Iter_type begin, Iter_type end )
{
assert( is_eq( begin, end, "false" ) );
add_to_current( false );
}
void new_null( Iter_type begin, Iter_type end )
{
assert( is_eq( begin, end, "null" ) );
add_to_current( Value_type() );
}
void new_int( boost::int64_t i )
{
add_to_current( i );
}
void new_uint64( boost::uint64_t ui )
{
add_to_current( ui );
}
void new_real( double d )
{
add_to_current( d );
}
private:
Semantic_actions& operator=( const Semantic_actions& );
// to prevent "assignment operator could not be generated" warning
Value_type* add_first( const Value_type& value )
{
assert( current_p_ == 0 );
value_ = value;
current_p_ = &value_;
return current_p_;
}
template< class Array_or_obj >
void begin_compound()
{
if( current_p_ == 0 )
{
add_first( Array_or_obj() );
}
else
{
stack_.push_back( current_p_ );
Array_or_obj new_array_or_obj; // avoid copy by building new array or object in place
current_p_ = add_to_current( new_array_or_obj );
}
}
void end_compound()
{
if( current_p_ != &value_ )
{
current_p_ = stack_.back();
stack_.pop_back();
}
}
Value_type* add_to_current( const Value_type& value )
{
if( current_p_ == 0 )
{
return add_first( value );
}
else if( current_p_->type() == array_type )
{
current_p_->get_array().push_back( value );
return &current_p_->get_array().back();
}
assert( current_p_->type() == obj_type );
return &Config_type::add( current_p_->get_obj(), name_, value );
}
Value_type& value_; // this is the object or array that is being created
Value_type* current_p_; // the child object or array that is currently being constructed
std::vector< Value_type* > stack_; // previous child objects and arrays
String_type name_; // of current name/value pair
};
template< typename Iter_type >
void throw_error( spirit_namespace::position_iterator< Iter_type > i, const std::string& reason )
{
throw Error_position( i.get_position().line, i.get_position().column, reason );
}
template< typename Iter_type >
void throw_error( Iter_type i, const std::string& reason )
{
throw reason;
}
// the spirit grammer
//
template< class Value_type, class Iter_type >
class Json_grammer : public spirit_namespace::grammar< Json_grammer< Value_type, Iter_type > >
{
public:
typedef Semantic_actions< Value_type, Iter_type > Semantic_actions_t;
Json_grammer( Semantic_actions_t& semantic_actions )
: actions_( semantic_actions )
{
}
static void throw_not_value( Iter_type begin, Iter_type end )
{
throw_error( begin, "not a value" );
}
static void throw_not_array( Iter_type begin, Iter_type end )
{
throw_error( begin, "not an array" );
}
static void throw_not_object( Iter_type begin, Iter_type end )
{
throw_error( begin, "not an object" );
}
static void throw_not_pair( Iter_type begin, Iter_type end )
{
throw_error( begin, "not a pair" );
}
static void throw_not_colon( Iter_type begin, Iter_type end )
{
throw_error( begin, "no colon in pair" );
}
static void throw_not_string( Iter_type begin, Iter_type end )
{
throw_error( begin, "not a string" );
}
template< typename ScannerT >
class definition
{
public:
definition( const Json_grammer& self )
{
using namespace spirit_namespace;
typedef typename Value_type::String_type::value_type Char_type;
// first we convert the semantic action class methods to functors with the
// parameter signature expected by spirit
typedef boost::function< void( Char_type ) > Char_action;
typedef boost::function< void( Iter_type, Iter_type ) > Str_action;
typedef boost::function< void( double ) > Real_action;
typedef boost::function< void( boost::int64_t ) > Int_action;
typedef boost::function< void( boost::uint64_t ) > Uint64_action;
Char_action begin_obj ( boost::bind( &Semantic_actions_t::begin_obj, &self.actions_, _1 ) );
Char_action end_obj ( boost::bind( &Semantic_actions_t::end_obj, &self.actions_, _1 ) );
Char_action begin_array( boost::bind( &Semantic_actions_t::begin_array, &self.actions_, _1 ) );
Char_action end_array ( boost::bind( &Semantic_actions_t::end_array, &self.actions_, _1 ) );
Str_action new_name ( boost::bind( &Semantic_actions_t::new_name, &self.actions_, _1, _2 ) );
Str_action new_str ( boost::bind( &Semantic_actions_t::new_str, &self.actions_, _1, _2 ) );
Str_action new_true ( boost::bind( &Semantic_actions_t::new_true, &self.actions_, _1, _2 ) );
Str_action new_false ( boost::bind( &Semantic_actions_t::new_false, &self.actions_, _1, _2 ) );
Str_action new_null ( boost::bind( &Semantic_actions_t::new_null, &self.actions_, _1, _2 ) );
Real_action new_real ( boost::bind( &Semantic_actions_t::new_real, &self.actions_, _1 ) );
Int_action new_int ( boost::bind( &Semantic_actions_t::new_int, &self.actions_, _1 ) );
Uint64_action new_uint64 ( boost::bind( &Semantic_actions_t::new_uint64, &self.actions_, _1 ) );
// actual grammer
json_
= value_ | eps_p[ &throw_not_value ]
;
value_
= string_[ new_str ]
| number_
| object_
| array_
| str_p( "true" ) [ new_true ]
| str_p( "false" )[ new_false ]
| str_p( "null" ) [ new_null ]
;
object_
= ch_p('{')[ begin_obj ]
>> !members_
>> ( ch_p('}')[ end_obj ] | eps_p[ &throw_not_object ] )
;
members_
= pair_ >> *( ',' >> pair_ )
;
pair_
= string_[ new_name ]
>> ( ':' | eps_p[ &throw_not_colon ] )
>> ( value_ | eps_p[ &throw_not_value ] )
;
array_
= ch_p('[')[ begin_array ]
>> !elements_
>> ( ch_p(']')[ end_array ] | eps_p[ &throw_not_array ] )
;
elements_
= value_ >> *( ',' >> value_ )
;
string_
= lexeme_d // this causes white space inside a string to be retained
[
confix_p
(
'"',
*lex_escape_ch_p,
'"'
)
]
;
number_
= strict_real_p[ new_real ]
| int64_p [ new_int ]
| uint64_p [ new_uint64 ]
;
}
spirit_namespace::rule< ScannerT > json_, object_, members_, pair_, array_, elements_, value_, string_, number_;
const spirit_namespace::rule< ScannerT >& start() const { return json_; }
};
private:
Json_grammer& operator=( const Json_grammer& ); // to prevent "assignment operator could not be generated" warning
Semantic_actions_t& actions_;
};
template< class Iter_type, class Value_type >
Iter_type read_range_or_throw( Iter_type begin, Iter_type end, Value_type& value )
{
Semantic_actions< Value_type, Iter_type > semantic_actions( value );
const spirit_namespace::parse_info< Iter_type > info =
spirit_namespace::parse( begin, end,
Json_grammer< Value_type, Iter_type >( semantic_actions ),
spirit_namespace::space_p );
if( !info.hit )
{
assert( false ); // in theory exception should already have been thrown
throw_error( info.stop, "error" );
}
return info.stop;
}
template< class Iter_type, class Value_type >
void add_posn_iter_and_read_range_or_throw( Iter_type begin, Iter_type end, Value_type& value )
{
typedef spirit_namespace::position_iterator< Iter_type > Posn_iter_t;
const Posn_iter_t posn_begin( begin, end );
const Posn_iter_t posn_end( end, end );
read_range_or_throw( posn_begin, posn_end, value );
}
template< class Iter_type, class Value_type >
bool read_range( Iter_type& begin, Iter_type end, Value_type& value )
{
try
{
begin = read_range_or_throw( begin, end, value );
return true;
}
catch( ... )
{
return false;
}
}
template< class String_type, class Value_type >
void read_string_or_throw( const String_type& s, Value_type& value )
{
add_posn_iter_and_read_range_or_throw( s.begin(), s.end(), value );
}
template< class String_type, class Value_type >
bool read_string( const String_type& s, Value_type& value )
{
typename String_type::const_iterator begin = s.begin();
return read_range( begin, s.end(), value );
}
template< class Istream_type >
struct Multi_pass_iters
{
typedef typename Istream_type::char_type Char_type;
typedef std::istream_iterator< Char_type, Char_type > istream_iter;
typedef spirit_namespace::multi_pass< istream_iter > Mp_iter;
Multi_pass_iters( Istream_type& is )
{
is.unsetf( std::ios::skipws );
begin_ = spirit_namespace::make_multi_pass( istream_iter( is ) );
end_ = spirit_namespace::make_multi_pass( istream_iter() );
}
Mp_iter begin_;
Mp_iter end_;
};
template< class Istream_type, class Value_type >
bool read_stream( Istream_type& is, Value_type& value )
{
Multi_pass_iters< Istream_type > mp_iters( is );
return read_range( mp_iters.begin_, mp_iters.end_, value );
}
template< class Istream_type, class Value_type >
void read_stream_or_throw( Istream_type& is, Value_type& value )
{
const Multi_pass_iters< Istream_type > mp_iters( is );
add_posn_iter_and_read_range_or_throw( mp_iters.begin_, mp_iters.end_, value );
}
}
#endif

View File

@@ -0,0 +1,70 @@
#ifndef JSON_SPIRIT_READ_STREAM
#define JSON_SPIRIT_READ_STREAM
// Copyright John W. Wilkinson 2007 - 2009.
// Distributed under the MIT License, see accompanying file LICENSE.txt
// json spirit version 4.03
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#endif
#include "json_spirit_reader_template.h"
namespace json_spirit
{
// these classes allows you to read multiple top level contiguous values from a stream,
// the normal stream read functions have a bug that prevent multiple top level values
// from being read unless they are separated by spaces
template< class Istream_type, class Value_type >
class Stream_reader
{
public:
Stream_reader( Istream_type& is )
: iters_( is )
{
}
bool read_next( Value_type& value )
{
return read_range( iters_.begin_, iters_.end_, value );
}
private:
typedef Multi_pass_iters< Istream_type > Mp_iters;
Mp_iters iters_;
};
template< class Istream_type, class Value_type >
class Stream_reader_thrower
{
public:
Stream_reader_thrower( Istream_type& is )
: iters_( is )
, posn_begin_( iters_.begin_, iters_.end_ )
, posn_end_( iters_.end_, iters_.end_ )
{
}
void read_next( Value_type& value )
{
posn_begin_ = read_range_or_throw( posn_begin_, posn_end_, value );
}
private:
typedef Multi_pass_iters< Istream_type > Mp_iters;
typedef spirit_namespace::position_iterator< typename Mp_iters::Mp_iter > Posn_iter_t;
Mp_iters iters_;
Posn_iter_t posn_begin_, posn_end_;
};
}
#endif

61
json/json_spirit_utils.h Normal file
View File

@@ -0,0 +1,61 @@
#ifndef JSON_SPIRIT_UTILS
#define JSON_SPIRIT_UTILS
// Copyright John W. Wilkinson 2007 - 2009.
// Distributed under the MIT License, see accompanying file LICENSE.txt
// json spirit version 4.03
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#endif
#include "json_spirit_value.h"
#include <map>
namespace json_spirit
{
template< class Obj_t, class Map_t >
void obj_to_map( const Obj_t& obj, Map_t& mp_obj )
{
mp_obj.clear();
for( typename Obj_t::const_iterator i = obj.begin(); i != obj.end(); ++i )
{
mp_obj[ i->name_ ] = i->value_;
}
}
template< class Obj_t, class Map_t >
void map_to_obj( const Map_t& mp_obj, Obj_t& obj )
{
obj.clear();
for( typename Map_t::const_iterator i = mp_obj.begin(); i != mp_obj.end(); ++i )
{
obj.push_back( typename Obj_t::value_type( i->first, i->second ) );
}
}
typedef std::map< std::string, Value > Mapped_obj;
#ifndef BOOST_NO_STD_WSTRING
typedef std::map< std::wstring, wValue > wMapped_obj;
#endif
template< class Object_type, class String_type >
const typename Object_type::value_type::Value_type& find_value( const Object_type& obj, const String_type& name )
{
for( typename Object_type::const_iterator i = obj.begin(); i != obj.end(); ++i )
{
if( i->name_ == name )
{
return i->value_;
}
}
return Object_type::value_type::Value_type::null;
}
}
#endif

View File

@@ -0,0 +1,8 @@
/* Copyright (c) 2007 John W Wilkinson
This source code can be used for any purpose as long as
this comment is retained. */
// json spirit version 2.00
#include "json_spirit_value.h"

534
json/json_spirit_value.h Normal file
View File

@@ -0,0 +1,534 @@
#ifndef JSON_SPIRIT_VALUE
#define JSON_SPIRIT_VALUE
// Copyright John W. Wilkinson 2007 - 2009.
// Distributed under the MIT License, see accompanying file LICENSE.txt
// json spirit version 4.03
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#endif
#include <vector>
#include <map>
#include <string>
#include <cassert>
#include <sstream>
#include <stdexcept>
#include <boost/config.hpp>
#include <boost/cstdint.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/variant.hpp>
namespace json_spirit
{
enum Value_type{ obj_type, array_type, str_type, bool_type, int_type, real_type, null_type };
static const char* Value_type_name[]={"obj", "array", "str", "bool", "int", "real", "null"};
template< class Config > // Config determines whether the value uses std::string or std::wstring and
// whether JSON Objects are represented as vectors or maps
class Value_impl
{
public:
typedef Config Config_type;
typedef typename Config::String_type String_type;
typedef typename Config::Object_type Object;
typedef typename Config::Array_type Array;
typedef typename String_type::const_pointer Const_str_ptr; // eg const char*
Value_impl(); // creates null value
Value_impl( Const_str_ptr value );
Value_impl( const String_type& value );
Value_impl( const Object& value );
Value_impl( const Array& value );
Value_impl( bool value );
Value_impl( int value );
Value_impl( boost::int64_t value );
Value_impl( boost::uint64_t value );
Value_impl( double value );
Value_impl( const Value_impl& other );
bool operator==( const Value_impl& lhs ) const;
Value_impl& operator=( const Value_impl& lhs );
Value_type type() const;
bool is_uint64() const;
bool is_null() const;
const String_type& get_str() const;
const Object& get_obj() const;
const Array& get_array() const;
bool get_bool() const;
int get_int() const;
boost::int64_t get_int64() const;
boost::uint64_t get_uint64() const;
double get_real() const;
Object& get_obj();
Array& get_array();
template< typename T > T get_value() const; // example usage: int i = value.get_value< int >();
// or double d = value.get_value< double >();
static const Value_impl null;
private:
void check_type( const Value_type vtype ) const;
typedef boost::variant< String_type,
boost::recursive_wrapper< Object >, boost::recursive_wrapper< Array >,
bool, boost::int64_t, double > Variant;
Value_type type_;
Variant v_;
bool is_uint64_;
};
// vector objects
template< class Config >
struct Pair_impl
{
typedef typename Config::String_type String_type;
typedef typename Config::Value_type Value_type;
Pair_impl( const String_type& name, const Value_type& value );
bool operator==( const Pair_impl& lhs ) const;
String_type name_;
Value_type value_;
};
template< class String >
struct Config_vector
{
typedef String String_type;
typedef Value_impl< Config_vector > Value_type;
typedef Pair_impl < Config_vector > Pair_type;
typedef std::vector< Value_type > Array_type;
typedef std::vector< Pair_type > Object_type;
static Value_type& add( Object_type& obj, const String_type& name, const Value_type& value )
{
obj.push_back( Pair_type( name , value ) );
return obj.back().value_;
}
static String_type get_name( const Pair_type& pair )
{
return pair.name_;
}
static Value_type get_value( const Pair_type& pair )
{
return pair.value_;
}
};
// typedefs for ASCII
typedef Config_vector< std::string > Config;
typedef Config::Value_type Value;
typedef Config::Pair_type Pair;
typedef Config::Object_type Object;
typedef Config::Array_type Array;
// typedefs for Unicode
#ifndef BOOST_NO_STD_WSTRING
typedef Config_vector< std::wstring > wConfig;
typedef wConfig::Value_type wValue;
typedef wConfig::Pair_type wPair;
typedef wConfig::Object_type wObject;
typedef wConfig::Array_type wArray;
#endif
// map objects
template< class String >
struct Config_map
{
typedef String String_type;
typedef Value_impl< Config_map > Value_type;
typedef std::vector< Value_type > Array_type;
typedef std::map< String_type, Value_type > Object_type;
typedef typename Object_type::value_type Pair_type;
static Value_type& add( Object_type& obj, const String_type& name, const Value_type& value )
{
return obj[ name ] = value;
}
static String_type get_name( const Pair_type& pair )
{
return pair.first;
}
static Value_type get_value( const Pair_type& pair )
{
return pair.second;
}
};
// typedefs for ASCII
typedef Config_map< std::string > mConfig;
typedef mConfig::Value_type mValue;
typedef mConfig::Object_type mObject;
typedef mConfig::Array_type mArray;
// typedefs for Unicode
#ifndef BOOST_NO_STD_WSTRING
typedef Config_map< std::wstring > wmConfig;
typedef wmConfig::Value_type wmValue;
typedef wmConfig::Object_type wmObject;
typedef wmConfig::Array_type wmArray;
#endif
///////////////////////////////////////////////////////////////////////////////////////////////
//
// implementation
template< class Config >
const Value_impl< Config > Value_impl< Config >::null;
template< class Config >
Value_impl< Config >::Value_impl()
: type_( null_type )
, is_uint64_( false )
{
}
template< class Config >
Value_impl< Config >::Value_impl( const Const_str_ptr value )
: type_( str_type )
, v_( String_type( value ) )
, is_uint64_( false )
{
}
template< class Config >
Value_impl< Config >::Value_impl( const String_type& value )
: type_( str_type )
, v_( value )
, is_uint64_( false )
{
}
template< class Config >
Value_impl< Config >::Value_impl( const Object& value )
: type_( obj_type )
, v_( value )
, is_uint64_( false )
{
}
template< class Config >
Value_impl< Config >::Value_impl( const Array& value )
: type_( array_type )
, v_( value )
, is_uint64_( false )
{
}
template< class Config >
Value_impl< Config >::Value_impl( bool value )
: type_( bool_type )
, v_( value )
, is_uint64_( false )
{
}
template< class Config >
Value_impl< Config >::Value_impl( int value )
: type_( int_type )
, v_( static_cast< boost::int64_t >( value ) )
, is_uint64_( false )
{
}
template< class Config >
Value_impl< Config >::Value_impl( boost::int64_t value )
: type_( int_type )
, v_( value )
, is_uint64_( false )
{
}
template< class Config >
Value_impl< Config >::Value_impl( boost::uint64_t value )
: type_( int_type )
, v_( static_cast< boost::int64_t >( value ) )
, is_uint64_( true )
{
}
template< class Config >
Value_impl< Config >::Value_impl( double value )
: type_( real_type )
, v_( value )
, is_uint64_( false )
{
}
template< class Config >
Value_impl< Config >::Value_impl( const Value_impl< Config >& other )
: type_( other.type() )
, v_( other.v_ )
, is_uint64_( other.is_uint64_ )
{
}
template< class Config >
Value_impl< Config >& Value_impl< Config >::operator=( const Value_impl& lhs )
{
Value_impl tmp( lhs );
std::swap( type_, tmp.type_ );
std::swap( v_, tmp.v_ );
std::swap( is_uint64_, tmp.is_uint64_ );
return *this;
}
template< class Config >
bool Value_impl< Config >::operator==( const Value_impl& lhs ) const
{
if( this == &lhs ) return true;
if( type() != lhs.type() ) return false;
return v_ == lhs.v_;
}
template< class Config >
Value_type Value_impl< Config >::type() const
{
return type_;
}
template< class Config >
bool Value_impl< Config >::is_uint64() const
{
return is_uint64_;
}
template< class Config >
bool Value_impl< Config >::is_null() const
{
return type() == null_type;
}
template< class Config >
void Value_impl< Config >::check_type( const Value_type vtype ) const
{
if( type() != vtype )
{
std::ostringstream os;
/// satoshi: tell the types by name instead of by number
os << "value is type " << Value_type_name[type()] << ", expected " << Value_type_name[vtype];
throw std::runtime_error( os.str() );
}
}
template< class Config >
const typename Config::String_type& Value_impl< Config >::get_str() const
{
check_type( str_type );
return *boost::get< String_type >( &v_ );
}
template< class Config >
const typename Value_impl< Config >::Object& Value_impl< Config >::get_obj() const
{
check_type( obj_type );
return *boost::get< Object >( &v_ );
}
template< class Config >
const typename Value_impl< Config >::Array& Value_impl< Config >::get_array() const
{
check_type( array_type );
return *boost::get< Array >( &v_ );
}
template< class Config >
bool Value_impl< Config >::get_bool() const
{
check_type( bool_type );
return boost::get< bool >( v_ );
}
template< class Config >
int Value_impl< Config >::get_int() const
{
check_type( int_type );
return static_cast< int >( get_int64() );
}
template< class Config >
boost::int64_t Value_impl< Config >::get_int64() const
{
check_type( int_type );
return boost::get< boost::int64_t >( v_ );
}
template< class Config >
boost::uint64_t Value_impl< Config >::get_uint64() const
{
check_type( int_type );
return static_cast< boost::uint64_t >( get_int64() );
}
template< class Config >
double Value_impl< Config >::get_real() const
{
if( type() == int_type )
{
return is_uint64() ? static_cast< double >( get_uint64() )
: static_cast< double >( get_int64() );
}
check_type( real_type );
return boost::get< double >( v_ );
}
template< class Config >
typename Value_impl< Config >::Object& Value_impl< Config >::get_obj()
{
check_type( obj_type );
return *boost::get< Object >( &v_ );
}
template< class Config >
typename Value_impl< Config >::Array& Value_impl< Config >::get_array()
{
check_type( array_type );
return *boost::get< Array >( &v_ );
}
template< class Config >
Pair_impl< Config >::Pair_impl( const String_type& name, const Value_type& value )
: name_( name )
, value_( value )
{
}
template< class Config >
bool Pair_impl< Config >::operator==( const Pair_impl< Config >& lhs ) const
{
if( this == &lhs ) return true;
return ( name_ == lhs.name_ ) && ( value_ == lhs.value_ );
}
// converts a C string, ie. 8 bit char array, to a string object
//
template < class String_type >
String_type to_str( const char* c_str )
{
String_type result;
for( const char* p = c_str; *p != 0; ++p )
{
result += *p;
}
return result;
}
//
namespace internal_
{
template< typename T >
struct Type_to_type
{
};
template< class Value >
int get_value( const Value& value, Type_to_type< int > )
{
return value.get_int();
}
template< class Value >
boost::int64_t get_value( const Value& value, Type_to_type< boost::int64_t > )
{
return value.get_int64();
}
template< class Value >
boost::uint64_t get_value( const Value& value, Type_to_type< boost::uint64_t > )
{
return value.get_uint64();
}
template< class Value >
double get_value( const Value& value, Type_to_type< double > )
{
return value.get_real();
}
template< class Value >
typename Value::String_type get_value( const Value& value, Type_to_type< typename Value::String_type > )
{
return value.get_str();
}
template< class Value >
typename Value::Array get_value( const Value& value, Type_to_type< typename Value::Array > )
{
return value.get_array();
}
template< class Value >
typename Value::Object get_value( const Value& value, Type_to_type< typename Value::Object > )
{
return value.get_obj();
}
template< class Value >
bool get_value( const Value& value, Type_to_type< bool > )
{
return value.get_bool();
}
}
template< class Config >
template< typename T >
T Value_impl< Config >::get_value() const
{
return internal_::get_value( *this, internal_::Type_to_type< T >() );
}
}
#endif

View File

@@ -0,0 +1,95 @@
// Copyright John W. Wilkinson 2007 - 2009.
// Distributed under the MIT License, see accompanying file LICENSE.txt
// json spirit version 4.03
#include "json_spirit_writer.h"
#include "json_spirit_writer_template.h"
void json_spirit::write( const Value& value, std::ostream& os )
{
write_stream( value, os, false );
}
void json_spirit::write_formatted( const Value& value, std::ostream& os )
{
write_stream( value, os, true );
}
std::string json_spirit::write( const Value& value )
{
return write_string( value, false );
}
std::string json_spirit::write_formatted( const Value& value )
{
return write_string( value, true );
}
#ifndef BOOST_NO_STD_WSTRING
void json_spirit::write( const wValue& value, std::wostream& os )
{
write_stream( value, os, false );
}
void json_spirit::write_formatted( const wValue& value, std::wostream& os )
{
write_stream( value, os, true );
}
std::wstring json_spirit::write( const wValue& value )
{
return write_string( value, false );
}
std::wstring json_spirit::write_formatted( const wValue& value )
{
return write_string( value, true );
}
#endif
void json_spirit::write( const mValue& value, std::ostream& os )
{
write_stream( value, os, false );
}
void json_spirit::write_formatted( const mValue& value, std::ostream& os )
{
write_stream( value, os, true );
}
std::string json_spirit::write( const mValue& value )
{
return write_string( value, false );
}
std::string json_spirit::write_formatted( const mValue& value )
{
return write_string( value, true );
}
#ifndef BOOST_NO_STD_WSTRING
void json_spirit::write( const wmValue& value, std::wostream& os )
{
write_stream( value, os, false );
}
void json_spirit::write_formatted( const wmValue& value, std::wostream& os )
{
write_stream( value, os, true );
}
std::wstring json_spirit::write( const wmValue& value )
{
return write_string( value, false );
}
std::wstring json_spirit::write_formatted( const wmValue& value )
{
return write_string( value, true );
}
#endif

50
json/json_spirit_writer.h Normal file
View File

@@ -0,0 +1,50 @@
#ifndef JSON_SPIRIT_WRITER
#define JSON_SPIRIT_WRITER
// Copyright John W. Wilkinson 2007 - 2009.
// Distributed under the MIT License, see accompanying file LICENSE.txt
// json spirit version 4.03
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#endif
#include "json_spirit_value.h"
#include <iostream>
namespace json_spirit
{
// functions to convert JSON Values to text,
// the "formatted" versions add whitespace to format the output nicely
void write ( const Value& value, std::ostream& os );
void write_formatted( const Value& value, std::ostream& os );
std::string write ( const Value& value );
std::string write_formatted( const Value& value );
#ifndef BOOST_NO_STD_WSTRING
void write ( const wValue& value, std::wostream& os );
void write_formatted( const wValue& value, std::wostream& os );
std::wstring write ( const wValue& value );
std::wstring write_formatted( const wValue& value );
#endif
void write ( const mValue& value, std::ostream& os );
void write_formatted( const mValue& value, std::ostream& os );
std::string write ( const mValue& value );
std::string write_formatted( const mValue& value );
#ifndef BOOST_NO_STD_WSTRING
void write ( const wmValue& value, std::wostream& os );
void write_formatted( const wmValue& value, std::wostream& os );
std::wstring write ( const wmValue& value );
std::wstring write_formatted( const wmValue& value );
#endif
}
#endif

View File

@@ -0,0 +1,245 @@
#ifndef JSON_SPIRIT_WRITER_TEMPLATE
#define JSON_SPIRIT_WRITER_TEMPLATE
// Copyright John W. Wilkinson 2007 - 2009.
// Distributed under the MIT License, see accompanying file LICENSE.txt
// json spirit version 4.03
#include "json_spirit_value.h"
#include <cassert>
#include <sstream>
#include <iomanip>
namespace json_spirit
{
inline char to_hex_char( unsigned int c )
{
assert( c <= 0xF );
const char ch = static_cast< char >( c );
if( ch < 10 ) return '0' + ch;
return 'A' - 10 + ch;
}
template< class String_type >
String_type non_printable_to_string( unsigned int c )
{
typedef typename String_type::value_type Char_type;
String_type result( 6, '\\' );
result[1] = 'u';
result[ 5 ] = to_hex_char( c & 0x000F ); c >>= 4;
result[ 4 ] = to_hex_char( c & 0x000F ); c >>= 4;
result[ 3 ] = to_hex_char( c & 0x000F ); c >>= 4;
result[ 2 ] = to_hex_char( c & 0x000F );
return result;
}
template< typename Char_type, class String_type >
bool add_esc_char( Char_type c, String_type& s )
{
switch( c )
{
case '"': s += to_str< String_type >( "\\\"" ); return true;
case '\\': s += to_str< String_type >( "\\\\" ); return true;
case '\b': s += to_str< String_type >( "\\b" ); return true;
case '\f': s += to_str< String_type >( "\\f" ); return true;
case '\n': s += to_str< String_type >( "\\n" ); return true;
case '\r': s += to_str< String_type >( "\\r" ); return true;
case '\t': s += to_str< String_type >( "\\t" ); return true;
}
return false;
}
template< class String_type >
String_type add_esc_chars( const String_type& s )
{
typedef typename String_type::const_iterator Iter_type;
typedef typename String_type::value_type Char_type;
String_type result;
const Iter_type end( s.end() );
for( Iter_type i = s.begin(); i != end; ++i )
{
const Char_type c( *i );
if( add_esc_char( c, result ) ) continue;
const wint_t unsigned_c( ( c >= 0 ) ? c : 256 + c );
if( iswprint( unsigned_c ) )
{
result += c;
}
else
{
result += non_printable_to_string< String_type >( unsigned_c );
}
}
return result;
}
// this class generates the JSON text,
// it keeps track of the indentation level etc.
//
template< class Value_type, class Ostream_type >
class Generator
{
typedef typename Value_type::Config_type Config_type;
typedef typename Config_type::String_type String_type;
typedef typename Config_type::Object_type Object_type;
typedef typename Config_type::Array_type Array_type;
typedef typename String_type::value_type Char_type;
typedef typename Object_type::value_type Obj_member_type;
public:
Generator( const Value_type& value, Ostream_type& os, bool pretty )
: os_( os )
, indentation_level_( 0 )
, pretty_( pretty )
{
output( value );
}
private:
void output( const Value_type& value )
{
switch( value.type() )
{
case obj_type: output( value.get_obj() ); break;
case array_type: output( value.get_array() ); break;
case str_type: output( value.get_str() ); break;
case bool_type: output( value.get_bool() ); break;
case int_type: output_int( value ); break;
case real_type: os_ << std::showpoint << std::setprecision( 16 )
<< value.get_real(); break;
case null_type: os_ << "null"; break;
default: assert( false );
}
}
void output( const Object_type& obj )
{
output_array_or_obj( obj, '{', '}' );
}
void output( const Array_type& arr )
{
output_array_or_obj( arr, '[', ']' );
}
void output( const Obj_member_type& member )
{
output( Config_type::get_name( member ) ); space();
os_ << ':'; space();
output( Config_type::get_value( member ) );
}
void output_int( const Value_type& value )
{
if( value.is_uint64() )
{
os_ << value.get_uint64();
}
else
{
os_ << value.get_int64();
}
}
void output( const String_type& s )
{
os_ << '"' << add_esc_chars( s ) << '"';
}
void output( bool b )
{
os_ << to_str< String_type >( b ? "true" : "false" );
}
template< class T >
void output_array_or_obj( const T& t, Char_type start_char, Char_type end_char )
{
os_ << start_char; new_line();
++indentation_level_;
for( typename T::const_iterator i = t.begin(); i != t.end(); ++i )
{
indent(); output( *i );
typename T::const_iterator next = i;
if( ++next != t.end())
{
os_ << ',';
}
new_line();
}
--indentation_level_;
indent(); os_ << end_char;
}
void indent()
{
if( !pretty_ ) return;
for( int i = 0; i < indentation_level_; ++i )
{
os_ << " ";
}
}
void space()
{
if( pretty_ ) os_ << ' ';
}
void new_line()
{
if( pretty_ ) os_ << '\n';
}
Generator& operator=( const Generator& ); // to prevent "assignment operator could not be generated" warning
Ostream_type& os_;
int indentation_level_;
bool pretty_;
};
template< class Value_type, class Ostream_type >
void write_stream( const Value_type& value, Ostream_type& os, bool pretty )
{
Generator< Value_type, Ostream_type >( value, os, pretty );
}
template< class Value_type >
typename Value_type::String_type write_string( const Value_type& value, bool pretty )
{
typedef typename Value_type::String_type::value_type Char_type;
std::basic_ostringstream< Char_type > os;
write_stream( value, os, pretty );
return os.str();
}
}
#endif

14
key.h
View File

@@ -35,7 +35,7 @@ public:
};
// secure_allocator is defined is serialize.h
// secure_allocator is defined in serialize.h
typedef vector<unsigned char, secure_allocator<unsigned char> > CPrivKey;
@@ -44,6 +44,7 @@ class CKey
{
protected:
EC_KEY* pkey;
bool fSet;
public:
CKey()
@@ -51,6 +52,7 @@ public:
pkey = EC_KEY_new_by_curve_name(NID_secp256k1);
if (pkey == NULL)
throw key_error("CKey::CKey() : EC_KEY_new_by_curve_name failed");
fSet = false;
}
CKey(const CKey& b)
@@ -58,12 +60,14 @@ public:
pkey = EC_KEY_dup(b.pkey);
if (pkey == NULL)
throw key_error("CKey::CKey(const CKey&) : EC_KEY_dup failed");
fSet = b.fSet;
}
CKey& operator=(const CKey& b)
{
if (!EC_KEY_copy(pkey, b.pkey))
throw key_error("CKey::operator=(const CKey&) : EC_KEY_copy failed");
fSet = b.fSet;
return (*this);
}
@@ -72,10 +76,16 @@ public:
EC_KEY_free(pkey);
}
bool IsNull() const
{
return !fSet;
}
void MakeNewKey()
{
if (!EC_KEY_generate_key(pkey))
throw key_error("CKey::MakeNewKey() : EC_KEY_generate_key failed");
fSet = true;
}
bool SetPrivKey(const CPrivKey& vchPrivKey)
@@ -83,6 +93,7 @@ public:
const unsigned char* pbegin = &vchPrivKey[0];
if (!d2i_ECPrivateKey(&pkey, &pbegin, vchPrivKey.size()))
return false;
fSet = true;
return true;
}
@@ -103,6 +114,7 @@ public:
const unsigned char* pbegin = &vchPubKey[0];
if (!o2i_ECPublicKey(&pkey, &pbegin, vchPubKey.size()))
return false;
fSet = true;
return true;
}

View File

@@ -1,4 +1,4 @@
Copyright (c) 2009 Satoshi Nakamoto
Copyright (c) 2009-2010 Satoshi Nakamoto
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

Binary file not shown.

View File

@@ -0,0 +1,806 @@
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2010-05-26 22:02-0000\n"
"PO-Revision-Date: 2010-05-27 13:01+0100\n"
"Last-Translator: Franco Cimatti <hostfat@gmail.com>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Poedit-KeywordsList: _;gettext;gettext_noop\n"
"X-Poedit-Basepath: .\n"
"X-Poedit-SearchPath-0: ../../..\n"
#: ../../../init.cpp:342
msgid "Usage: bitcoin [options]"
msgstr "Uso: bitcoin [options]"
#: ../../../init.cpp:343
msgid "Options:\n"
msgstr "Opzioni:\n"
#: ../../../init.cpp:344
msgid "Generate coins\n"
msgstr "Genera monete\n"
#: ../../../init.cpp:345
msgid "Don't generate coins\n"
msgstr "Non generare monete\n"
#: ../../../init.cpp:346
msgid "Start minimized\n"
msgstr "Avvia minimizzato\n"
#: ../../../init.cpp:347
msgid "Specify data directory\n"
msgstr "Indica la cartella per i dati\n"
#: ../../../init.cpp:348
msgid "Connect through socks4 proxy\n"
msgstr "Connetti attraverso proxy socks4\n"
#: ../../../init.cpp:349
msgid "Add a node to connect to\n"
msgstr "Aggiungi un nodo a cui connetterti\n"
#: ../../../init.cpp:350
msgid "Connect only to the specified node\n"
msgstr "Impossibile connettersi al nodo specificato\n"
#: ../../../init.cpp:351
msgid "This help message\n"
msgstr "Questo messaggio di aiuto\n"
#: ../../../init.cpp:455
msgid "Error loading addr.dat \n"
msgstr "Errore nel caricare addr.dat \n"
#: ../../../init.cpp:461
msgid "Error loading blkindex.dat \n"
msgstr "Errore nel caricare blkindex.dat \n"
#: ../../../init.cpp:468
msgid "Error loading wallet.dat \n"
msgstr "Errore nel caricare wallet.dat \n"
#: ../../../init.cpp:536
msgid "Invalid -proxy address"
msgstr "Indirizzo proxy non valido"
#: ../../../init.cpp:629
msgid "Program has crashed and will terminate. "
msgstr "Il programma è crashato e sarà terminato. "
#: ../../../main.cpp:1465
msgid "Warning: Disk space is low "
msgstr "Attenzione: c'è poco spazio sul disco "
#: ../../../main.cpp:2994
#, c-format
msgid "Error: This is an oversized transaction that requires a transaction fee of %s "
msgstr "Errore: Questa è un operazione fuoriscala che richiede un sovrapprezzo di %s "
#: ../../../main.cpp:2996
msgid "Error: Transaction creation failed "
msgstr "Errore: La creazione del trasferimento è fallito "
#: ../../../main.cpp:3001
#: ../../../ui.cpp:1761
#: ../../../ui.cpp:1763
#: ../../../ui.cpp:1904
#: ../../../ui.cpp:2053
msgid "Sending..."
msgstr "Inviando..."
#: ../../../main.cpp:3005
msgid "Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here."
msgstr "Errore: Il trasferimento è stato respinto. Questo può accadere se alcune delle monete nel tuo portafoglio erano già state spese, o anche se hai usato una copia di wallet.dat e le monete erano già state spese nella copia originale ma non segnate in quest'ultima."
#: ../../../main.cpp:3017
msgid "Invalid amount"
msgstr "Quantità non valida"
#: ../../../main.cpp:3019
#: ../../../ui.cpp:1971
#: ../../../ui.cpp:2038
msgid "Insufficient funds"
msgstr "Fondi insufficenti"
#: ../../../main.cpp:3024
msgid "Invalid bitcoin address"
msgstr "Indirizzo bitcoin non valido"
#: ../../../ui.cpp:189
#, c-format
msgid "This transaction is over the size limit. You can still send it for a fee of %s, which goes to the nodes that process your transaction and helps to support the network. Do you want to pay the fee?"
msgstr "Questo trasferimento è oltre le dimensioni massime. Puoi comunque inviarlo per un costo aggiuntivo di %s, che andrà ai nodi che effettueranno il processo della tua operazione e che supportano il network. Vuoi pagare il costo aggiuntivo?"
#: ../../../ui.cpp:285
msgid "Status"
msgstr "Stato"
#: ../../../ui.cpp:286
msgid "Date"
msgstr "Data"
#: ../../../ui.cpp:287
msgid "Description"
msgstr "Descrizione"
#: ../../../ui.cpp:288
msgid "Debit"
msgstr "Debito"
#: ../../../ui.cpp:289
msgid "Credit"
msgstr "Credito"
#: ../../../ui.cpp:489
#, c-format
msgid "Open for %d blocks"
msgstr "Aperto per %d blocchi"
#: ../../../ui.cpp:491
#, c-format
msgid "Open until %s"
msgstr "Aperto fino a %s"
#: ../../../ui.cpp:497
#, c-format
msgid "%d/offline?"
msgstr "%d/fuorilinea?"
#: ../../../ui.cpp:499
#, c-format
msgid "%d/unconfirmed"
msgstr "%d/non confermato"
#: ../../../ui.cpp:501
#, c-format
msgid "%d confirmations"
msgstr "%d conferme"
#: ../../../ui.cpp:584
msgid "Generated"
msgstr "Generato"
#: ../../../ui.cpp:592
#, c-format
msgid "Generated (%s matures in %d more blocks)"
msgstr "Generate (%s matureranno in %d altri blocchi)"
#: ../../../ui.cpp:596
msgid "Generated - Warning: This block was not received by any other nodes and will probably not be accepted!"
msgstr "Generato - Attenzione: Questo blocco non è stato ricevuto da nessun altro nodo e probabilmente non sarà accettato!"
#: ../../../ui.cpp:600
msgid "Generated (not accepted)"
msgstr "Generato (non accettato)"
#: ../../../ui.cpp:610
msgid "From: "
msgstr "Da: "
#: ../../../ui.cpp:634
msgid "From: unknown, Received with: "
msgstr "Da: sconosciuto, Ricevuto con: "
#: ../../../ui.cpp:676
msgid "Payment to yourself"
msgstr "Pagamento a te stesso"
#: ../../../ui.cpp:713
msgid "To: "
msgstr "A: "
#: ../../../ui.cpp:1009
msgid " Generating"
msgstr " Generando"
#: ../../../ui.cpp:1011
msgid "(not connected)"
msgstr "(non connesso)"
#: ../../../ui.cpp:1014
#, c-format
msgid " %d connections %d blocks %d transactions"
msgstr " %d connessioni %d blocchi %d trasferimenti"
#: ../../../ui.cpp:1123
#: ../../../ui.cpp:2351
msgid "New Receiving Address"
msgstr "Nuovo indirizzo ricevente"
#: ../../../ui.cpp:1124
#: ../../../ui.cpp:2352
msgid ""
"It's good policy to use a new address for each payment you receive.\n"
"\n"
"Label"
msgstr ""
"E' una buona abitudine usare un nuovo indirizzo per ogni pagamento che ricevuto.\n"
"\n"
"Label"
#: ../../../ui.cpp:1193
msgid "<b>Status:</b> "
msgstr "<b>Stato:</b> "
#: ../../../ui.cpp:1198
msgid ", has not been successfully broadcast yet"
msgstr ", non è ancora stato diffuso correttamente"
#: ../../../ui.cpp:1200
#, c-format
msgid ", broadcast through %d node"
msgstr ", diffusione attraverso %d nodo"
#: ../../../ui.cpp:1202
#, c-format
msgid ", broadcast through %d nodes"
msgstr ", diffusione attraverso %d nodi"
#: ../../../ui.cpp:1206
msgid "<b>Date:</b> "
msgstr "<b>Data:</b> "
#: ../../../ui.cpp:1214
msgid "<b>Source:</b> Generated<br>"
msgstr "<b>Sorgente:</b> Generato<br>"
#: ../../../ui.cpp:1220
#: ../../../ui.cpp:1238
msgid "<b>From:</b> "
msgstr "<b>Da:</b> "
#: ../../../ui.cpp:1238
msgid "unknown"
msgstr "sconoscuto"
#: ../../../ui.cpp:1239
#: ../../../ui.cpp:1263
#: ../../../ui.cpp:1322
msgid "<b>To:</b> "
msgstr "<b>A:</b> "
#: ../../../ui.cpp:1242
msgid " (yours, label: "
msgstr " (vostro, label: "
#: ../../../ui.cpp:1244
msgid " (yours)"
msgstr " (vostro)"
#: ../../../ui.cpp:1281
#: ../../../ui.cpp:1293
#: ../../../ui.cpp:1356
msgid "<b>Credit:</b> "
msgstr "<b>Credito:</b> "
#: ../../../ui.cpp:1283
#, c-format
msgid "(%s matures in %d more blocks)"
msgstr "(%s matureranno in %d altri blocchi)"
#: ../../../ui.cpp:1285
msgid "(not accepted)"
msgstr "(non accettato)"
#: ../../../ui.cpp:1330
#: ../../../ui.cpp:1353
msgid "<b>Debit:</b> "
msgstr "<b>Debito:</b> "
#: ../../../ui.cpp:1344
msgid "<b>Transaction fee:</b> "
msgstr "<b>Trasferimento costo:</b> "
#: ../../../ui.cpp:1360
msgid "<b>Net amount:</b> "
msgstr "<b>Quantità del network:</b> "
#: ../../../ui.cpp:1367
msgid "Message:"
msgstr "Messaggio:"
#: ../../../ui.cpp:1370
msgid "Generated coins must wait 120 blocks before they can be spent. When you generated this block, it was broadcast to the network to be added to the block chain. If it fails to get into the chain, it will change to \"not accepted\" and not be spendable. This may occasionally happen if another node generates a block within a few seconds of yours."
msgstr "Le monete generate devono aspettare 120 blocchi prima di poter essere spese. Quando hai generato questo blocco, è stato diffuso sul network per essere aggiunto alla catena dei blocchi. Se fallirà l'entrata nella catena, cambierà in \"non accettato\" e non spendibile. Questo può capitare se un altro nodo genera un blocco pochi secondi prima del tuo."
#: ../../../ui.cpp:1437
msgid "Main"
msgstr "Principale"
#: ../../../ui.cpp:1442
msgid "&Minimize on close"
msgstr "&Minimizza se chiuso"
#: ../../../ui.cpp:1595
#, c-format
msgid "version 0.%d.%d beta"
msgstr "versione 0.%d.%d beta"
#: ../../../ui.cpp:1681
msgid "Will appear as \"From: Unknown\""
msgstr "Apparirà come \"Da: Sconosciuto\""
#: ../../../ui.cpp:1682
msgid "Can't include a message when sending to a Bitcoin address"
msgstr "Non si può includere un messaggio quando si invia attraverso l'indirizzo Bitcoin"
#: ../../../ui.cpp:1735
msgid "Error in amount "
msgstr "Errore nell'ammontare "
#: ../../../ui.cpp:1735
#: ../../../ui.cpp:1740
#: ../../../ui.cpp:1745
#: ../../../ui.cpp:1771
#: ../../../uibase.cpp:61
msgid "Send Coins"
msgstr "Invia monete"
#: ../../../ui.cpp:1740
msgid "Amount exceeds your balance "
msgstr "L'ammontare è andato oltre i tuoi capitali "
#: ../../../ui.cpp:1745
msgid "Total exceeds your balance when the "
msgstr "Il totale va oltre i tuoi capitali quando il "
#: ../../../ui.cpp:1745
msgid " transaction fee is included "
msgstr " il costo trasferimento è incluso "
#: ../../../ui.cpp:1761
msgid "Payment sent "
msgstr "Pagamento inviato "
#: ../../../ui.cpp:1771
msgid "Invalid address "
msgstr "Indirizzo non valido "
#: ../../../ui.cpp:1825
#, c-format
msgid "Sending %s to %s"
msgstr "Inviando %s a %s"
#: ../../../ui.cpp:1898
#: ../../../ui.cpp:1931
msgid "CANCELLED"
msgstr "CANCELLATO"
#: ../../../ui.cpp:1902
msgid "Cancelled"
msgstr "Cancellato"
#: ../../../ui.cpp:1904
msgid "Transfer cancelled "
msgstr "Operazione cancellata "
#: ../../../ui.cpp:1957
msgid "Error: "
msgstr "Errore: "
#: ../../../ui.cpp:1976
msgid "Connecting..."
msgstr "Connessione in corso..."
#: ../../../ui.cpp:1981
msgid "Unable to connect"
msgstr "Impossibile connettersi"
#: ../../../ui.cpp:1986
msgid "Requesting public key..."
msgstr "Richiesta chiave pubblica..."
#: ../../../ui.cpp:1998
msgid "Received public key..."
msgstr "Ricezione chiave pubblica..."
#: ../../../ui.cpp:2010
msgid "Transfer was not accepted"
msgstr "Trasferimento non accettato"
#: ../../../ui.cpp:2019
msgid "Invalid response received"
msgstr "Risposta non valida ricevuta"
#: ../../../ui.cpp:2034
msgid "Creating transaction..."
msgstr "Creazione trasferimento..."
#: ../../../ui.cpp:2046
#, c-format
msgid "This is an oversized transaction that requires a transaction fee of %s"
msgstr "Questo è un trasferimento fuoriscala che richiede un costo aggiuntivo di %s"
#: ../../../ui.cpp:2048
msgid "Transaction creation failed"
msgstr "Creazione trasferimento fallita"
#: ../../../ui.cpp:2055
msgid "Transaction aborted"
msgstr "Trasferimento bloccato"
#: ../../../ui.cpp:2063
msgid "Lost connection, transaction cancelled"
msgstr "Connessione persa, trasferimento cancellato"
#: ../../../ui.cpp:2079
msgid "Sending payment..."
msgstr "Inviando pagamento..."
#: ../../../ui.cpp:2085
msgid "The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here."
msgstr "Il trasferimento è stato respinto. Questo può accadere se alcune delle monete nel tuo portafoglio erano già state spese, o anche se hai usato una copia di wallet.dat e le monete erano già state spese nella copia originale ma non segnate in quest'ultima."
#: ../../../ui.cpp:2092
msgid "Waiting for confirmation..."
msgstr "In attesa di conferma..."
#: ../../../ui.cpp:2110
msgid ""
"The payment was sent, but the recipient was unable to verify it.\n"
"The transaction is recorded and will credit to the recipient,\n"
"but the comment information will be blank."
msgstr ""
"Il pagamento è inviato, ma il ricevente non è stato in grado di verificarlo.\n"
"Il trasferimento è registrato e costerà sarà accreditato al ricevente,\n"
"ma il commento verrà mostrato come vuoto."
#: ../../../ui.cpp:2119
msgid "Payment was sent, but an invalid response was received"
msgstr "Il pagamento è stato inviato, ma è arrivata un risposta invalida"
#: ../../../ui.cpp:2125
msgid "Payment completed"
msgstr "Pagamento completato"
#: ../../../ui.cpp:2156
#: ../../../ui.cpp:2302
#: ../../../ui.cpp:2339
msgid "Name"
msgstr "Nome"
#: ../../../ui.cpp:2157
#: ../../../ui.cpp:2302
#: ../../../ui.cpp:2339
msgid "Address"
msgstr "Indirizzo"
#: ../../../ui.cpp:2159
#: ../../../ui.cpp:2314
msgid "Label"
msgstr "Label"
#: ../../../ui.cpp:2160
#: ../../../uibase.cpp:908
msgid "Bitcoin Address"
msgstr "Indirizzo Bitcoin"
#: ../../../ui.cpp:2284
msgid "This is one of your own addresses for receiving payments and cannot be entered in the address book. "
msgstr "Questo qui è uno dei tuoi indirizzi personali per ricevere pagamenti e non può essere inserito nella rubrica indirizzi. "
#: ../../../ui.cpp:2302
#: ../../../ui.cpp:2308
msgid "Edit Address"
msgstr "Modifica indirizzo"
#: ../../../ui.cpp:2314
msgid "Edit Address Label"
msgstr "Modifica spazio indirizzo"
#: ../../../ui.cpp:2339
#: ../../../ui.cpp:2345
msgid "Add Address"
msgstr "Aggiungi indirizzo"
#: ../../../ui.cpp:2421
msgid "Bitcoin"
msgstr "Bitcoin"
#: ../../../ui.cpp:2423
msgid "Bitcoin - Generating"
msgstr "Bitcoin - Generando"
#: ../../../ui.cpp:2425
msgid "Bitcoin - (not connected)"
msgstr "Bitcoin - (non connesso)"
#: ../../../ui.cpp:2500
msgid "&Open Bitcoin"
msgstr "&Apri Bitcoin"
#: ../../../ui.cpp:2501
msgid "O&ptions..."
msgstr "O&pzioni..."
#: ../../../ui.cpp:2502
#: ../../../uibase.cpp:34
msgid "&Generate Coins"
msgstr "&Genera monete"
#: ../../../ui.cpp:2505
#: ../../../uibase.cpp:27
msgid "E&xit"
msgstr "E&sci"
#: ../../../uibase.cpp:30
msgid "&File"
msgstr "&File"
#: ../../../uibase.cpp:38
msgid "&Your Receiving Addresses..."
msgstr "&Il tuo indirizzo di ricezione..."
#: ../../../uibase.cpp:42
msgid "&Options..."
msgstr "&Opzioni..."
#: ../../../uibase.cpp:45
msgid "&Settings"
msgstr "I&mpostazioni"
#: ../../../uibase.cpp:49
msgid "&About..."
msgstr "&Info..."
#: ../../../uibase.cpp:52
msgid "&Help"
msgstr "&Aiuto"
#: ../../../uibase.cpp:62
msgid "Address Book"
msgstr "Rubrica indirizzi"
#: ../../../uibase.cpp:77
msgid "Your Bitcoin Address:"
msgstr "Il tuo indirizzo Bitcoin:"
#: ../../../uibase.cpp:84
msgid " &New... "
msgstr " &Nuovo... "
#: ../../../uibase.cpp:87
#: ../../../uibase.cpp:851
#: ../../../uibase.cpp:954
msgid " &Copy to Clipboard "
msgstr " &Copia nella Clipboard "
#: ../../../uibase.cpp:102
msgid "Balance:"
msgstr "Capitali:"
#: ../../../uibase.cpp:121
msgid " All"
msgstr " Tutte"
#: ../../../uibase.cpp:121
msgid " Sent"
msgstr " Inviato"
#: ../../../uibase.cpp:121
msgid " Received"
msgstr " Ricevuto"
#: ../../../uibase.cpp:121
msgid " In Progress"
msgstr " In lavorazione"
#: ../../../uibase.cpp:142
msgid "All Transactions"
msgstr "Tutte le operazioni"
#: ../../../uibase.cpp:153
msgid "Sent/Received"
msgstr "Inviato/Ricevuto"
#: ../../../uibase.cpp:164
msgid "Sent"
msgstr "Inviato"
#: ../../../uibase.cpp:175
msgid "Received"
msgstr "Ricevuto"
#: ../../../uibase.cpp:318
#: ../../../uibase.cpp:479
#: ../../../uibase.cpp:580
#: ../../../uibase.cpp:793
#: ../../../uibase.cpp:854
#: ../../../uibase.cpp:963
#: ../../../uibase.cpp:1052
msgid "OK"
msgstr "OK"
#: ../../../uibase.cpp:361
msgid "Optional transaction fee you give to the nodes that process your transactions."
msgstr "Costo aggiuntivo opzionale che tu dai ai nodi che realizzano i tuoi trasferimenti"
#: ../../../uibase.cpp:370
msgid "Transaction fee:"
msgstr "Costo trasferimento:"
#: ../../../uibase.cpp:386
msgid "&Limit coin generation to"
msgstr "&Limita la generazione moneta a"
#: ../../../uibase.cpp:393
msgid "processors"
msgstr "processori"
#: ../../../uibase.cpp:399
msgid "&Start Bitcoin on system startup"
msgstr "A&vvia Bitcoin all'avvio del sistema"
#: ../../../uibase.cpp:403
msgid "&Minimize to the tray instead of the taskbar"
msgstr "&Minimizza nella tray invece che nella barra"
#: ../../../uibase.cpp:407
msgid "M&inimize to the tray on close"
msgstr "M&inimizza nella tray alla chiusura"
#: ../../../uibase.cpp:414
msgid "&Connect through socks4 proxy: "
msgstr "%Connesso attraverso proxy socks4: "
#: ../../../uibase.cpp:426
msgid "Proxy &IP:"
msgstr "Proxy &IP:"
#: ../../../uibase.cpp:434
msgid " &Port:"
msgstr " &Porta:"
#: ../../../uibase.cpp:456
msgid "// [don't translate] Test panel 2 for future expansion"
msgstr ""
#: ../../../uibase.cpp:460
msgid "// [don't translate] Let's not start multiple pages until the first page is filled up"
msgstr ""
#: ../../../uibase.cpp:482
#: ../../../uibase.cpp:735
#: ../../../uibase.cpp:798
#: ../../../uibase.cpp:857
#: ../../../uibase.cpp:966
#: ../../../uibase.cpp:1055
msgid "Cancel"
msgstr "Cancella"
#: ../../../uibase.cpp:485
msgid "&Apply"
msgstr "&Accetta"
#: ../../../uibase.cpp:546
msgid "Bitcoin "
msgstr "Bitcoin "
#: ../../../uibase.cpp:552
msgid "version"
msgstr "versione"
#: ../../../uibase.cpp:563
msgid ""
"Copyright (c) 2009-2010 Satoshi Nakamoto.\n"
"\n"
"This is experimental software. Do not rely on it for actual financial transactions.\n"
"\n"
"Distributed under the MIT/X11 software license, see the accompanying file \n"
"license.txt or http://www.opensource.org/licenses/mit-license.php.\n"
"\n"
"This product includes software developed by the OpenSSL Project for use in the \n"
"OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by \n"
"Eric Young (eay@cryptsoft.com)."
msgstr ""
"Copyright (c) 2009-2010 Satoshi Nakamoto.\n"
"\n"
"Questo è un software sperimentale. Non affidartici per gli attuali trasferimenti finanziari.\n"
"\n"
"Distribuito sotto la licenza software MIT/X11, guarda il file license.txt incluso oppure su http://www.opensource.org/licenses/mit-license.php.\n"
"\n"
"Questo prodoto include software sviluppato dal progetto OpenSSL per l'uso del \n"
"(http://www.openssl.org/) e il software criptografico scritto da \n"
"Eric Young (eay@cryptsoft.com)."
#: ../../../uibase.cpp:619
msgid "Enter a Bitcoin address (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJED9L) or IP address (e.g. 123.45.6.7)"
msgstr "Inserisci un indirizzo Bitcoin (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJED9L) o un indirizzo IP (e.g. 123.45.6.7)"
#: ../../../uibase.cpp:633
msgid "Pay &To:"
msgstr "Paga %a:"
#: ../../../uibase.cpp:648
msgid "&Paste"
msgstr "&Incolla"
#: ../../../uibase.cpp:651
msgid " Address &Book..."
msgstr " &Rubrica degli indirizzi..."
#: ../../../uibase.cpp:658
msgid "&Amount:"
msgstr "&Quantità"
#: ../../../uibase.cpp:668
msgid "T&ransfer:"
msgstr "T&rasferimento:"
#: ../../../uibase.cpp:674
msgid " Standard"
msgstr " Standard"
#: ../../../uibase.cpp:696
msgid "&From:"
msgstr "&Proveniente da:"
#: ../../../uibase.cpp:713
msgid "&Message:"
msgstr "&Messaggio:"
#: ../../../uibase.cpp:730
msgid "&Send"
msgstr "&Invia"
#: ../../../uibase.cpp:782
msgid ""
"\n"
"\n"
"Connecting..."
msgstr ""
"\n"
"\n"
"Connessione in corso..."
#: ../../../uibase.cpp:832
msgid "These are your Bitcoin addresses for receiving payments. You may want to give a different one to each sender so you can keep track of who is paying you. The highlighted address is displayed in the main window."
msgstr "Questi sono i tuoi indirizzi Bitcoin per ricevere pagamenti. Potrai darne uno diverso ad ognuno per cosi tenere traccia di chi ti sta pagando. L'indirizzo selezionato sarà quello mostrato nella finestra principale."
#: ../../../uibase.cpp:845
#: ../../../uibase.cpp:957
msgid "&Edit..."
msgstr "&Cambia..."
#: ../../../uibase.cpp:848
#: ../../../uibase.cpp:960
msgid " &New Address... "
msgstr " &Nuovo indirizzo... "
#: ../../../uibase.cpp:920
msgid "Sending"
msgstr "Inviando"
#: ../../../uibase.cpp:928
msgid "These are your Bitcoin addresses for receiving payments. You can give a different one to each sender to keep track of who is paying you. The highlighted address will be displayed in the main window."
msgstr "Questi sono i tuoi indirizzi Bitcoin per ricevere pagamenti. Potrai darne uno diverso ad ognuno per cosi tenere traccia di chi ti sta pagando. L'indirizzo selezionato sarà quello mostrato nella finestra principale."
#: ../../../uibase.cpp:941
msgid "Receiving"
msgstr "Ricevendo"
#: ../../../uibase.cpp:951
msgid "&Delete"
msgstr "&Cancella"
#: ../../../uibase.h:150
msgid "Transaction Details"
msgstr "Dettagli operazione"
#: ../../../uibase.h:203
msgid "Options"
msgstr "Opzioni"
#: ../../../uibase.h:231
msgid "About Bitcoin"
msgstr "Info Bitcoin"
#: ../../../uibase.h:341
msgid "Your Bitcoin Addresses"
msgstr "Il tuo indirizzo Bitcoin"

Binary file not shown.

View File

@@ -0,0 +1,808 @@
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2010-05-26 22:02-0000\n"
"PO-Revision-Date: 2010-05-27 19:27+0100\n"
"Last-Translator: Xunie\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Poedit-KeywordsList: _;gettext;gettext_noop\n"
"X-Poedit-Basepath: .\n"
"X-Poedit-SearchPath-0: ../../..\n"
#: ../../../init.cpp:342
msgid "Usage: bitcoin [options]"
msgstr ""
#: ../../../init.cpp:343
msgid "Options:\n"
msgstr "Opties:\n"
#: ../../../init.cpp:344
msgid "Generate coins\n"
msgstr "Genereer coins\n"
#: ../../../init.cpp:345
msgid "Don't generate coins\n"
msgstr "Genereer geen coins\n"
#: ../../../init.cpp:346
msgid "Start minimized\n"
msgstr "Start geminimalizeerd\n"
#: ../../../init.cpp:347
msgid "Specify data directory\n"
msgstr "Specificeer data map\n"
#: ../../../init.cpp:348
msgid "Connect through socks4 proxy\n"
msgstr "Verbind via socks4 proxy\n"
#: ../../../init.cpp:349
msgid "Add a node to connect to\n"
msgstr "Voeg een node om naar te verbinden toe\n"
#: ../../../init.cpp:350
msgid "Connect only to the specified node\n"
msgstr "Verbind alleen naar deze node\n"
#: ../../../init.cpp:351
msgid "This help message\n"
msgstr ""
#: ../../../init.cpp:455
msgid "Error loading addr.dat \n"
msgstr "Fout bij laden van bestand addr.dat \n"
#: ../../../init.cpp:461
msgid "Error loading blkindex.dat \n"
msgstr "Fout bij laden van bestand blkindex.dat \n"
#: ../../../init.cpp:468
msgid "Error loading wallet.dat \n"
msgstr "Fout bij laden van bestand wallet.dat \n"
#: ../../../init.cpp:536
msgid "Invalid -proxy address"
msgstr "Foutief -proxy adres"
#: ../../../init.cpp:629
msgid "Program has crashed and will terminate. "
msgstr "Programma is gecrashed en word afgesloten. "
#: ../../../main.cpp:1465
msgid "Warning: Disk space is low "
msgstr "Waarschuwng: Gebrek aan schijf ruimte "
#: ../../../main.cpp:2994
#, c-format
msgid "Error: This is an oversized transaction that requires a transaction fee of %s "
msgstr "Fout: Dit is een te grote transactie die een fooi nodig heeft van %s "
#: ../../../main.cpp:2996
msgid "Error: Transaction creation failed "
msgstr "Fout: Transactie aanmaak gefaald "
#: ../../../main.cpp:3001
#: ../../../ui.cpp:1761
#: ../../../ui.cpp:1763
#: ../../../ui.cpp:1904
#: ../../../ui.cpp:2053
msgid "Sending..."
msgstr "Versturen..."
#: ../../../main.cpp:3005
msgid "Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here."
msgstr "Fout: De transactie was afgekeurd. Dit kan komen als bepaalde coins in uw Portefeuille al zijn uitgegeven. Dit kan komen doordat u wallet.dat heeft gekopieerd en wat coins heeft uitgegeven en niet terug gekopieerd heeft."
#: ../../../main.cpp:3017
msgid "Invalid amount"
msgstr "Foutief aantal"
#: ../../../main.cpp:3019
#: ../../../ui.cpp:1971
#: ../../../ui.cpp:2038
msgid "Insufficient funds"
msgstr "Onvoldoende coins"
#: ../../../main.cpp:3024
msgid "Invalid bitcoin address"
msgstr "Foutief bitcoin adres"
#: ../../../ui.cpp:189
#, c-format
msgid "This transaction is over the size limit. You can still send it for a fee of %s, which goes to the nodes that process your transaction and helps to support the network. Do you want to pay the fee?"
msgstr "Deze transactie is over het limiet. U kunt nog door gaan met de transactie door een fooi te betalen van %s, deze word betaald aan de node die uw tranactie verwerkt. Wilt u de fooi betalen?"
#: ../../../ui.cpp:285
msgid "Status"
msgstr "Status"
#: ../../../ui.cpp:286
msgid "Date"
msgstr "Datum"
#: ../../../ui.cpp:287
msgid "Description"
msgstr "Beschrijving"
#: ../../../ui.cpp:288
msgid "Debit"
msgstr ""
#: ../../../ui.cpp:289
msgid "Credit"
msgstr ""
#: ../../../ui.cpp:489
#, c-format
msgid "Open for %d blocks"
msgstr "Open voor %d blocks"
#: ../../../ui.cpp:491
#, c-format
msgid "Open until %s"
msgstr "Open tot %s"
#: ../../../ui.cpp:497
#, c-format
msgid "%d/offline?"
msgstr "%d/offline?"
#: ../../../ui.cpp:499
#, c-format
msgid "%d/unconfirmed"
msgstr "%d/niet bevestigd"
#: ../../../ui.cpp:501
#, c-format
msgid "%d confirmations"
msgstr "%d bevestigingen"
#: ../../../ui.cpp:584
msgid "Generated"
msgstr "Gegenereerd"
#: ../../../ui.cpp:592
#, c-format
msgid "Generated (%s matures in %d more blocks)"
msgstr "Gegenereerd (%s word volwassen in %d blokken)"
#: ../../../ui.cpp:596
msgid "Generated - Warning: This block was not received by any other nodes and will probably not be accepted!"
msgstr "Gegenereerd - Waarschuwing: Dit blok is niet ontvangen door andere nodes en zal waarschijnlijk niet geaccepteerd worden!"
#: ../../../ui.cpp:600
msgid "Generated (not accepted)"
msgstr "Gegenereerd (niet geaccepteerd)"
#: ../../../ui.cpp:610
msgid "From: "
msgstr "Van: "
#: ../../../ui.cpp:634
msgid "From: unknown, Received with: "
msgstr "Van: onbekend, Ontvangen met: "
#: ../../../ui.cpp:676
msgid "Payment to yourself"
msgstr "Betaling naar u zelf"
#: ../../../ui.cpp:713
msgid "To: "
msgstr "Naar: "
#: ../../../ui.cpp:1009
msgid " Generating"
msgstr " Genereert"
#: ../../../ui.cpp:1011
msgid "(not connected)"
msgstr "(niet verbonden)"
#: ../../../ui.cpp:1014
#, c-format
msgid " %d connections %d blocks %d transactions"
msgstr " %d verbindingen %d blokken %d transacties"
#: ../../../ui.cpp:1123
#: ../../../ui.cpp:2351
msgid "New Receiving Address"
msgstr "Nieuw Ontvangings Adres"
#: ../../../ui.cpp:1124
#: ../../../ui.cpp:2352
msgid ""
"It's good policy to use a new address for each payment you receive.\n"
"\n"
"Label"
msgstr ""
"Het is goed beleid om een nieuw adres voor elke betaling te hebben.\n"
"\n"
"Label"
#: ../../../ui.cpp:1193
msgid "<b>Status:</b> "
msgstr "<b>Status:</b> "
#: ../../../ui.cpp:1198
msgid ", has not been successfully broadcast yet"
msgstr ", is nog niet succesvol verstuurd naar het netwerk"
#: ../../../ui.cpp:1200
#, c-format
msgid ", broadcast through %d node"
msgstr ", verstuurd via %d node"
#: ../../../ui.cpp:1202
#, c-format
msgid ", broadcast through %d nodes"
msgstr ", verstuurd via %d nodes"
#: ../../../ui.cpp:1206
msgid "<b>Date:</b> "
msgstr "<b>Datum:</b> "
#: ../../../ui.cpp:1214
msgid "<b>Source:</b> Generated<br>"
msgstr "<b>Bron:</b> Gegenereerd<br>"
#: ../../../ui.cpp:1220
#: ../../../ui.cpp:1238
msgid "<b>From:</b> "
msgstr "<b>Van:</b> "
#: ../../../ui.cpp:1238
msgid "unknown"
msgstr "onbekend"
#: ../../../ui.cpp:1239
#: ../../../ui.cpp:1263
#: ../../../ui.cpp:1322
msgid "<b>To:</b> "
msgstr "<b>Naar:</b> "
#: ../../../ui.cpp:1242
msgid " (yours, label: "
msgstr ""
#: ../../../ui.cpp:1244
#, fuzzy
msgid " (yours)"
msgstr ""
#: ../../../ui.cpp:1281
#: ../../../ui.cpp:1293
#: ../../../ui.cpp:1356
msgid "<b>Credit:</b> "
msgstr ""
#: ../../../ui.cpp:1283
#, c-format
msgid "(%s matures in %d more blocks)"
msgstr "(%s word volwassen in %d blokken)"
#: ../../../ui.cpp:1285
msgid "(not accepted)"
msgstr "(niet geaccepteerd"
#: ../../../ui.cpp:1330
#: ../../../ui.cpp:1353
msgid "<b>Debit:</b> "
msgstr ""
#: ../../../ui.cpp:1344
msgid "<b>Transaction fee:</b> "
msgstr "<b>Transactie fooi:</b> "
#: ../../../ui.cpp:1360
msgid "<b>Net amount:</b> "
msgstr "<b>Netto bedrag:</b> "
#: ../../../ui.cpp:1367
msgid "Message:"
msgstr "Mededeling:"
#: ../../../ui.cpp:1370
msgid "Generated coins must wait 120 blocks before they can be spent. When you generated this block, it was broadcast to the network to be added to the block chain. If it fails to get into the chain, it will change to \"not accepted\" and not be spendable. This may occasionally happen if another node generates a block within a few seconds of yours."
msgstr "Gegenereerde coins moeten 120 blokken wachten voordat ze uitgegeven kunnen worden. Wanneer je dit blok genereerde, werd het naar het netwerk gestuurd om opgenomen teworden in de rest van de blokken. Als dit faalt, dan zal de dit veranderen in \"niet geaccepteerd\" en zal niet uitgeefbaar zijn. Dit kan soms gebeuren als een node ook een blok rond dezelfde periode genereerd."
#: ../../../ui.cpp:1437
msgid "Main"
msgstr "Hoofd"
#: ../../../ui.cpp:1442
msgid "&Minimize on close"
msgstr "&Minimalizeer bij sluiten"
#: ../../../ui.cpp:1595
#, c-format
msgid "version 0.%d.%d beta"
msgstr "versie 0.%d.%d beta"
#: ../../../ui.cpp:1681
msgid "Will appear as \"From: Unknown\""
msgstr "Word vertoont als \"Van: Onbekend\""
#: ../../../ui.cpp:1682
msgid "Can't include a message when sending to a Bitcoin address"
msgstr "Kan geen mededeling versturen bij gebruik van Bitcoin adressen"
#: ../../../ui.cpp:1735
msgid "Error in amount "
msgstr "Fout in hoeveelheid "
#: ../../../ui.cpp:1735
#: ../../../ui.cpp:1740
#: ../../../ui.cpp:1745
#: ../../../ui.cpp:1771
#: ../../../uibase.cpp:61
msgid "Send Coins"
msgstr "Verstuur Coins"
#: ../../../ui.cpp:1740
msgid "Amount exceeds your balance "
msgstr "Hoeveelheid hoger dan uw huidige balans "
#: ../../../ui.cpp:1745
msgid "Total exceeds your balance when the "
msgstr "Totaal groter dan uw huidige balans wanner de "
#: ../../../ui.cpp:1745
msgid " transaction fee is included "
msgstr " transactie fooi is bijgerekend "
#: ../../../ui.cpp:1761
msgid "Payment sent "
msgstr "Betaling verstuurd "
#: ../../../ui.cpp:1771
msgid "Invalid address "
msgstr "Foutief adres "
#: ../../../ui.cpp:1825
#, c-format
msgid "Sending %s to %s"
msgstr "Verstuurd %s naar %s"
#: ../../../ui.cpp:1898
#: ../../../ui.cpp:1931
msgid "CANCELLED"
msgstr "GEANNULEERD"
#: ../../../ui.cpp:1902
msgid "Cancelled"
msgstr "Geannuleerd"
#: ../../../ui.cpp:1904
msgid "Transfer cancelled "
msgstr "Transactie geannuleerd "
#: ../../../ui.cpp:1957
msgid "Error: "
msgstr "Fout: "
#: ../../../ui.cpp:1976
msgid "Connecting..."
msgstr "Verbinden..."
#: ../../../ui.cpp:1981
msgid "Unable to connect"
msgstr "Kan niet verbinden"
#: ../../../ui.cpp:1986
msgid "Requesting public key..."
msgstr "Aanvragen van publieke sleutel..."
#: ../../../ui.cpp:1998
msgid "Received public key..."
msgstr "Publieke sleutel ontvangen..."
#: ../../../ui.cpp:2010
msgid "Transfer was not accepted"
msgstr "Transactie niet geaccepteerd"
#: ../../../ui.cpp:2019
msgid "Invalid response received"
msgstr "Foutief antwoord ontvangen"
#: ../../../ui.cpp:2034
msgid "Creating transaction..."
msgstr "Maakt transactie aan..."
#: ../../../ui.cpp:2046
#, c-format
msgid "This is an oversized transaction that requires a transaction fee of %s"
msgstr "Dit is een te grote transactie die een transactie fooi vereist van %s"
#: ../../../ui.cpp:2048
msgid "Transaction creation failed"
msgstr "Transactie aanmaak gefaald."
#: ../../../ui.cpp:2055
msgid "Transaction aborted"
msgstr "Transactie geannuleerd"
#: ../../../ui.cpp:2063
msgid "Lost connection, transaction cancelled"
msgstr "Verbinding verloren, transactie geannuleerd"
#: ../../../ui.cpp:2079
msgid "Sending payment..."
msgstr "Versturen van betaling..."
#: ../../../ui.cpp:2085
msgid "The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here."
msgstr "De transactie was afgekeurd. Dit kan komen als bepaalde coins in uw Portefeuille al zijn uitgegeven. Dit kan komen doordat u wallet.dat heeft gekopieerd en wat coins heeft uitgegeven en niet terug gekopieerd heeft."
#: ../../../ui.cpp:2092
msgid "Waiting for confirmation..."
msgstr "Wachten op bevestiging..."
#: ../../../ui.cpp:2110
msgid ""
"The payment was sent, but the recipient was unable to verify it.\n"
"The transaction is recorded and will credit to the recipient,\n"
"but the comment information will be blank."
msgstr ""
"De betaling was verstuurd, maar de ontvanger kon het niet verifieeren.\n"
"De transactie is opgenomen en word uitbetaald aan de ontvanger,\n"
"maar de mededeling blijft blank bij de ontanger."
#: ../../../ui.cpp:2119
msgid "Payment was sent, but an invalid response was received"
msgstr "Betaling was verstuurd, maar een foutief antword was ontvangen."
#: ../../../ui.cpp:2125
msgid "Payment completed"
msgstr "Betaling voltooid"
#: ../../../ui.cpp:2156
#: ../../../ui.cpp:2302
#: ../../../ui.cpp:2339
msgid "Name"
msgstr "Naam"
#: ../../../ui.cpp:2157
#: ../../../ui.cpp:2302
#: ../../../ui.cpp:2339
msgid "Address"
msgstr "Adres"
#: ../../../ui.cpp:2159
#: ../../../ui.cpp:2314
msgid "Label"
msgstr "Label"
#: ../../../ui.cpp:2160
#: ../../../uibase.cpp:908
msgid "Bitcoin Address"
msgstr "Bitcoin Adres"
#: ../../../ui.cpp:2284
msgid "This is one of your own addresses for receiving payments and cannot be entered in the address book. "
msgstr "Dit is een van uw eigen adressen voor het ontvangen van betalingen en can niet worden toegevoegd aan uw adressen boek. "
#: ../../../ui.cpp:2302
#: ../../../ui.cpp:2308
msgid "Edit Address"
msgstr "Bewerk Adres"
#: ../../../ui.cpp:2314
msgid "Edit Address Label"
msgstr "Bewerk Adres Label"
#: ../../../ui.cpp:2339
#: ../../../ui.cpp:2345
msgid "Add Address"
msgstr "Adres Toevoegen"
#: ../../../ui.cpp:2421
msgid "Bitcoin"
msgstr "Bitcoin"
#: ../../../ui.cpp:2423
msgid "Bitcoin - Generating"
msgstr "Bitcoin - Genereert"
#: ../../../ui.cpp:2425
msgid "Bitcoin - (not connected)"
msgstr "Bitcoin - (niet verbonden)"
#: ../../../ui.cpp:2500
msgid "&Open Bitcoin"
msgstr "&Open Bitcoin"
#: ../../../ui.cpp:2501
msgid "O&ptions..."
msgstr "O&pties"
#: ../../../ui.cpp:2502
#: ../../../uibase.cpp:34
msgid "&Generate Coins"
msgstr "&Genereer Coins"
#: ../../../ui.cpp:2505
#: ../../../uibase.cpp:27
msgid "E&xit"
msgstr "A&fsluiten"
#: ../../../uibase.cpp:30
msgid "&File"
msgstr "&Bestand"
#: ../../../uibase.cpp:38
msgid "&Your Receiving Addresses..."
msgstr "&Uw Ontvang Adressen..."
#: ../../../uibase.cpp:42
msgid "&Options..."
msgstr "&Opties..."
#: ../../../uibase.cpp:45
msgid "&Settings"
msgstr "&Eigenschappen"
#: ../../../uibase.cpp:49
msgid "&About..."
msgstr "&Over..."
#: ../../../uibase.cpp:52
msgid "&Help"
msgstr "&Help"
#: ../../../uibase.cpp:62
msgid "Address Book"
msgstr "Adressen Boek"
#: ../../../uibase.cpp:77
msgid "Your Bitcoin Address:"
msgstr "Uw Bitcoin Address:"
#: ../../../uibase.cpp:84
msgid " &New... "
msgstr " &Nieuw... "
#: ../../../uibase.cpp:87
#: ../../../uibase.cpp:851
#: ../../../uibase.cpp:954
msgid " &Copy to Clipboard "
msgstr " &Kopieer naar Plakboord "
#: ../../../uibase.cpp:102
msgid "Balance:"
msgstr "Balans:"
#: ../../../uibase.cpp:121
msgid " All"
msgstr " Alles"
#: ../../../uibase.cpp:121
msgid " Sent"
msgstr " Verstuurd"
#: ../../../uibase.cpp:121
msgid " Received"
msgstr " Ontvangen"
#: ../../../uibase.cpp:121
msgid " In Progress"
msgstr " Word Verwerkt"
#: ../../../uibase.cpp:142
msgid "All Transactions"
msgstr "Alle transacties"
#: ../../../uibase.cpp:153
msgid "Sent/Received"
msgstr "Verstuurd/Ontvangen"
#: ../../../uibase.cpp:164
msgid "Sent"
msgstr "Verstuurd"
#: ../../../uibase.cpp:175
msgid "Received"
msgstr "Ontvangen"
#: ../../../uibase.cpp:318
#: ../../../uibase.cpp:479
#: ../../../uibase.cpp:580
#: ../../../uibase.cpp:793
#: ../../../uibase.cpp:854
#: ../../../uibase.cpp:963
#: ../../../uibase.cpp:1052
msgid "OK"
msgstr "OK"
#: ../../../uibase.cpp:361
msgid "Optional transaction fee you give to the nodes that process your transactions."
msgstr "Optionele transactie fooi die u geeft aan de nodes doe uw betaling verwerken."
#: ../../../uibase.cpp:370
msgid "Transaction fee:"
msgstr "Transactie fooi:"
#: ../../../uibase.cpp:386
msgid "&Limit coin generation to"
msgstr "&Limiteer coin generatie tot"
#: ../../../uibase.cpp:393
msgid "processors"
msgstr "processors"
#: ../../../uibase.cpp:399
msgid "&Start Bitcoin on system startup"
msgstr "&Start Bitcoin wanneer het systeem opstart"
#: ../../../uibase.cpp:403
msgid "&Minimize to the tray instead of the taskbar"
msgstr "&Minimalizeer tot systeemvak inplaats van taakbalk"
#: ../../../uibase.cpp:407
msgid "M&inimize to the tray on close"
msgstr "M&inimalizeer tot taakbalk bij sluiten"
#: ../../../uibase.cpp:414
msgid "&Connect through socks4 proxy: "
msgstr "&Verbind via socks4 proxy: "
#: ../../../uibase.cpp:426
msgid "Proxy &IP:"
msgstr "Proxy &IP:"
#: ../../../uibase.cpp:434
msgid " &Port:"
msgstr " &Poort:"
#: ../../../uibase.cpp:456
msgid "// [don't translate] Test panel 2 for future expansion"
msgstr ""
#: ../../../uibase.cpp:460
msgid "// [don't translate] Let's not start multiple pages until the first page is filled up"
msgstr ""
#: ../../../uibase.cpp:482
#: ../../../uibase.cpp:735
#: ../../../uibase.cpp:798
#: ../../../uibase.cpp:857
#: ../../../uibase.cpp:966
#: ../../../uibase.cpp:1055
msgid "Cancel"
msgstr "Annuleer"
#: ../../../uibase.cpp:485
msgid "&Apply"
msgstr "&Toepassen"
#: ../../../uibase.cpp:546
msgid "Bitcoin "
msgstr "Bitcoin "
#: ../../../uibase.cpp:552
msgid "version"
msgstr "versie"
#: ../../../uibase.cpp:563
msgid ""
"Copyright (c) 2009-2010 Satoshi Nakamoto.\n"
"\n"
"This is experimental software. Do not rely on it for actual financial transactions.\n"
"\n"
"Distributed under the MIT/X11 software license, see the accompanying file \n"
"license.txt or http://www.opensource.org/licenses/mit-license.php.\n"
"\n"
"This product includes software developed by the OpenSSL Project for use in the \n"
"OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by \n"
"Eric Young (eay@cryptsoft.com)."
msgstr ""
"Copyright (c) 2009-2010 Satoshi Nakamoto.\n"
"\n"
"Dit is experimentele software. Vertrouw niet op het voor echte financiele transacties.\n"
"\n"
"Gedistributeerd onder de MIT/X11 software licentie, see het bijbehorende bestand \n"
"license.txt of \"http://www.opensource.org/licenses/mit-license.php.\n"
"\n"
"Dit product komt met software ontwikkeld door het OpenSSL Project for gebruik in de\n"
"OpenSSL Toolkit (http://www.openssl.org/) and de cryptografische software geschreven door \n"
"Eric Young (eay@cryptsoft.com)."
#: ../../../uibase.cpp:619
msgid "Enter a Bitcoin address (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJED9L) or IP address (e.g. 123.45.6.7)"
msgstr "Voer een Bitcoin adres (bijvoorbeeld: 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJED9L) of IP address (bijvoorbeeld: 123.45.6.7) in."
#: ../../../uibase.cpp:633
msgid "Pay &To:"
msgstr "Betaal &Naar:"
#: ../../../uibase.cpp:648
msgid "&Paste"
msgstr "&Plakken"
#: ../../../uibase.cpp:651
msgid " Address &Book..."
msgstr " Adressen &Boek..."
#: ../../../uibase.cpp:658
msgid "&Amount:"
msgstr "&Hoeveelheid:"
#: ../../../uibase.cpp:668
msgid "T&ransfer:"
msgstr "O&verdracht:"
#: ../../../uibase.cpp:674
msgid " Standard"
msgstr " Standaard"
#: ../../../uibase.cpp:696
msgid "&From:"
msgstr "&Van:"
#: ../../../uibase.cpp:713
msgid "&Message:"
msgstr "&Mededeling:"
#: ../../../uibase.cpp:730
msgid "&Send"
msgstr "&Verstuur"
#: ../../../uibase.cpp:782
msgid ""
"\n"
"\n"
"Connecting..."
msgstr ""
"\n"
"\n"
"Verbinden..."
#: ../../../uibase.cpp:832
msgid "These are your Bitcoin addresses for receiving payments. You may want to give a different one to each sender so you can keep track of who is paying you. The highlighted address is displayed in the main window."
msgstr "Dit zijn uw Bitcoin Adressen voor het ontvangen van betalingen. Misschien wilt u elk contact persoon een ander adres geven zodat u kunt bij houden wie er u heeft betaald. De opgelichte adressen worden weergeven in het hoofd venster."
#: ../../../uibase.cpp:845
#: ../../../uibase.cpp:957
msgid "&Edit..."
msgstr "&Bewerk..."
#: ../../../uibase.cpp:848
#: ../../../uibase.cpp:960
msgid " &New Address... "
msgstr " &New Adres... "
#: ../../../uibase.cpp:920
msgid "Sending"
msgstr "Versturen"
#: ../../../uibase.cpp:928
msgid "These are your Bitcoin addresses for receiving payments. You can give a different one to each sender to keep track of who is paying you. The highlighted address will be displayed in the main window."
msgstr "Dit zijn uw Bitcoin adressen voor het ontvangen van betalingen. U kunt een aan elk contact persoon geven zodat u een overzicht kunt houden wie u betaald. Dit adres zal wergeven worden in het hoofd main venster."
#: ../../../uibase.cpp:941
msgid "Receiving"
msgstr "Ontvangen"
#: ../../../uibase.cpp:951
msgid "&Delete"
msgstr "&Verwijder"
#: ../../../uibase.h:150
msgid "Transaction Details"
msgstr "Transactie Details"
#: ../../../uibase.h:203
msgid "Options"
msgstr "Opties"
#: ../../../uibase.h:231
msgid "About Bitcoin"
msgstr "Over Bitcoin"
#: ../../../uibase.h:341
msgid "Your Bitcoin Addresses"
msgstr "Uw Bitcoin Adressen"

5
locale/readme.txt Normal file
View File

@@ -0,0 +1,5 @@
put bitcoin.po and bitcoin.mo files at:
locale/<langcode>/LC_MESSAGES/bitcoin.mo and .po
.po is the sourcefile
.mo is the compiled translation

1004
main.cpp

File diff suppressed because it is too large Load Diff

164
main.h
View File

@@ -1,4 +1,4 @@
// Copyright (c) 2009 Satoshi Nakamoto
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Distributed under the MIT/X11 software license, see the accompanying
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
@@ -34,13 +34,20 @@ extern int nBestHeight;
extern uint256 hashBestChain;
extern CBlockIndex* pindexBest;
extern unsigned int nTransactionsUpdated;
extern string strSetDataDir;
extern int nDropMessagesTest;
extern map<uint256, int> mapRequestCount;
extern CCriticalSection cs_mapRequestCount;
extern map<string, string> mapAddressBook;
extern CCriticalSection cs_mapAddressBook;
extern vector<unsigned char> vchDefaultKey;
// Settings
extern int fGenerateBitcoins;
extern int64 nTransactionFee;
extern CAddress addrIncoming;
extern int fLimitProcessors;
extern int nLimitProcessors;
extern int fMinimizeToTray;
extern int fMinimizeOnClose;
@@ -48,25 +55,29 @@ extern CAddress addrIncoming;
string GetAppDir();
bool CheckDiskSpace(int64 nAdditionalBytes=0);
FILE* OpenBlockFile(unsigned int nFile, unsigned int nBlockPos, const char* pszMode="rb");
FILE* AppendBlockFile(unsigned int& nFileRet);
bool AddKey(const CKey& key);
vector<unsigned char> GenerateNewKey();
bool AddToWallet(const CWalletTx& wtxIn);
void WalletUpdateSpent(const COutPoint& prevout);
void ReacceptWalletTransactions();
void RelayWalletTransactions();
bool LoadBlockIndex(bool fAllowNew=true);
void PrintBlockTree();
bool BitcoinMiner();
bool ProcessMessages(CNode* pfrom);
bool ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv);
bool SendMessages(CNode* pto);
bool SendMessages(CNode* pto, bool fSendTrickle);
int64 GetBalance();
bool CreateTransaction(CScript scriptPubKey, int64 nValue, CWalletTx& txNew, int64& nFeeRequiredRet);
bool CommitTransactionSpent(const CWalletTx& wtxNew);
bool SendMoney(CScript scriptPubKey, int64 nValue, CWalletTx& wtxNew);
bool CreateTransaction(CScript scriptPubKey, int64 nValue, CWalletTx& wtxNew, CKey& keyRet, int64& nFeeRequiredRet);
bool CommitTransaction(CWalletTx& wtxNew, const CKey& key);
bool BroadcastTransaction(CWalletTx& wtxNew);
string SendMoney(CScript scriptPubKey, int64 nValue, CWalletTx& wtxNew, bool fAskFee=false);
string SendMoneyToBitcoinAddress(string strAddress, int64 nValue, CWalletTx& wtxNew, bool fAskFee=false);
void GenerateBitcoins(bool fGenerate);
void ThreadBitcoinMiner(void* parg);
void BitcoinMiner();
@@ -339,7 +350,7 @@ public:
{
if (scriptPubKey.size() < 6)
return "CTxOut(error)";
return strprintf("CTxOut(nValue=%I64d.%08I64d, scriptPubKey=%s)", nValue / COIN, nValue % COIN, scriptPubKey.ToString().substr(0,24).c_str());
return strprintf("CTxOut(nValue=%"PRI64d".%08"PRI64d", scriptPubKey=%s)", nValue / COIN, nValue % COIN, scriptPubKey.ToString().substr(0,24).c_str());
}
void print() const
@@ -361,7 +372,7 @@ public:
int nVersion;
vector<CTxIn> vin;
vector<CTxOut> vout;
int nLockTime;
unsigned int nLockTime;
CTransaction()
@@ -396,9 +407,15 @@ public:
return SerializeHash(*this);
}
bool IsFinal() const
bool IsFinal(int64 nBlockTime=0) const
{
if (nLockTime == 0 || nLockTime < nBestHeight)
// Time based nLockTime implemented in 0.1.6,
// do not use time based until most 0.1.5 nodes have upgraded.
if (nLockTime == 0)
return true;
if (nBlockTime == 0)
nBlockTime = GetAdjustedTime();
if (nLockTime < (nLockTime < 500000000 ? nBestHeight : nBlockTime))
return true;
foreach(const CTxIn& txin, vin)
if (!txin.IsFinal())
@@ -502,14 +519,19 @@ public:
return nValueOut;
}
int64 GetMinFee(bool fDiscount=false) const
int64 GetMinFee(unsigned int nBlockSize=1) const
{
// Base fee is 1 cent per kilobyte
unsigned int nBytes = ::GetSerializeSize(*this, SER_NETWORK);
int64 nMinFee = (1 + (int64)nBytes / 1000) * CENT;
// First 100 transactions in a block are free
if (fDiscount && nBytes < 10000)
// Transactions under 60K are free as long as block size is under 80K
// (about 27,000bc if made of 50bc inputs)
if (nBytes < 60000 && nBlockSize < 80000)
nMinFee = 0;
// Transactions under 3K are free as long as block size is under 200K
if (nBytes < 3000 && nBlockSize < 200000)
nMinFee = 0;
// To limit dust spam, require a 0.01 fee if any output is less than 0.01
@@ -616,6 +638,8 @@ public:
// memory only
mutable bool fMerkleVerified;
mutable bool fGetCreditCached;
mutable int64 nGetCreditCached;
CMerkleTx()
@@ -633,14 +657,8 @@ public:
hashBlock = 0;
nIndex = -1;
fMerkleVerified = false;
}
int64 GetCredit() const
{
// Must wait until coinbase is safely deep enough in the chain before valuing it
if (IsCoinBase() && GetBlocksToMaturity() > 0)
return 0;
return CTransaction::GetCredit();
fGetCreditCached = false;
nGetCreditCached = 0;
}
IMPLEMENT_SERIALIZE
@@ -652,9 +670,24 @@ public:
READWRITE(nIndex);
)
int64 GetCredit(bool fUseCache=false) const
{
// Must wait until coinbase is safely deep enough in the chain before valuing it
if (IsCoinBase() && GetBlocksToMaturity() > 0)
return 0;
// GetBalance can assume transactions in mapWallet won't change
if (fUseCache && fGetCreditCached)
return nGetCreditCached;
nGetCreditCached = CTransaction::GetCredit();
fGetCreditCached = true;
return nGetCreditCached;
}
int SetMerkleBranch(const CBlock* pblock=NULL);
int GetDepthInMainChain() const;
int GetDepthInMainChain(int& nHeightRet) const;
int GetDepthInMainChain() const { int nHeight; return GetDepthInMainChain(nHeight); }
bool IsInMainChain() const { return GetDepthInMainChain() > 0; }
int GetBlocksToMaturity() const;
bool AcceptTransaction(CTxDB& txdb, bool fCheckInputs=true);
@@ -681,8 +714,9 @@ public:
char fSpent;
//// probably need to sign the order info so know it came from payer
// memory only
// memory only UI hints
mutable unsigned int nTimeDisplayed;
mutable int nLinesDisplayed;
CWalletTx()
@@ -707,6 +741,7 @@ public:
fFromMe = false;
fSpent = false;
nTimeDisplayed = 0;
nLinesDisplayed = 0;
}
IMPLEMENT_SERIALIZE
@@ -729,6 +764,7 @@ public:
int64 GetTxTime() const;
int GetRequestCount() const;
void AddSupportingTransactions(CTxDB& txdb);
@@ -947,10 +983,18 @@ public:
return error("CBlock::WriteToDisk() : ftell failed");
fileout << *this;
// Flush stdio buffers and commit to disk before returning
fflush(fileout);
#ifdef __WXMSW__
_commit(_fileno(fileout));
#else
fsync(fileno(fileout));
#endif
return true;
}
bool ReadFromDisk(unsigned int nFile, unsigned int nBlockPos, bool fReadTransactions)
bool ReadFromDisk(unsigned int nFile, unsigned int nBlockPos, bool fReadTransactions=true)
{
SetNull();
@@ -978,9 +1022,9 @@ public:
void print() const
{
printf("CBlock(hash=%s, ver=%d, hashPrevBlock=%s, hashMerkleRoot=%s, nTime=%u, nBits=%08x, nNonce=%u, vtx=%d)\n",
GetHash().ToString().substr(0,14).c_str(),
GetHash().ToString().substr(0,16).c_str(),
nVersion,
hashPrevBlock.ToString().substr(0,14).c_str(),
hashPrevBlock.ToString().substr(0,16).c_str(),
hashMerkleRoot.ToString().substr(0,6).c_str(),
nTime, nBits, nNonce,
vtx.size());
@@ -999,7 +1043,7 @@ public:
int64 GetBlockValue(int64 nFees) const;
bool DisconnectBlock(CTxDB& txdb, CBlockIndex* pindex);
bool ConnectBlock(CTxDB& txdb, CBlockIndex* pindex);
bool ReadFromDisk(const CBlockIndex* blockindex, bool fReadTransactions);
bool ReadFromDisk(const CBlockIndex* blockindex, bool fReadTransactions=true);
bool AddToBlockIndex(unsigned int nFile, unsigned int nBlockPos);
bool CheckBlock() const;
bool AcceptBlock();
@@ -1128,7 +1172,7 @@ public:
return strprintf("CBlockIndex(nprev=%08x, pnext=%08x, nFile=%d, nBlockPos=%-6d nHeight=%d, merkle=%s, hashBlock=%s)",
pprev, pnext, nFile, nBlockPos, nHeight,
hashMerkleRoot.ToString().substr(0,6).c_str(),
GetBlockHash().ToString().substr(0,14).c_str());
GetBlockHash().ToString().substr(0,16).c_str());
}
void print() const
@@ -1198,8 +1242,8 @@ public:
str += CBlockIndex::ToString();
str += strprintf("\n hashBlock=%s, hashPrev=%s, hashNext=%s)",
GetBlockHash().ToString().c_str(),
hashPrev.ToString().substr(0,14).c_str(),
hashNext.ToString().substr(0,14).c_str());
hashPrev.ToString().substr(0,16).c_str(),
hashNext.ToString().substr(0,16).c_str());
return str;
}
@@ -1267,6 +1311,27 @@ public:
vHave.push_back(hashGenesisBlock);
}
int GetDistanceBack()
{
// Retrace how far back it was in the sender's branch
int nDistance = 0;
int nStep = 1;
foreach(const uint256& hash, vHave)
{
map<uint256, CBlockIndex*>::iterator mi = mapBlockIndex.find(hash);
if (mi != mapBlockIndex.end())
{
CBlockIndex* pindex = (*mi).second;
if (pindex->IsInMainChain())
return nDistance;
}
nDistance += nStep;
if (nDistance > 10)
nStep *= 2;
}
return nDistance;
}
CBlockIndex* GetBlockIndex()
{
// Find the first block the caller has in the main chain
@@ -1313,6 +1378,35 @@ public:
//
// Private key that includes an expiration date in case it never gets used.
//
class CWalletKey
{
public:
CPrivKey vchPrivKey;
int64 nTimeCreated;
int64 nTimeExpires;
string strComment;
//// todo: add something to note what created it (user, getnewaddress, change)
//// maybe should have a map<string, string> property map
CWalletKey(int64 nTimeExpiresIn=0)
{
nTimeCreated = (nTimeExpiresIn ? GetTime() : 0);
nTimeExpires = nTimeExpiresIn;
}
IMPLEMENT_SERIALIZE
(
if (!(nType & SER_GETHASH))
READWRITE(nVersion);
READWRITE(vchPrivKey);
READWRITE(nTimeCreated);
READWRITE(nTimeExpires);
READWRITE(strComment);
)
};
@@ -1321,7 +1415,7 @@ public:
extern map<uint256, CTransaction> mapTransactions;
extern map<uint256, CWalletTx> mapWallet;
extern vector<pair<uint256, bool> > vWalletUpdated;
extern vector<uint256> vWalletUpdated;
extern CCriticalSection cs_mapWallet;
extern map<vector<unsigned char>, CPrivKey> mapKeys;
extern map<uint160, vector<unsigned char> > mapPubKeys;

View File

@@ -1,83 +0,0 @@
# Copyright (c) 2009 Satoshi Nakamoto
# Distributed under the MIT/X11 software license, see the accompanying
# file license.txt or http://www.opensource.org/licenses/mit-license.php.
ifneq "$(BUILD)" "debug"
ifneq "$(BUILD)" "release"
BUILD=debug
endif
endif
ifeq "$(BUILD)" "debug"
D=d
# note: gcc 3.x profile doesn't work
#DEBUGFLAGS=-O0 -g -pg -D__WXDEBUG__
DEBUGFLAGS=-g -D__WXDEBUG__
endif
INCLUDEPATHS=-I"/boost" -I"/DB/build_unix" -I"/OpenSSL/include" -I"/wxWidgets/lib/vc_lib/mswd" -I"/wxWidgets/include"
LIBPATHS=-L"/DB/build_unix" -L"/OpenSSL/out" -L"/wxWidgets/lib/gcc_lib"
LIBS= \
-l db_cxx \
-l eay32 \
-l wxmsw28$(D)_richtext -l wxmsw28$(D)_html -l wxmsw28$(D)_core -l wxbase28$(D) -l wxtiff$(D) -l wxjpeg$(D) -l wxpng$(D) -l wxzlib$(D) -l wxregex$(D) -l wxexpat$(D) \
-l kernel32 -l user32 -l gdi32 -l comdlg32 -l winspool -l winmm -l shell32 -l comctl32 -l ole32 -l oleaut32 -l uuid -l rpcrt4 -l advapi32 -l ws2_32
WXDEFS=-DWIN32 -D__WXMSW__ -D_WINDOWS -DNOPCH
CFLAGS=-mthreads -O0 -w -Wno-invalid-offsetof -Wformat $(DEBUGFLAGS) $(WXDEFS) $(INCLUDEPATHS)
HEADERS=headers.h util.h main.h serialize.h uint256.h key.h bignum.h script.h db.h base58.h
all: bitcoin.exe
headers.h.gch: headers.h $(HEADERS) net.h irc.h market.h uibase.h ui.h
g++ -c $(CFLAGS) -o $@ $<
obj/util.o: util.cpp $(HEADERS)
g++ -c $(CFLAGS) -o $@ $<
obj/script.o: script.cpp $(HEADERS)
g++ -c $(CFLAGS) -o $@ $<
obj/db.o: db.cpp $(HEADERS) market.h
g++ -c $(CFLAGS) -o $@ $<
obj/net.o: net.cpp $(HEADERS) net.h
g++ -c $(CFLAGS) -o $@ $<
obj/main.o: main.cpp $(HEADERS) net.h market.h sha.h
g++ -c $(CFLAGS) -o $@ $<
obj/market.o: market.cpp $(HEADERS) market.h
g++ -c $(CFLAGS) -o $@ $<
obj/ui.o: ui.cpp $(HEADERS) net.h uibase.h ui.h market.h
g++ -c $(CFLAGS) -o $@ $<
obj/uibase.o: uibase.cpp uibase.h
g++ -c $(CFLAGS) -o $@ $<
obj/sha.o: sha.cpp sha.h
g++ -c $(CFLAGS) -O3 -o $@ $<
obj/irc.o: irc.cpp $(HEADERS)
g++ -c $(CFLAGS) -o $@ $<
obj/ui_res.o: ui.rc rc/bitcoin.ico rc/check.ico rc/send16.bmp rc/send16mask.bmp rc/send16masknoshadow.bmp rc/send20.bmp rc/send20mask.bmp rc/addressbook16.bmp rc/addressbook16mask.bmp rc/addressbook20.bmp rc/addressbook20mask.bmp
windres $(WXDEFS) $(INCLUDEPATHS) -o $@ -i $<
OBJS=obj/util.o obj/script.o obj/db.o obj/net.o obj/main.o obj/market.o \
obj/ui.o obj/uibase.o obj/sha.o obj/irc.o obj/ui_res.o
bitcoin.exe: headers.h.gch $(OBJS)
-kill /f bitcoin.exe
g++ $(CFLAGS) -mwindows -Wl,--subsystem,windows -o $@ $(LIBPATHS) $(OBJS) $(LIBS)
clean:
-del /Q obj\*
-del /Q headers.h.gch

76
makefile.mingw Normal file
View File

@@ -0,0 +1,76 @@
# Copyright (c) 2009-2010 Satoshi Nakamoto
# Distributed under the MIT/X11 software license, see the accompanying
# file license.txt or http://www.opensource.org/licenses/mit-license.php.
# for wxWidgets-2.8.x, search and replace "mswud"->"mswd" and "29u"->"28"
INCLUDEPATHS= \
-I"/boost" \
-I"/db/build_unix" \
-I"/openssl/include" \
-I"/wxwidgets/lib/gcc_lib/mswud" \
-I"/wxwidgets/include"
LIBPATHS= \
-L"/boost/stage/lib" \
-L"/db/build_unix" \
-L"/openssl/out" \
-L"/wxwidgets/lib/gcc_lib"
WXLIBS= \
-l wxmsw29ud_html -l wxmsw29ud_core -l wxmsw29ud_adv -l wxbase29ud -l wxtiffd -l wxjpegd -l wxpngd -l wxzlibd
LIBS= \
-l libboost_system-mgw34-mt-d -l libboost_filesystem-mgw34-mt-d \
-l db_cxx \
-l eay32 \
-l kernel32 -l user32 -l gdi32 -l comdlg32 -l winspool -l winmm -l shell32 -l comctl32 -l ole32 -l oleaut32 -l uuid -l rpcrt4 -l advapi32 -l ws2_32 -l shlwapi
WXDEFS=-DWIN32 -D__WXMSW__ -D_WINDOWS -DNOPCH
DEBUGFLAGS=-g -D__WXDEBUG__
CFLAGS=-mthreads -O2 -w -Wno-invalid-offsetof -Wformat $(DEBUGFLAGS) $(WXDEFS) $(INCLUDEPATHS)
HEADERS=headers.h strlcpy.h serialize.h uint256.h util.h key.h bignum.h base58.h \
script.h db.h net.h irc.h main.h rpc.h uibase.h ui.h init.h sha.h
all: bitcoin.exe
headers.h.gch: headers.h $(HEADERS)
g++ -c $(CFLAGS) -o $@ $<
obj/%.o: %.cpp $(HEADERS) headers.h.gch
g++ -c $(CFLAGS) -o $@ $<
obj/sha.o: sha.cpp sha.h
g++ -c $(CFLAGS) -O3 -o $@ $<
obj/ui_res.o: ui.rc rc/bitcoin.ico rc/check.ico rc/send16.bmp rc/send16mask.bmp rc/send16masknoshadow.bmp rc/send20.bmp rc/send20mask.bmp rc/addressbook16.bmp rc/addressbook16mask.bmp rc/addressbook20.bmp rc/addressbook20mask.bmp
windres $(WXDEFS) $(INCLUDEPATHS) -o $@ -i $<
OBJS= \
obj/util.o \
obj/script.o \
obj/db.o \
obj/net.o \
obj/irc.o \
obj/main.o \
obj/rpc.o \
obj/init.o
bitcoin.exe: $(OBJS) obj/ui.o obj/uibase.o obj/sha.o obj/ui_res.o
g++ $(CFLAGS) -mwindows -Wl,--subsystem,windows -o $@ $(LIBPATHS) $^ $(WXLIBS) $(LIBS)
obj/nogui/%.o: %.cpp $(HEADERS)
g++ -c $(CFLAGS) -DwxUSE_GUI=0 -o $@ $<
bitcoind.exe: $(OBJS:obj/%=obj/nogui/%) obj/sha.o obj/ui_res.o
g++ $(CFLAGS) -o $@ $(LIBPATHS) $^ -l wxbase29ud $(LIBS)
clean:
-del /Q obj\*
-del /Q obj\nogui\*
-del /Q headers.h.gch

65
makefile.osx Normal file
View File

@@ -0,0 +1,65 @@
# Copyright (c) 2009-2010 Satoshi Nakamoto
# Distributed under the MIT/X11 software license, see the accompanying
# file license.txt or http://www.opensource.org/licenses/mit-license.php.
# Mac OS X makefile for bitcoin
# Laszlo Hanyecz (solar@heliacal.net)
DEPSDIR=/Users/macosuser/bitcoin/deps
INCLUDEPATHS= \
-I"$(DEPSDIR)/include"
LIBPATHS= \
-L"$(DEPSDIR)/lib"
WXLIBS=$(shell $(DEPSDIR)/bin/wx-config --libs --static)
LIBS= -dead_strip \
$(DEPSDIR)/lib/libdb_cxx-4.8.a \
$(DEPSDIR)/lib/libboost_system.a \
$(DEPSDIR)/lib/libboost_filesystem.a \
$(DEPSDIR)/lib/libcrypto.a
WXDEFS=$(shell $(DEPSDIR)/bin/wx-config --cxxflags) -DNOPCH -DMSG_NOSIGNAL=0
DEBUGFLAGS=-g -DwxDEBUG_LEVEL=0
# ppc doesn't work because we don't support big-endian
CFLAGS=-mmacosx-version-min=10.5 -arch i386 -arch x86_64 -O2 -Wno-invalid-offsetof -Wformat $(DEBUGFLAGS) $(WXDEFS) $(INCLUDEPATHS)
HEADERS=headers.h strlcpy.h serialize.h uint256.h util.h key.h bignum.h base58.h \
script.h db.h net.h irc.h main.h rpc.h uibase.h ui.h init.h sha.h
all: bitcoin
obj/%.o: %.cpp $(HEADERS)
g++ -c $(CFLAGS) -o $@ $<
obj/sha.o: sha.cpp sha.h
g++ -c $(CFLAGS) -O3 -o $@ $<
OBJS= \
obj/util.o \
obj/script.o \
obj/db.o \
obj/net.o \
obj/irc.o \
obj/main.o \
obj/rpc.o \
obj/init.o
bitcoin: $(OBJS) obj/ui.o obj/uibase.o obj/sha.o
g++ $(CFLAGS) -o $@ $(LIBPATHS) $^ $(WXLIBS) $(LIBS)
obj/nogui/%.o: %.cpp $(HEADERS)
g++ -c $(CFLAGS) -DwxUSE_GUI=0 -o $@ $<
bitcoind: $(OBJS:obj/%=obj/nogui/%) obj/sha.o
g++ $(CFLAGS) -o $@ $(LIBPATHS) $^ $(WXLIBS) $(LIBS)
clean:
-rm -f obj/*.o
-rm -f obj/nogui/*.o

73
makefile.unix Normal file
View File

@@ -0,0 +1,73 @@
# Copyright (c) 2009-2010 Satoshi Nakamoto
# Distributed under the MIT/X11 software license, see the accompanying
# file license.txt or http://www.opensource.org/licenses/mit-license.php.
INCLUDEPATHS= \
-I"/usr/include" \
-I"/usr/local/include/wx-2.9" \
-I"/usr/local/lib/wx/include/gtk2-unicode-debug-static-2.9"
LIBPATHS= \
-L"/usr/lib" \
-L"/usr/local/lib"
WXLIBS= \
-Wl,-Bstatic \
-l wx_gtk2ud-2.9 \
-Wl,-Bdynamic \
-l gtk-x11-2.0 -l SM
LIBS= \
-Wl,-Bstatic \
-l boost_system-mt -l boost_filesystem-mt \
-l db_cxx \
-Wl,-Bdynamic \
-l crypto \
-l gthread-2.0
WXDEFS=-D__WXGTK__ -DNOPCH
DEBUGFLAGS=-g -D__WXDEBUG__
CFLAGS=-O2 -Wno-invalid-offsetof -Wformat $(DEBUGFLAGS) $(WXDEFS) $(INCLUDEPATHS)
HEADERS=headers.h strlcpy.h serialize.h uint256.h util.h key.h bignum.h base58.h \
script.h db.h net.h irc.h main.h rpc.h uibase.h ui.h init.h sha.h
all: bitcoin
headers.h.gch: headers.h $(HEADERS)
g++ -c $(CFLAGS) -o $@ $<
obj/%.o: %.cpp $(HEADERS) headers.h.gch
g++ -c $(CFLAGS) -o $@ $<
obj/sha.o: sha.cpp sha.h
g++ -c $(CFLAGS) -O3 -o $@ $<
OBJS= \
obj/util.o \
obj/script.o \
obj/db.o \
obj/net.o \
obj/irc.o \
obj/main.o \
obj/rpc.o \
obj/init.o
bitcoin: $(OBJS) obj/ui.o obj/uibase.o obj/sha.o
g++ $(CFLAGS) -o $@ $(LIBPATHS) $^ $(WXLIBS) $(LIBS)
obj/nogui/%.o: %.cpp $(HEADERS)
g++ -c $(CFLAGS) -DwxUSE_GUI=0 -o $@ $<
bitcoind: $(OBJS:obj/%=obj/nogui/%) obj/sha.o
g++ $(CFLAGS) -o $@ $(LIBPATHS) $^ -l wx_baseud-2.9 $(LIBS)
clean:
-rm obj/*
-rm obj/nogui/*
-rm headers.h.gch

View File

@@ -1,76 +1,106 @@
# Copyright (c) 2009 Satoshi Nakamoto
# Copyright (c) 2009-2010 Satoshi Nakamoto
# Distributed under the MIT/X11 software license, see the accompanying
# file license.txt or http://www.opensource.org/licenses/mit-license.php.
!IF "$(BUILD)" != "debug" && "$(BUILD)" != "release"
BUILD=debug
!ENDIF
!IF "$(BUILD)" == "debug"
D=d
DEBUGFLAGS=/Zi /Od /D__WXDEBUG__
!ENDIF
# for wxWidgets-2.8.x, search and replace "mswud"->"mswd" and "29u"->"28"
INCLUDEPATHS= \
/I"/boost" \
/I"/db/build_windows" \
/I"/openssl/include" \
/I"/wxwidgets/lib/vc_lib/mswud" \
/I"/wxwidgets/include"
LIBPATHS= \
/LIBPATH:"/boost/stage/lib" \
/LIBPATH:"/db/build_windows/debug" \
/LIBPATH:"/openssl/out" \
/LIBPATH:"/wxwidgets/lib/vc_lib"
INCLUDEPATHS=/I"/boost" /I"/DB/build_windows" /I"/OpenSSL/include" /I"/wxWidgets/lib/vc_lib/mswd" /I"/wxWidgets/include"
LIBPATHS=/LIBPATH:"/DB/build_windows/$(BUILD)" /LIBPATH:"/OpenSSL/out" /LIBPATH:"/wxWidgets/lib/vc_lib"
LIBS= \
libdb47s$(D).lib \
libeay32.lib \
wxmsw28$(D)_richtext.lib wxmsw28$(D)_html.lib wxmsw28$(D)_core.lib wxbase28$(D).lib wxtiff$(D).lib wxjpeg$(D).lib wxpng$(D).lib wxzlib$(D).lib wxregex$(D).lib wxexpat$(D).lib \
kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib ws2_32.lib
WXDEFS=/DWIN32 /D__WXMSW__ /D_WINDOWS /DNOPCH
CFLAGS=/c /nologo /Ob0 /MD$(D) /EHsc /GR /Zm300 /YX /Fpobj/headers.pch $(DEBUGFLAGS) $(WXDEFS) $(INCLUDEPATHS)
HEADERS=headers.h util.h main.h serialize.h uint256.h key.h bignum.h script.h db.h base58.h
libboost_system-vc80-mt-gd.lib libboost_filesystem-vc80-mt-gd.lib \
libdb47sd.lib \
libeay32.lib \
wxmsw29ud_html.lib wxmsw29ud_core.lib wxmsw29ud_adv.lib wxbase29ud.lib wxtiffd.lib wxjpegd.lib wxpngd.lib wxzlibd.lib \
kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib ws2_32.lib shlwapi.lib
WXDEFS=/DWIN32 /D__WXMSW__ /D_WINDOWS /DNOPCH
DEBUGFLAGS=/Zi /Od /D__WXDEBUG__
CFLAGS=/c /nologo /Ob0 /MDd /EHsc /GR /Zm300 $(DEBUGFLAGS) $(WXDEFS) $(INCLUDEPATHS)
HEADERS=headers.h strlcpy.h serialize.h uint256.h util.h key.h bignum.h base58.h \
script.h db.h net.h irc.h main.h rpc.h uibase.h ui.h init.h sha.h
all: bitcoin.exe
obj\util.obj: util.cpp $(HEADERS)
.cpp{obj}.obj:
cl $(CFLAGS) /Fo$@ %s
obj\script.obj: script.cpp $(HEADERS)
cl $(CFLAGS) /Fo$@ %s
obj\util.obj: $(HEADERS)
obj\db.obj: db.cpp $(HEADERS) market.h
cl $(CFLAGS) /Fo$@ %s
obj\script.obj: $(HEADERS)
obj\net.obj: net.cpp $(HEADERS) net.h
cl $(CFLAGS) /Fo$@ %s
obj\db.obj: $(HEADERS)
obj\main.obj: main.cpp $(HEADERS) net.h market.h
cl $(CFLAGS) /Fo$@ %s
obj\net.obj: $(HEADERS)
obj\market.obj: market.cpp $(HEADERS) market.h
cl $(CFLAGS) /Fo$@ %s
obj\irc.obj: $(HEADERS)
obj\ui.obj: ui.cpp $(HEADERS) net.h uibase.h ui.h market.h
cl $(CFLAGS) /Fo$@ %s
obj\main.obj: $(HEADERS)
obj\uibase.obj: uibase.cpp uibase.h
cl $(CFLAGS) /Fo$@ %s
obj\rpc.obj: $(HEADERS)
obj\init.obj: $(HEADERS)
obj\ui.obj: $(HEADERS)
obj\uibase.obj: $(HEADERS)
obj\sha.obj: sha.cpp sha.h
cl $(CFLAGS) /O2 /Fo$@ %s
obj\irc.obj: irc.cpp $(HEADERS)
cl $(CFLAGS) /Fo$@ %s
obj\ui.res: ui.rc rc/bitcoin.ico rc/check.ico rc/send16.bmp rc/send16mask.bmp rc/send16masknoshadow.bmp rc/send20.bmp rc/send20mask.bmp rc/addressbook16.bmp rc/addressbook16mask.bmp rc/addressbook20.bmp rc/addressbook20mask.bmp
rc $(INCLUDEPATHS) $(WXDEFS) /Fo$@ %s
OBJS= \
obj\util.obj \
obj\script.obj \
obj\db.obj \
obj\net.obj \
obj\irc.obj \
obj\main.obj \
obj\rpc.obj \
obj\init.obj
OBJS=obj\util.obj obj\script.obj obj\db.obj obj\net.obj obj\main.obj obj\market.obj \
obj\ui.obj obj\uibase.obj obj\sha.obj obj\irc.obj obj\ui.res
bitcoin.exe: $(OBJS)
-kill /f bitcoin.exe & sleep 1
bitcoin.exe: $(OBJS) obj\ui.obj obj\uibase.obj obj\sha.obj obj\ui.res
link /nologo /DEBUG /SUBSYSTEM:WINDOWS /OUT:$@ $(LIBPATHS) $** $(LIBS)
.cpp{obj\nogui}.obj:
cl $(CFLAGS) /DwxUSE_GUI=0 /Fo$@ %s
obj\nogui\util.obj: $(HEADERS)
obj\nogui\script.obj: $(HEADERS)
obj\nogui\db.obj: $(HEADERS)
obj\nogui\net.obj: $(HEADERS)
obj\nogui\irc.obj: $(HEADERS)
obj\nogui\main.obj: $(HEADERS)
obj\nogui\rpc.obj: $(HEADERS)
obj\nogui\init.obj: $(HEADERS)
bitcoind.exe: $(OBJS:obj\=obj\nogui\) obj\sha.obj obj\ui.res
link /nologo /DEBUG /OUT:$@ $(LIBPATHS) $** $(LIBS)
clean:
-del /Q obj\*
-del *.ilk

View File

@@ -1,264 +0,0 @@
// Copyright (c) 2009 Satoshi Nakamoto
// Distributed under the MIT/X11 software license, see the accompanying
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
#include "headers.h"
//
// Global state variables
//
//// later figure out how these are persisted
map<uint256, CProduct> mapMyProducts;
map<uint256, CProduct> mapProducts;
CCriticalSection cs_mapProducts;
bool AdvertInsert(const CProduct& product)
{
uint256 hash = product.GetHash();
bool fNew = false;
bool fUpdated = false;
CRITICAL_BLOCK(cs_mapProducts)
{
// Insert or find existing product
pair<map<uint256, CProduct>::iterator, bool> item = mapProducts.insert(make_pair(hash, product));
CProduct* pproduct = &(*(item.first)).second;
fNew = item.second;
// Update if newer
if (product.nSequence > pproduct->nSequence)
{
*pproduct = product;
fUpdated = true;
}
}
//if (fNew)
// NotifyProductAdded(hash);
//else if (fUpdated)
// NotifyProductUpdated(hash);
return (fNew || fUpdated);
}
void AdvertErase(const CProduct& product)
{
uint256 hash = product.GetHash();
CRITICAL_BLOCK(cs_mapProducts)
mapProducts.erase(hash);
//NotifyProductDeleted(hash);
}
template<typename T>
unsigned int Union(T& v1, T& v2)
{
// v1 = v1 union v2
// v1 and v2 must be sorted
// returns the number of elements added to v1
///// need to check that this is equivalent, then delete this comment
//vector<unsigned short> vUnion(v1.size() + v2.size());
//vUnion.erase(set_union(v1.begin(), v1.end(),
// v2.begin(), v2.end(),
// vUnion.begin()),
// vUnion.end());
T vUnion;
vUnion.reserve(v1.size() + v2.size());
set_union(v1.begin(), v1.end(),
v2.begin(), v2.end(),
back_inserter(vUnion));
unsigned int nAdded = vUnion.size() - v1.size();
if (nAdded > 0)
v1 = vUnion;
return nAdded;
}
void CUser::AddAtom(unsigned short nAtom, bool fOrigin)
{
// Ignore duplicates
if (binary_search(vAtomsIn.begin(), vAtomsIn.end(), nAtom) ||
find(vAtomsNew.begin(), vAtomsNew.end(), nAtom) != vAtomsNew.end())
return;
//// instead of zero atom, should change to free atom that propagates,
//// limited to lower than a certain value like 5 so conflicts quickly
// The zero atom never propagates,
// new atoms always propagate through the user that created them
if (nAtom == 0 || fOrigin)
{
vector<unsigned short> vTmp(1, nAtom);
Union(vAtomsIn, vTmp);
if (fOrigin)
vAtomsOut.push_back(nAtom);
return;
}
vAtomsNew.push_back(nAtom);
if (vAtomsNew.size() >= nFlowthroughRate || vAtomsOut.empty())
{
// Select atom to flow through to vAtomsOut
vAtomsOut.push_back(vAtomsNew[GetRand(vAtomsNew.size())]);
// Merge vAtomsNew into vAtomsIn
sort(vAtomsNew.begin(), vAtomsNew.end());
Union(vAtomsIn, vAtomsNew);
vAtomsNew.clear();
}
}
bool AddAtomsAndPropagate(uint256 hashUserStart, const vector<unsigned short>& vAtoms, bool fOrigin)
{
CReviewDB reviewdb;
map<uint256, vector<unsigned short> > pmapPropagate[2];
pmapPropagate[0][hashUserStart] = vAtoms;
for (int side = 0; !pmapPropagate[side].empty(); side = 1 - side)
{
map<uint256, vector<unsigned short> >& mapFrom = pmapPropagate[side];
map<uint256, vector<unsigned short> >& mapTo = pmapPropagate[1 - side];
for (map<uint256, vector<unsigned short> >::iterator mi = mapFrom.begin(); mi != mapFrom.end(); ++mi)
{
const uint256& hashUser = (*mi).first;
const vector<unsigned short>& vReceived = (*mi).second;
///// this would be a lot easier on the database if it put the new atom at the beginning of the list,
///// so the change would be right next to the vector size.
// Read user
CUser user;
reviewdb.ReadUser(hashUser, user);
unsigned int nIn = user.vAtomsIn.size();
unsigned int nNew = user.vAtomsNew.size();
unsigned int nOut = user.vAtomsOut.size();
// Add atoms received
foreach(unsigned short nAtom, vReceived)
user.AddAtom(nAtom, fOrigin);
fOrigin = false;
// Don't bother writing to disk if no changes
if (user.vAtomsIn.size() == nIn && user.vAtomsNew.size() == nNew)
continue;
// Propagate
if (user.vAtomsOut.size() > nOut)
foreach(const uint256& hash, user.vLinksOut)
mapTo[hash].insert(mapTo[hash].end(), user.vAtomsOut.begin() + nOut, user.vAtomsOut.end());
// Write back
if (!reviewdb.WriteUser(hashUser, user))
return false;
}
mapFrom.clear();
}
return true;
}
bool CReview::AcceptReview()
{
// Timestamp
nTime = GetTime();
// Check signature
if (!CKey::Verify(vchPubKeyFrom, GetSigHash(), vchSig))
return false;
CReviewDB reviewdb;
// Add review text to recipient
vector<CReview> vReviews;
reviewdb.ReadReviews(hashTo, vReviews);
vReviews.push_back(*this);
if (!reviewdb.WriteReviews(hashTo, vReviews))
return false;
// Add link from sender
CUser user;
uint256 hashFrom = Hash(vchPubKeyFrom.begin(), vchPubKeyFrom.end());
reviewdb.ReadUser(hashFrom, user);
user.vLinksOut.push_back(hashTo);
if (!reviewdb.WriteUser(hashFrom, user))
return false;
reviewdb.Close();
// Propagate atoms to recipient
vector<unsigned short> vZeroAtom(1, 0);
if (!AddAtomsAndPropagate(hashTo, user.vAtomsOut.size() ? user.vAtomsOut : vZeroAtom, false))
return false;
return true;
}
bool CProduct::CheckSignature()
{
return (CKey::Verify(vchPubKeyFrom, GetSigHash(), vchSig));
}
bool CProduct::CheckProduct()
{
if (!CheckSignature())
return false;
// Make sure it's a summary product
if (!mapDetails.empty() || !vOrderForm.empty())
return false;
// Look up seller's atom count
CReviewDB reviewdb("r");
CUser user;
reviewdb.ReadUser(GetUserHash(), user);
nAtoms = user.GetAtomCount();
reviewdb.Close();
////// delme, this is now done by AdvertInsert
//// Store to memory
//CRITICAL_BLOCK(cs_mapProducts)
// mapProducts[GetHash()] = *this;
return true;
}

182
market.h
View File

@@ -1,182 +0,0 @@
// Copyright (c) 2009 Satoshi Nakamoto
// Distributed under the MIT/X11 software license, see the accompanying
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
class CUser;
class CReview;
class CProduct;
static const unsigned int nFlowthroughRate = 2;
bool AdvertInsert(const CProduct& product);
void AdvertErase(const CProduct& product);
bool AddAtomsAndPropagate(uint256 hashUserStart, const vector<unsigned short>& vAtoms, bool fOrigin);
class CUser
{
public:
vector<unsigned short> vAtomsIn;
vector<unsigned short> vAtomsNew;
vector<unsigned short> vAtomsOut;
vector<uint256> vLinksOut;
CUser()
{
}
IMPLEMENT_SERIALIZE
(
if (!(nType & SER_GETHASH))
READWRITE(nVersion);
READWRITE(vAtomsIn);
READWRITE(vAtomsNew);
READWRITE(vAtomsOut);
READWRITE(vLinksOut);
)
void SetNull()
{
vAtomsIn.clear();
vAtomsNew.clear();
vAtomsOut.clear();
vLinksOut.clear();
}
uint256 GetHash() const { return SerializeHash(*this); }
int GetAtomCount() const
{
return (vAtomsIn.size() + vAtomsNew.size());
}
void AddAtom(unsigned short nAtom, bool fOrigin);
};
class CReview
{
public:
int nVersion;
uint256 hashTo;
map<string, string> mapValue;
vector<unsigned char> vchPubKeyFrom;
vector<unsigned char> vchSig;
// memory only
unsigned int nTime;
int nAtoms;
CReview()
{
nVersion = 1;
hashTo = 0;
nTime = 0;
nAtoms = 0;
}
IMPLEMENT_SERIALIZE
(
READWRITE(this->nVersion);
nVersion = this->nVersion;
if (!(nType & SER_DISK))
READWRITE(hashTo);
READWRITE(mapValue);
READWRITE(vchPubKeyFrom);
if (!(nType & SER_GETHASH))
READWRITE(vchSig);
)
uint256 GetHash() const { return SerializeHash(*this); }
uint256 GetSigHash() const { return SerializeHash(*this, SER_GETHASH|SER_SKIPSIG); }
uint256 GetUserHash() const { return Hash(vchPubKeyFrom.begin(), vchPubKeyFrom.end()); }
bool AcceptReview();
};
class CProduct
{
public:
int nVersion;
CAddress addr;
map<string, string> mapValue;
map<string, string> mapDetails;
vector<pair<string, string> > vOrderForm;
unsigned int nSequence;
vector<unsigned char> vchPubKeyFrom;
vector<unsigned char> vchSig;
// disk only
int nAtoms;
// memory only
set<unsigned int> setSources;
CProduct()
{
nVersion = 1;
nAtoms = 0;
nSequence = 0;
}
IMPLEMENT_SERIALIZE
(
READWRITE(this->nVersion);
nVersion = this->nVersion;
READWRITE(addr);
READWRITE(mapValue);
if (!(nType & SER_GETHASH))
{
READWRITE(mapDetails);
READWRITE(vOrderForm);
READWRITE(nSequence);
}
READWRITE(vchPubKeyFrom);
if (!(nType & SER_GETHASH))
READWRITE(vchSig);
if (nType & SER_DISK)
READWRITE(nAtoms);
)
uint256 GetHash() const { return SerializeHash(*this); }
uint256 GetSigHash() const { return SerializeHash(*this, SER_GETHASH|SER_SKIPSIG); }
uint256 GetUserHash() const { return Hash(vchPubKeyFrom.begin(), vchPubKeyFrom.end()); }
bool CheckSignature();
bool CheckProduct();
};
extern map<uint256, CProduct> mapProducts;
extern CCriticalSection cs_mapProducts;
extern map<uint256, CProduct> mapMyProducts;

970
net.cpp

File diff suppressed because it is too large Load Diff

350
net.h
View File

@@ -1,4 +1,4 @@
// Copyright (c) 2009 Satoshi Nakamoto
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Distributed under the MIT/X11 software license, see the accompanying
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
@@ -7,10 +7,12 @@ class CAddress;
class CInv;
class CRequestTracker;
class CNode;
class CBlockIndex;
extern int nBestHeight;
static const unsigned short DEFAULT_PORT = htons(8333);
#define DEFAULT_PORT htons(8333)
static const unsigned int PUBLISH_HOPS = 5;
enum
{
@@ -20,20 +22,17 @@ enum
bool ConnectSocket(const CAddress& addrConnect, SOCKET& hSocketRet);
bool GetMyExternalIP(unsigned int& ipRet);
bool AddAddress(CAddrDB& addrdb, const CAddress& addr);
bool AddAddress(CAddress addr, bool fCurrentlyOnline=true);
void AddressCurrentlyConnected(const CAddress& addr);
CNode* FindNode(unsigned int ip);
CNode* ConnectNode(CAddress addrConnect, int64 nTimeout=0);
void AbandonRequests(void (*fn)(void*, CDataStream&), void* param1);
bool AnySubscribed(unsigned int nChannel);
void ThreadBitcoinMiner(void* parg);
bool StartNode(string& strError=REF(string()));
bool BindListenPort(string& strError=REF(string()));
void StartNode(void* parg);
bool StopNode();
void CheckForShutdown(int n);
@@ -47,6 +46,7 @@ void CheckForShutdown(int n);
// (4) message start
// (12) command
// (4) size
// (4) checksum
// The message start string is designed to be unlikely to occur in normal data.
// The characters are rarely used upper ascii, not valid as UTF-8, and produce
@@ -60,6 +60,7 @@ public:
char pchMessageStart[sizeof(::pchMessageStart)];
char pchCommand[COMMAND_SIZE];
unsigned int nMessageSize;
unsigned int nChecksum;
CMessageHeader()
{
@@ -67,6 +68,7 @@ public:
memset(pchCommand, 0, sizeof(pchCommand));
pchCommand[1] = 1;
nMessageSize = -1;
nChecksum = 0;
}
CMessageHeader(const char* pszCommand, unsigned int nMessageSizeIn)
@@ -74,6 +76,7 @@ public:
memcpy(pchMessageStart, ::pchMessageStart, sizeof(pchMessageStart));
strncpy(pchCommand, pszCommand, COMMAND_SIZE);
nMessageSize = nMessageSizeIn;
nChecksum = 0;
}
IMPLEMENT_SERIALIZE
@@ -81,6 +84,8 @@ public:
READWRITE(FLATDATA(pchMessageStart));
READWRITE(FLATDATA(pchCommand));
READWRITE(nMessageSize);
if (nVersion >= 209)
READWRITE(nChecksum);
)
string GetCommand()
@@ -141,61 +146,77 @@ public:
unsigned int nTime;
// memory only
unsigned int nLastFailed;
unsigned int nLastTry;
CAddress()
{
nServices = 0;
memcpy(pchReserved, pchIPv4, sizeof(pchReserved));
ip = 0;
port = DEFAULT_PORT;
nTime = GetAdjustedTime();
nLastFailed = 0;
Init();
}
CAddress(unsigned int ipIn, unsigned short portIn=DEFAULT_PORT, uint64 nServicesIn=0)
CAddress(unsigned int ipIn, unsigned short portIn=DEFAULT_PORT, uint64 nServicesIn=NODE_NETWORK)
{
nServices = nServicesIn;
memcpy(pchReserved, pchIPv4, sizeof(pchReserved));
Init();
ip = ipIn;
port = portIn;
nTime = GetAdjustedTime();
nLastFailed = 0;
nServices = nServicesIn;
}
explicit CAddress(const struct sockaddr_in& sockaddr, uint64 nServicesIn=0)
explicit CAddress(const struct sockaddr_in& sockaddr, uint64 nServicesIn=NODE_NETWORK)
{
nServices = nServicesIn;
memcpy(pchReserved, pchIPv4, sizeof(pchReserved));
Init();
ip = sockaddr.sin_addr.s_addr;
port = sockaddr.sin_port;
nTime = GetAdjustedTime();
nLastFailed = 0;
nServices = nServicesIn;
}
explicit CAddress(const char* pszIn, uint64 nServicesIn=0)
explicit CAddress(const char* pszIn, uint64 nServicesIn=NODE_NETWORK)
{
Init();
SetAddress(pszIn);
nServices = nServicesIn;
}
explicit CAddress(string strIn, uint64 nServicesIn=NODE_NETWORK)
{
Init();
SetAddress(strIn.c_str());
nServices = nServicesIn;
}
void Init()
{
nServices = NODE_NETWORK;
memcpy(pchReserved, pchIPv4, sizeof(pchReserved));
ip = 0;
ip = INADDR_NONE;
port = DEFAULT_PORT;
nTime = GetAdjustedTime();
nLastFailed = 0;
nLastTry = 0;
}
bool SetAddress(const char* pszIn)
{
ip = INADDR_NONE;
port = DEFAULT_PORT;
char psz[100];
if (strlen(pszIn) > ARRAYLEN(psz)-1)
return;
strcpy(psz, pszIn);
unsigned int a, b, c, d, e;
strlcpy(psz, pszIn, sizeof(psz));
unsigned int a=0, b=0, c=0, d=0, e=0;
if (sscanf(psz, "%u.%u.%u.%u:%u", &a, &b, &c, &d, &e) < 4)
return;
return false;
char* pszPort = strchr(psz, ':');
if (pszPort)
{
*pszPort++ = '\0';
port = htons(atoi(pszPort));
if (atoi(pszPort) < 0 || atoi(pszPort) > USHRT_MAX)
port = htons(USHRT_MAX);
}
ip = inet_addr(psz);
return IsValid();
}
bool SetAddress(string strIn)
{
return SetAddress(strIn.c_str());
}
IMPLEMENT_SERIALIZE
@@ -206,7 +227,7 @@ public:
READWRITE(nTime);
}
READWRITE(nServices);
READWRITE(FLATDATA(pchReserved));
READWRITE(FLATDATA(pchReserved)); // for IPv6
READWRITE(ip);
READWRITE(port);
)
@@ -218,6 +239,11 @@ public:
a.port == b.port);
}
friend inline bool operator!=(const CAddress& a, const CAddress& b)
{
return (!(a == b));
}
friend inline bool operator<(const CAddress& a, const CAddress& b)
{
int ret = memcmp(a.pchReserved, b.pchReserved, sizeof(a.pchReserved));
@@ -249,6 +275,7 @@ public:
struct sockaddr_in GetSockAddr() const
{
struct sockaddr_in sockaddr;
memset(&sockaddr, 0, sizeof(sockaddr));
sockaddr.sin_family = AF_INET;
sockaddr.sin_addr.s_addr = ip;
sockaddr.sin_port = port;
@@ -262,7 +289,17 @@ public:
bool IsRoutable() const
{
return !(GetByte(3) == 10 || (GetByte(3) == 192 && GetByte(2) == 168) || GetByte(3) == 127 || GetByte(3) == 0);
return !(GetByte(3) == 10 ||
(GetByte(3) == 192 && GetByte(2) == 168) ||
GetByte(3) == 127 ||
GetByte(3) == 0 ||
ip == 0 ||
ip == INADDR_NONE);
}
bool IsValid() const
{
return (ip != 0 && ip != INADDR_NONE && port != htons(USHRT_MAX));
}
unsigned char GetByte(int n) const
@@ -280,10 +317,19 @@ public:
return strprintf("%u.%u.%u.%u", GetByte(3), GetByte(2), GetByte(1), GetByte(0));
}
string ToStringPort() const
{
return strprintf("%u", ntohs(port));
}
string ToStringLog() const
{
return "";
}
string ToString() const
{
return strprintf("%u.%u.%u.%u:%u", GetByte(3), GetByte(2), GetByte(1), GetByte(0), ntohs(port));
//return strprintf("%u.%u.%u.%u", GetByte(3), GetByte(2), GetByte(1), GetByte(0));
}
void print() const
@@ -302,9 +348,6 @@ enum
{
MSG_TX = 1,
MSG_BLOCK,
MSG_REVIEW,
MSG_PRODUCT,
MSG_TABLE,
};
static const char* ppszTypeName[] =
@@ -312,9 +355,6 @@ static const char* ppszTypeName[] =
"ERROR",
"tx",
"block",
"review",
"product",
"table",
};
class CInv
@@ -376,7 +416,7 @@ public:
string ToString() const
{
return strprintf("%s %s", GetCommand(), hash.ToString().substr(0,14).c_str());
return strprintf("%s %s", GetCommand(), hash.ToString().substr(0,16).c_str());
}
void print() const
@@ -415,8 +455,11 @@ extern bool fClient;
extern uint64 nLocalServices;
extern CAddress addrLocalHost;
extern CNode* pnodeLocalHost;
extern bool fShutdown;
extern array<bool, 10> vfThreadRunning;
extern uint64 nLocalHostNonce;
extern array<int, 10> vnThreadsRunning;
extern SOCKET hListenSocket;
extern int64 nThreadSocketHandlerHeartbeat;
extern vector<CNode*> vNodes;
extern CCriticalSection cs_vNodes;
extern map<vector<unsigned char>, CAddress> mapAddresses;
@@ -425,12 +468,16 @@ extern map<CInv, CDataStream> mapRelay;
extern deque<pair<int64, CInv> > vRelayExpiration;
extern CCriticalSection cs_mapRelay;
extern map<CInv, int64> mapAlreadyAskedFor;
// Settings
extern int fUseProxy;
extern CAddress addrProxy;
class CNode
{
public:
@@ -441,12 +488,18 @@ public:
CDataStream vRecv;
CCriticalSection cs_vSend;
CCriticalSection cs_vRecv;
unsigned int nPushPos;
int64 nLastSend;
int64 nLastRecv;
int64 nLastSendEmpty;
int64 nTimeConnected;
unsigned int nHeaderStart;
unsigned int nMessageStart;
CAddress addr;
int nVersion;
bool fClient;
bool fInbound;
bool fNetworkNode;
bool fSuccessfullyConnected;
bool fDisconnect;
protected:
int nRefCount;
@@ -454,14 +507,18 @@ public:
int64 nReleaseTime;
map<uint256, CRequestTracker> mapRequests;
CCriticalSection cs_mapRequests;
uint256 hashContinue;
CBlockIndex* pindexLastGetBlocksBegin;
uint256 hashLastGetBlocksEnd;
int nStartingHeight;
// flood
vector<CAddress> vAddrToSend;
set<CAddress> setAddrKnown;
bool fGetAddr;
// inventory based relay
set<CInv> setInventoryKnown;
set<CInv> setInventoryKnown2;
vector<CInv> vInventoryToSend;
CCriticalSection cs_inventory;
multimap<int64, CInv> mapAskFor;
@@ -475,28 +532,54 @@ public:
nServices = 0;
hSocket = hSocketIn;
vSend.SetType(SER_NETWORK);
vSend.SetVersion(0);
vRecv.SetType(SER_NETWORK);
nPushPos = -1;
vRecv.SetVersion(0);
// Version 0.2 obsoletes 20 Feb 2012
if (GetTime() > 1329696000)
{
vSend.SetVersion(209);
vRecv.SetVersion(209);
}
nLastSend = 0;
nLastRecv = 0;
nLastSendEmpty = GetTime();
nTimeConnected = GetTime();
nHeaderStart = -1;
nMessageStart = -1;
addr = addrIn;
nVersion = 0;
fClient = false; // set by version message
fInbound = fInboundIn;
fNetworkNode = false;
fSuccessfullyConnected = false;
fDisconnect = false;
nRefCount = 0;
nReleaseTime = 0;
hashContinue = 0;
pindexLastGetBlocksBegin = 0;
hashLastGetBlocksEnd = 0;
nStartingHeight = -1;
fGetAddr = false;
vfSubscribe.assign(256, false);
// Push a version message
/// when NTP implemented, change to just nTime = GetAdjustedTime()
int64 nTime = (fInbound ? GetAdjustedTime() : GetTime());
PushMessage("version", VERSION, nLocalServices, nTime, addr);
CAddress addrYou = (fUseProxy ? CAddress("0.0.0.0") : addr);
CAddress addrMe = (fUseProxy ? CAddress("0.0.0.0") : addrLocalHost);
RAND_bytes((unsigned char*)&nLocalHostNonce, sizeof(nLocalHostNonce));
PushMessage("version", VERSION, nLocalServices, nTime, addrYou, addrMe,
nLocalHostNonce, string(pszSubVer), nBestHeight);
}
~CNode()
{
if (hSocket != INVALID_SOCKET)
{
closesocket(hSocket);
hSocket = INVALID_SOCKET;
}
}
private:
@@ -505,22 +588,18 @@ private:
public:
bool ReadyToDisconnect()
{
return fDisconnect || GetRefCount() <= 0;
}
int GetRefCount()
{
return max(nRefCount, 0) + (GetTime() < nReleaseTime ? 1 : 0);
}
void AddRef(int64 nTimeout=0)
CNode* AddRef(int64 nTimeout=0)
{
if (nTimeout != 0)
nReleaseTime = max(nReleaseTime, GetTime() + nTimeout);
else
nRefCount++;
return this;
}
void Release()
@@ -530,6 +609,21 @@ public:
void AddAddressKnown(const CAddress& addr)
{
setAddrKnown.insert(addr);
}
void PushAddress(const CAddress& addr)
{
// Known checking here is only to save space from duplicates.
// SendMessages will filter it again for knowns that were added
// after addresses were pushed.
if (!setAddrKnown.count(addr))
vAddrToSend.push_back(addr);
}
void AddInventoryKnown(const CInv& inv)
{
CRITICAL_BLOCK(cs_inventory)
@@ -548,7 +642,7 @@ public:
// We're using mapAskFor as a priority queue,
// the key is the earliest time the request can be sent
int64& nRequestTime = mapAlreadyAskedFor[inv];
printf("askfor %s %I64d\n", inv.ToString().c_str(), nRequestTime);
printf("askfor %s %"PRI64d"\n", inv.ToString().c_str(), nRequestTime);
// Make sure not to reuse time indexes to keep things in the same order
int64 nNow = (GetTime() - 1) * 1000000;
@@ -564,55 +658,67 @@ public:
void BeginMessage(const char* pszCommand)
{
EnterCriticalSection(&cs_vSend);
if (nPushPos != -1)
cs_vSend.Enter();
if (nHeaderStart != -1)
AbortMessage();
nPushPos = vSend.size();
nHeaderStart = vSend.size();
vSend << CMessageHeader(pszCommand, 0);
printf("sending: %-12s ", pszCommand);
nMessageStart = vSend.size();
if (fDebug)
printf("%s ", DateTimeStrFormat("%x %H:%M:%S", GetTime()).c_str());
printf("sending: %s ", pszCommand);
}
void AbortMessage()
{
if (nPushPos == -1)
if (nHeaderStart == -1)
return;
vSend.resize(nPushPos);
nPushPos = -1;
LeaveCriticalSection(&cs_vSend);
vSend.resize(nHeaderStart);
nHeaderStart = -1;
nMessageStart = -1;
cs_vSend.Leave();
printf("(aborted)\n");
}
void EndMessage()
{
extern int nDropMessagesTest;
if (nDropMessagesTest > 0 && GetRand(nDropMessagesTest) == 0)
if (mapArgs.count("-dropmessagestest") && GetRand(atoi(mapArgs["-dropmessagestest"])) == 0)
{
printf("dropmessages DROPPING SEND MESSAGE\n");
AbortMessage();
return;
}
if (nPushPos == -1)
if (nHeaderStart == -1)
return;
// Patch in the size
unsigned int nSize = vSend.size() - nPushPos - sizeof(CMessageHeader);
memcpy((char*)&vSend[nPushPos] + offsetof(CMessageHeader, nMessageSize), &nSize, sizeof(nSize));
// Set the size
unsigned int nSize = vSend.size() - nMessageStart;
memcpy((char*)&vSend[nHeaderStart] + offsetof(CMessageHeader, nMessageSize), &nSize, sizeof(nSize));
printf("(%d bytes) ", nSize);
//for (int i = nPushPos+sizeof(CMessageHeader); i < min(vSend.size(), nPushPos+sizeof(CMessageHeader)+20U); i++)
// printf("%02x ", vSend[i] & 0xff);
// Set the checksum
if (vSend.GetVersion() >= 209)
{
uint256 hash = Hash(vSend.begin() + nMessageStart, vSend.end());
unsigned int nChecksum = 0;
memcpy(&nChecksum, &hash, sizeof(nChecksum));
assert(nMessageStart - nHeaderStart >= offsetof(CMessageHeader, nChecksum) + sizeof(nChecksum));
memcpy((char*)&vSend[nHeaderStart] + offsetof(CMessageHeader, nChecksum), &nChecksum, sizeof(nChecksum));
}
printf("(%d bytes) ", nSize);
printf("\n");
nPushPos = -1;
LeaveCriticalSection(&cs_vSend);
nHeaderStart = -1;
nMessageStart = -1;
cs_vSend.Leave();
}
void EndMessageAbortIfEmpty()
{
if (nPushPos == -1)
if (nHeaderStart == -1)
return;
int nSize = vSend.size() - nPushPos - sizeof(CMessageHeader);
int nSize = vSend.size() - nMessageStart;
if (nSize > 0)
EndMessage();
else
@@ -621,9 +727,9 @@ public:
const char* GetMessageCommand() const
{
if (nPushPos == -1)
if (nHeaderStart == -1)
return "";
return &vSend[nPushPos] + offsetof(CMessageHeader, pchCommand);
return &vSend[nHeaderStart] + offsetof(CMessageHeader, pchCommand);
}
@@ -707,6 +813,86 @@ public:
}
}
template<typename T1, typename T2, typename T3, typename T4, typename T5>
void PushMessage(const char* pszCommand, const T1& a1, const T2& a2, const T3& a3, const T4& a4, const T5& a5)
{
try
{
BeginMessage(pszCommand);
vSend << a1 << a2 << a3 << a4 << a5;
EndMessage();
}
catch (...)
{
AbortMessage();
throw;
}
}
template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
void PushMessage(const char* pszCommand, const T1& a1, const T2& a2, const T3& a3, const T4& a4, const T5& a5, const T6& a6)
{
try
{
BeginMessage(pszCommand);
vSend << a1 << a2 << a3 << a4 << a5 << a6;
EndMessage();
}
catch (...)
{
AbortMessage();
throw;
}
}
template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7>
void PushMessage(const char* pszCommand, const T1& a1, const T2& a2, const T3& a3, const T4& a4, const T5& a5, const T6& a6, const T7& a7)
{
try
{
BeginMessage(pszCommand);
vSend << a1 << a2 << a3 << a4 << a5 << a6 << a7;
EndMessage();
}
catch (...)
{
AbortMessage();
throw;
}
}
template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8>
void PushMessage(const char* pszCommand, const T1& a1, const T2& a2, const T3& a3, const T4& a4, const T5& a5, const T6& a6, const T7& a7, const T8& a8)
{
try
{
BeginMessage(pszCommand);
vSend << a1 << a2 << a3 << a4 << a5 << a6 << a7 << a8;
EndMessage();
}
catch (...)
{
AbortMessage();
throw;
}
}
template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9>
void PushMessage(const char* pszCommand, const T1& a1, const T2& a2, const T3& a3, const T4& a4, const T5& a5, const T6& a6, const T7& a7, const T8& a8, const T9& a9)
{
try
{
BeginMessage(pszCommand);
vSend << a1 << a2 << a3 << a4 << a5 << a6 << a7 << a8 << a9;
EndMessage();
}
catch (...)
{
AbortMessage();
throw;
}
}
void PushRequest(const char* pszCommand,
void (*fn)(void*, CDataStream&), void* param1)
@@ -748,10 +934,12 @@ public:
void PushGetBlocks(CBlockIndex* pindexBegin, uint256 hashEnd);
bool IsSubscribed(unsigned int nChannel);
void Subscribe(unsigned int nChannel, unsigned int nHops=0);
void CancelSubscribe(unsigned int nChannel);
void Disconnect();
void CloseSocketDisconnect();
void Cleanup();
};

View File

@@ -1,76 +0,0 @@
BitCoin v0.1.5 ALPHA
Copyright (c) 2009 Satoshi Nakamoto
Distributed under the MIT/X11 software license, see the accompanying
file license.txt or http://www.opensource.org/licenses/mit-license.php.
This product includes software developed by the OpenSSL Project for use in
the OpenSSL Toolkit (http://www.openssl.org/). This product includes
cryptographic software written by Eric Young (eay@cryptsoft.com).
Compilers Supported
-------------------
MinGW GCC (v3.4.5)
Microsoft Visual C++ 6.0 SP6
Dependencies
------------
Libraries you need to obtain separately to build:
default path download
wxWidgets \wxWidgets http://www.wxwidgets.org/downloads/
OpenSSL \OpenSSL http://www.openssl.org/source/
Berkeley DB \DB http://www.oracle.com/technology/software/products/berkeley-db/index.html
Boost \Boost http://www.boost.org/users/download/
Their licenses:
wxWidgets LGPL 2.1 with very liberal exceptions
OpenSSL Old BSD license with the problematic advertising requirement
Berkeley DB New BSD license with additional requirement that linked software must be free open source
Boost MIT-like license
OpenSSL
-------
Bitcoin does not use any encryption. If you want to do a no-everything
build of OpenSSL to exclude encryption routines, a few patches are required.
(OpenSSL v0.9.8h)
Edit engines\e_gmp.c and put this #ifndef around #include <openssl/rsa.h>
#ifndef OPENSSL_NO_RSA
#include <openssl/rsa.h>
#endif
Add this to crypto\err\err_all.c before the ERR_load_crypto_strings line:
void ERR_load_RSA_strings(void) { }
Edit ms\mingw32.bat and replace the Configure line's parameters with this
no-everything list. You have to put this in the batch file because batch
files can't handle more than 9 parameters.
perl Configure mingw threads no-rc2 no-rc4 no-rc5 no-idea no-des no-bf no-cast no-aes no-camellia no-seed no-rsa no-dh
Also REM out the following line in ms\mingw32.bat. The build fails after it's
already finished building libeay32, which is all we care about, but the
failure aborts the script before it runs dllwrap to generate libeay32.dll.
REM if errorlevel 1 goto end
Build
ms\mingw32.bat
If you want to use it with MSVC, generate the .lib file
lib /machine:i386 /def:ms\libeay32.def /out:out\libeay32.lib
Berkeley DB
-----------
MinGW with MSYS:
cd \DB\build_unix
sh ../dist/configure --enable-mingw --enable-cxx
make
Boost
-----
You may need Boost version 1.35 to build with MSVC 6.0. I couldn't get
version 1.37 to compile with MSVC 6.0.

984
rpc.cpp Normal file
View File

@@ -0,0 +1,984 @@
// Copyright (c) 2010 Satoshi Nakamoto
// Distributed under the MIT/X11 software license, see the accompanying
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
#include "headers.h"
#undef printf
#include <boost/asio.hpp>
#include "json/json_spirit_reader_template.h"
#include "json/json_spirit_writer_template.h"
#include "json/json_spirit_utils.h"
#define printf OutputDebugStringF
// MinGW 3.4.5 gets "fatal error: had to relocate PCH" if the json headers are
// precompiled in headers.h. The problem might be when the pch file goes over
// a certain size around 145MB. If we need access to json_spirit outside this
// file, we could use the compiled json_spirit option.
using boost::asio::ip::tcp;
using namespace json_spirit;
void ThreadRPCServer2(void* parg);
typedef Value(*rpcfn_type)(const Array& params, bool fHelp);
extern map<string, rpcfn_type> mapCallTable;
///
/// Note: This interface may still be subject to change.
///
Value help(const Array& params, bool fHelp)
{
if (fHelp || params.size() != 0)
throw runtime_error(
"help\n"
"List commands.");
string strRet;
for (map<string, rpcfn_type>::iterator mi = mapCallTable.begin(); mi != mapCallTable.end(); ++mi)
{
try
{
Array params;
(*(*mi).second)(params, true);
}
catch (std::exception& e)
{
// Help text is returned in an exception
string strHelp = string(e.what());
if (strHelp.find('\n') != -1)
strHelp = strHelp.substr(0, strHelp.find('\n'));
strRet += strHelp + "\n";
}
}
strRet = strRet.substr(0,strRet.size()-1);
return strRet;
}
Value stop(const Array& params, bool fHelp)
{
if (fHelp || params.size() != 0)
throw runtime_error(
"stop\n"
"Stop bitcoin server.");
// Shutdown will take long enough that the response should get back
CreateThread(Shutdown, NULL);
return "bitcoin server stopping";
}
Value getblockcount(const Array& params, bool fHelp)
{
if (fHelp || params.size() != 0)
throw runtime_error(
"getblockcount\n"
"Returns the number of blocks in the longest block chain.");
return nBestHeight + 1;
}
Value getblocknumber(const Array& params, bool fHelp)
{
if (fHelp || params.size() != 0)
throw runtime_error(
"getblocknumber\n"
"Returns the block number of the latest block in the longest block chain.");
return nBestHeight;
}
Value getconnectioncount(const Array& params, bool fHelp)
{
if (fHelp || params.size() != 0)
throw runtime_error(
"getconnectioncount\n"
"Returns the number of connections to other nodes.");
return (int)vNodes.size();
}
double GetDifficulty()
{
// Floating point number that is a multiple of the minimum difficulty,
// minimum difficulty = 1.0.
if (pindexBest == NULL)
return 1.0;
int nShift = 256 - 32 - 31; // to fit in a uint
double dMinimum = (CBigNum().SetCompact(bnProofOfWorkLimit.GetCompact()) >> nShift).getuint();
double dCurrently = (CBigNum().SetCompact(pindexBest->nBits) >> nShift).getuint();
return dMinimum / dCurrently;
}
Value getdifficulty(const Array& params, bool fHelp)
{
if (fHelp || params.size() != 0)
throw runtime_error(
"getdifficulty\n"
"Returns the proof-of-work difficulty as a multiple of the minimum difficulty.");
return GetDifficulty();
}
Value getbalance(const Array& params, bool fHelp)
{
if (fHelp || params.size() != 0)
throw runtime_error(
"getbalance\n"
"Returns the server's available balance.");
return ((double)GetBalance() / (double)COIN);
}
Value getgenerate(const Array& params, bool fHelp)
{
if (fHelp || params.size() != 0)
throw runtime_error(
"getgenerate\n"
"Returns true or false.");
return (bool)fGenerateBitcoins;
}
Value setgenerate(const Array& params, bool fHelp)
{
if (fHelp || params.size() < 1 || params.size() > 2)
throw runtime_error(
"setgenerate <generate> [genproclimit]\n"
"<generate> is true or false to turn generation on or off.\n"
"Generation is limited to [genproclimit] processors, -1 is unlimited.");
bool fGenerate = true;
if (params.size() > 0)
fGenerate = params[0].get_bool();
if (params.size() > 1)
{
int nGenProcLimit = params[1].get_int();
fLimitProcessors = (nGenProcLimit != -1);
CWalletDB().WriteSetting("fLimitProcessors", fLimitProcessors);
if (nGenProcLimit != -1)
CWalletDB().WriteSetting("nLimitProcessors", nLimitProcessors = nGenProcLimit);
}
GenerateBitcoins(fGenerate);
return Value::null;
}
Value getinfo(const Array& params, bool fHelp)
{
if (fHelp || params.size() != 0)
throw runtime_error(
"getinfo");
Object obj;
obj.push_back(Pair("balance", (double)GetBalance() / (double)COIN));
obj.push_back(Pair("blocks", (int)nBestHeight + 1));
obj.push_back(Pair("connections", (int)vNodes.size()));
obj.push_back(Pair("proxy", (fUseProxy ? addrProxy.ToStringIPPort() : string())));
obj.push_back(Pair("generate", (bool)fGenerateBitcoins));
obj.push_back(Pair("genproclimit", (int)(fLimitProcessors ? nLimitProcessors : -1)));
obj.push_back(Pair("difficulty", (double)GetDifficulty()));
return obj;
}
Value getnewaddress(const Array& params, bool fHelp)
{
if (fHelp || params.size() > 1)
throw runtime_error(
"getnewaddress [label]\n"
"Returns a new bitcoin address for receiving payments. "
"If [label] is specified (recommended), it is added to the address book "
"so payments received with the address will be labeled.");
// Parse the label first so we don't generate a key if there's an error
string strLabel;
if (params.size() > 0)
strLabel = params[0].get_str();
// Generate a new key that is added to wallet
string strAddress = PubKeyToAddress(GenerateNewKey());
SetAddressBookName(strAddress, strLabel);
return strAddress;
}
Value setlabel(const Array& params, bool fHelp)
{
if (fHelp || params.size() < 1 || params.size() > 2)
throw runtime_error(
"setlabel <bitcoinaddress> <label>\n"
"Sets the label associated with the given address.");
string strAddress = params[0].get_str();
string strLabel;
if (params.size() > 1)
strLabel = params[1].get_str();
SetAddressBookName(strAddress, strLabel);
return Value::null;
}
Value getlabel(const Array& params, bool fHelp)
{
if (fHelp || params.size() != 1)
throw runtime_error(
"getlabel <bitcoinaddress>\n"
"Returns the label associated with the given address.");
string strAddress = params[0].get_str();
string strLabel;
CRITICAL_BLOCK(cs_mapAddressBook)
{
map<string, string>::iterator mi = mapAddressBook.find(strAddress);
if (mi != mapAddressBook.end() && !(*mi).second.empty())
strLabel = (*mi).second;
}
return strLabel;
}
Value getaddressesbylabel(const Array& params, bool fHelp)
{
if (fHelp || params.size() != 1)
throw runtime_error(
"getaddressesbylabel <label>\n"
"Returns the list of addresses with the given label.");
string strLabel = params[0].get_str();
// Find all addresses that have the given label
Array ret;
CRITICAL_BLOCK(cs_mapAddressBook)
{
foreach(const PAIRTYPE(string, string)& item, mapAddressBook)
{
const string& strAddress = item.first;
const string& strName = item.second;
if (strName == strLabel)
{
// We're only adding valid bitcoin addresses and not ip addresses
CScript scriptPubKey;
if (scriptPubKey.SetBitcoinAddress(strAddress))
ret.push_back(strAddress);
}
}
}
return ret;
}
Value sendtoaddress(const Array& params, bool fHelp)
{
if (fHelp || params.size() < 2 || params.size() > 4)
throw runtime_error(
"sendtoaddress <bitcoinaddress> <amount> [comment] [comment-to]\n"
"<amount> is a real and is rounded to the nearest 0.01");
string strAddress = params[0].get_str();
// Amount
if (params[1].get_real() <= 0.0 || params[1].get_real() > 21000000.0)
throw runtime_error("Invalid amount");
int64 nAmount = roundint64(params[1].get_real() * 100.00) * CENT;
// Wallet comments
CWalletTx wtx;
if (params.size() > 2 && params[2].type() != null_type && !params[2].get_str().empty())
wtx.mapValue["message"] = params[2].get_str();
if (params.size() > 3 && params[3].type() != null_type && !params[3].get_str().empty())
wtx.mapValue["to"] = params[3].get_str();
string strError = SendMoneyToBitcoinAddress(strAddress, nAmount, wtx);
if (strError != "")
throw runtime_error(strError);
return "sent";
}
Value listtransactions(const Array& params, bool fHelp)
{
if (fHelp || params.size() > 2)
throw runtime_error(
"listtransactions [count=10] [includegenerated=false]\n"
"Returns up to [count] most recent transactions.");
int64 nCount = 10;
if (params.size() > 0)
nCount = params[0].get_int64();
bool fGenerated = false;
if (params.size() > 1)
fGenerated = params[1].get_bool();
Array ret;
//// not finished
ret.push_back("not implemented yet");
return ret;
}
Value getreceivedbyaddress(const Array& params, bool fHelp)
{
if (fHelp || params.size() < 1 || params.size() > 2)
throw runtime_error(
"getreceivedbyaddress <bitcoinaddress> [minconf=1]\n"
"Returns the total amount received by <bitcoinaddress> in transactions with at least [minconf] confirmations.");
// Bitcoin address
string strAddress = params[0].get_str();
CScript scriptPubKey;
if (!scriptPubKey.SetBitcoinAddress(strAddress))
throw runtime_error("Invalid bitcoin address");
if (!IsMine(scriptPubKey))
return (double)0.0;
// Minimum confirmations
int nMinDepth = 1;
if (params.size() > 1)
nMinDepth = params[1].get_int();
// Tally
int64 nAmount = 0;
CRITICAL_BLOCK(cs_mapWallet)
{
for (map<uint256, CWalletTx>::iterator it = mapWallet.begin(); it != mapWallet.end(); ++it)
{
const CWalletTx& wtx = (*it).second;
if (wtx.IsCoinBase() || !wtx.IsFinal())
continue;
foreach(const CTxOut& txout, wtx.vout)
if (txout.scriptPubKey == scriptPubKey)
if (wtx.GetDepthInMainChain() >= nMinDepth)
nAmount += txout.nValue;
}
}
return (double)nAmount / (double)COIN;
}
Value getreceivedbylabel(const Array& params, bool fHelp)
{
if (fHelp || params.size() < 1 || params.size() > 2)
throw runtime_error(
"getreceivedbylabel <label> [minconf=1]\n"
"Returns the total amount received by addresses with <label> in transactions with at least [minconf] confirmations.");
// Get the set of pub keys that have the label
string strLabel = params[0].get_str();
set<CScript> setPubKey;
CRITICAL_BLOCK(cs_mapAddressBook)
{
foreach(const PAIRTYPE(string, string)& item, mapAddressBook)
{
const string& strAddress = item.first;
const string& strName = item.second;
if (strName == strLabel)
{
// We're only counting our own valid bitcoin addresses and not ip addresses
CScript scriptPubKey;
if (scriptPubKey.SetBitcoinAddress(strAddress))
if (IsMine(scriptPubKey))
setPubKey.insert(scriptPubKey);
}
}
}
// Minimum confirmations
int nMinDepth = 1;
if (params.size() > 1)
nMinDepth = params[1].get_int();
// Tally
int64 nAmount = 0;
CRITICAL_BLOCK(cs_mapWallet)
{
for (map<uint256, CWalletTx>::iterator it = mapWallet.begin(); it != mapWallet.end(); ++it)
{
const CWalletTx& wtx = (*it).second;
if (wtx.IsCoinBase() || !wtx.IsFinal())
continue;
foreach(const CTxOut& txout, wtx.vout)
if (setPubKey.count(txout.scriptPubKey))
if (wtx.GetDepthInMainChain() >= nMinDepth)
nAmount += txout.nValue;
}
}
return (double)nAmount / (double)COIN;
}
struct tallyitem
{
int64 nAmount;
int nConf;
tallyitem()
{
nAmount = 0;
nConf = INT_MAX;
}
};
Value ListReceived(const Array& params, bool fByLabels)
{
// Minimum confirmations
int nMinDepth = 1;
if (params.size() > 0)
nMinDepth = params[0].get_int();
// Whether to include empty accounts
bool fIncludeEmpty = false;
if (params.size() > 1)
fIncludeEmpty = params[1].get_bool();
// Tally
map<uint160, tallyitem> mapTally;
CRITICAL_BLOCK(cs_mapWallet)
{
for (map<uint256, CWalletTx>::iterator it = mapWallet.begin(); it != mapWallet.end(); ++it)
{
const CWalletTx& wtx = (*it).second;
if (wtx.IsCoinBase() || !wtx.IsFinal())
continue;
int nDepth = wtx.GetDepthInMainChain();
if (nDepth < nMinDepth)
continue;
foreach(const CTxOut& txout, wtx.vout)
{
// Only counting our own bitcoin addresses and not ip addresses
uint160 hash160 = txout.scriptPubKey.GetBitcoinAddressHash160();
if (hash160 == 0 || !mapPubKeys.count(hash160)) // IsMine
continue;
tallyitem& item = mapTally[hash160];
item.nAmount += txout.nValue;
item.nConf = min(item.nConf, nDepth);
}
}
}
// Reply
Array ret;
map<string, tallyitem> mapLabelTally;
CRITICAL_BLOCK(cs_mapAddressBook)
{
foreach(const PAIRTYPE(string, string)& item, mapAddressBook)
{
const string& strAddress = item.first;
const string& strLabel = item.second;
uint160 hash160;
if (!AddressToHash160(strAddress, hash160))
continue;
map<uint160, tallyitem>::iterator it = mapTally.find(hash160);
if (it == mapTally.end() && !fIncludeEmpty)
continue;
int64 nAmount = 0;
int nConf = INT_MAX;
if (it != mapTally.end())
{
nAmount = (*it).second.nAmount;
nConf = (*it).second.nConf;
}
if (fByLabels)
{
tallyitem& item = mapLabelTally[strLabel];
item.nAmount += nAmount;
item.nConf = min(item.nConf, nConf);
}
else
{
Object obj;
obj.push_back(Pair("address", strAddress));
obj.push_back(Pair("label", strLabel));
obj.push_back(Pair("amount", (double)nAmount / (double)COIN));
obj.push_back(Pair("confirmations", (nConf == INT_MAX ? 0 : nConf)));
ret.push_back(obj);
}
}
}
if (fByLabels)
{
for (map<string, tallyitem>::iterator it = mapLabelTally.begin(); it != mapLabelTally.end(); ++it)
{
int64 nAmount = (*it).second.nAmount;
int nConf = (*it).second.nConf;
Object obj;
obj.push_back(Pair("label", (*it).first));
obj.push_back(Pair("amount", (double)nAmount / (double)COIN));
obj.push_back(Pair("confirmations", (nConf == INT_MAX ? 0 : nConf)));
ret.push_back(obj);
}
}
return ret;
}
Value listreceivedbyaddress(const Array& params, bool fHelp)
{
if (fHelp || params.size() > 2)
throw runtime_error(
"listreceivedbyaddress [minconf=1] [includeempty=false]\n"
"[minconf] is the minimum number of confirmations before payments are included.\n"
"[includeempty] whether to include addresses that haven't received any payments.\n"
"Returns an array of objects containing:\n"
" \"address\" : receiving address\n"
" \"label\" : the label of the receiving address\n"
" \"amount\" : total amount received by the address\n"
" \"confirmations\" : number of confirmations of the most recent transaction included");
return ListReceived(params, false);
}
Value listreceivedbylabel(const Array& params, bool fHelp)
{
if (fHelp || params.size() > 2)
throw runtime_error(
"listreceivedbylabel [minconf=1] [includeempty=false]\n"
"[minconf] is the minimum number of confirmations before payments are included.\n"
"[includeempty] whether to include labels that haven't received any payments.\n"
"Returns an array of objects containing:\n"
" \"label\" : the label of the receiving addresses\n"
" \"amount\" : total amount received by addresses with this label\n"
" \"confirmations\" : number of confirmations of the most recent transaction included");
return ListReceived(params, true);
}
//
// Call Table
//
pair<string, rpcfn_type> pCallTable[] =
{
make_pair("help", &help),
make_pair("stop", &stop),
make_pair("getblockcount", &getblockcount),
make_pair("getblocknumber", &getblocknumber),
make_pair("getconnectioncount", &getconnectioncount),
make_pair("getdifficulty", &getdifficulty),
make_pair("getbalance", &getbalance),
make_pair("getgenerate", &getgenerate),
make_pair("setgenerate", &setgenerate),
make_pair("getinfo", &getinfo),
make_pair("getnewaddress", &getnewaddress),
make_pair("setlabel", &setlabel),
make_pair("getlabel", &getlabel),
make_pair("getaddressesbylabel", &getaddressesbylabel),
make_pair("sendtoaddress", &sendtoaddress),
make_pair("listtransactions", &listtransactions),
make_pair("getamountreceived", &getreceivedbyaddress), // deprecated, renamed to getreceivedbyaddress
make_pair("getallreceived", &listreceivedbyaddress), // deprecated, renamed to listreceivedbyaddress
make_pair("getreceivedbyaddress", &getreceivedbyaddress),
make_pair("getreceivedbylabel", &getreceivedbylabel),
make_pair("listreceivedbyaddress", &listreceivedbyaddress),
make_pair("listreceivedbylabel", &listreceivedbylabel),
};
map<string, rpcfn_type> mapCallTable(pCallTable, pCallTable + sizeof(pCallTable)/sizeof(pCallTable[0]));
//
// HTTP protocol
//
// This ain't Apache. We're just using HTTP header for the length field
// and to be compatible with other JSON-RPC implementations.
//
string HTTPPost(const string& strMsg)
{
return strprintf(
"POST / HTTP/1.1\r\n"
"User-Agent: json-rpc/1.0\r\n"
"Host: 127.0.0.1\r\n"
"Content-Type: application/json\r\n"
"Content-Length: %d\r\n"
"Accept: application/json\r\n"
"\r\n"
"%s",
strMsg.size(),
strMsg.c_str());
}
string HTTPReply(const string& strMsg, int nStatus=200)
{
string strStatus;
if (nStatus == 200) strStatus = "OK";
if (nStatus == 500) strStatus = "Internal Server Error";
return strprintf(
"HTTP/1.1 %d %s\r\n"
"Connection: close\r\n"
"Content-Length: %d\r\n"
"Content-Type: application/json\r\n"
"Date: Sat, 08 Jul 2006 12:04:08 GMT\r\n"
"Server: json-rpc/1.0\r\n"
"\r\n"
"%s",
nStatus,
strStatus.c_str(),
strMsg.size(),
strMsg.c_str());
}
int ReadHTTPHeader(tcp::iostream& stream)
{
int nLen = 0;
loop
{
string str;
std::getline(stream, str);
if (str.empty() || str == "\r")
break;
if (str.substr(0,15) == "Content-Length:")
nLen = atoi(str.substr(15));
}
return nLen;
}
inline string ReadHTTP(tcp::iostream& stream)
{
// Read header
int nLen = ReadHTTPHeader(stream);
if (nLen <= 0)
return string();
// Read message
vector<char> vch(nLen);
stream.read(&vch[0], nLen);
return string(vch.begin(), vch.end());
}
//
// JSON-RPC protocol
//
// http://json-rpc.org/wiki/specification
// http://www.codeproject.com/KB/recipes/JSON_Spirit.aspx
//
string JSONRPCRequest(const string& strMethod, const Array& params, const Value& id)
{
Object request;
request.push_back(Pair("method", strMethod));
request.push_back(Pair("params", params));
request.push_back(Pair("id", id));
return write_string(Value(request), false) + "\n";
}
string JSONRPCReply(const Value& result, const Value& error, const Value& id)
{
Object reply;
if (error.type() != null_type)
reply.push_back(Pair("result", Value::null));
else
reply.push_back(Pair("result", result));
reply.push_back(Pair("error", error));
reply.push_back(Pair("id", id));
return write_string(Value(reply), false) + "\n";
}
void ThreadRPCServer(void* parg)
{
IMPLEMENT_RANDOMIZE_STACK(ThreadRPCServer(parg));
try
{
vnThreadsRunning[4]++;
ThreadRPCServer2(parg);
vnThreadsRunning[4]--;
}
catch (std::exception& e) {
vnThreadsRunning[4]--;
PrintException(&e, "ThreadRPCServer()");
} catch (...) {
vnThreadsRunning[4]--;
PrintException(NULL, "ThreadRPCServer()");
}
printf("ThreadRPCServer exiting\n");
}
void ThreadRPCServer2(void* parg)
{
printf("ThreadRPCServer started\n");
// Bind to loopback 127.0.0.1 so the socket can only be accessed locally
boost::asio::io_service io_service;
tcp::endpoint endpoint(boost::asio::ip::address_v4::loopback(), 8332);
tcp::acceptor acceptor(io_service, endpoint);
loop
{
// Accept connection
tcp::iostream stream;
tcp::endpoint peer;
vnThreadsRunning[4]--;
acceptor.accept(*stream.rdbuf(), peer);
vnThreadsRunning[4]++;
if (fShutdown)
return;
// Shouldn't be possible for anyone else to connect, but just in case
if (peer.address().to_string() != "127.0.0.1")
continue;
// Receive request
string strRequest = ReadHTTP(stream);
printf("ThreadRPCServer request=%s", strRequest.c_str());
// Handle multiple invocations per request
string::iterator begin = strRequest.begin();
while (skipspaces(begin), begin != strRequest.end())
{
string::iterator prev = begin;
Value id;
try
{
// Parse request
Value valRequest;
if (!read_range(begin, strRequest.end(), valRequest))
throw runtime_error("Parse error.");
const Object& request = valRequest.get_obj();
if (find_value(request, "method").type() != str_type ||
find_value(request, "params").type() != array_type)
throw runtime_error("Invalid request.");
string strMethod = find_value(request, "method").get_str();
const Array& params = find_value(request, "params").get_array();
id = find_value(request, "id");
// Execute
map<string, rpcfn_type>::iterator mi = mapCallTable.find(strMethod);
if (mi == mapCallTable.end())
throw runtime_error("Method not found.");
Value result = (*(*mi).second)(params, false);
// Send reply
string strReply = JSONRPCReply(result, Value::null, id);
stream << HTTPReply(strReply, 200) << std::flush;
}
catch (std::exception& e)
{
// Send error reply
string strReply = JSONRPCReply(Value::null, e.what(), id);
stream << HTTPReply(strReply, 500) << std::flush;
}
if (begin == prev)
break;
}
}
}
Value CallRPC(const string& strMethod, const Array& params)
{
// Connect to localhost
tcp::iostream stream("127.0.0.1", "8332");
if (stream.fail())
throw runtime_error("couldn't connect to server");
// Send request
string strRequest = JSONRPCRequest(strMethod, params, 1);
stream << HTTPPost(strRequest) << std::flush;
// Receive reply
string strReply = ReadHTTP(stream);
if (strReply.empty())
throw runtime_error("no response from server");
// Parse reply
Value valReply;
if (!read_string(strReply, valReply))
throw runtime_error("couldn't parse reply from server");
const Object& reply = valReply.get_obj();
if (reply.empty())
throw runtime_error("expected reply to have result, error and id properties");
const Value& result = find_value(reply, "result");
const Value& error = find_value(reply, "error");
const Value& id = find_value(reply, "id");
if (error.type() == str_type)
throw runtime_error(error.get_str());
else if (error.type() != null_type)
throw runtime_error(write_string(error, false));
return result;
}
template<typename T>
void ConvertTo(Value& value)
{
if (value.type() == str_type)
{
// reinterpret string as unquoted json value
Value value2;
if (!read_string(value.get_str(), value2))
throw runtime_error("type mismatch");
value = value2.get_value<T>();
}
else
{
value = value.get_value<T>();
}
}
int CommandLineRPC(int argc, char *argv[])
{
try
{
// Check that method exists
if (argc < 2)
throw runtime_error("too few parameters");
string strMethod = argv[1];
if (!mapCallTable.count(strMethod))
throw runtime_error(strprintf("unknown command: %s", strMethod.c_str()));
Value result;
if (argc == 3 && strcmp(argv[2], "-?") == 0)
{
// Call help locally, help text is returned in an exception
try
{
map<string, rpcfn_type>::iterator mi = mapCallTable.find(strMethod);
Array params;
(*(*mi).second)(params, true);
}
catch (std::exception& e)
{
result = e.what();
}
}
else
{
// Parameters default to strings
Array params;
for (int i = 2; i < argc; i++)
params.push_back(argv[i]);
int n = params.size();
//
// Special case non-string parameter types
//
if (strMethod == "setgenerate" && n > 0) ConvertTo<bool>(params[0]);
if (strMethod == "setgenerate" && n > 1) ConvertTo<boost::int64_t>(params[1]);
if (strMethod == "sendtoaddress" && n > 1) ConvertTo<double>(params[1]);
if (strMethod == "listtransactions" && n > 0) ConvertTo<boost::int64_t>(params[0]);
if (strMethod == "listtransactions" && n > 1) ConvertTo<bool>(params[1]);
if (strMethod == "getamountreceived" && n > 1) ConvertTo<boost::int64_t>(params[1]); // deprecated
if (strMethod == "getreceivedbyaddress" && n > 1) ConvertTo<boost::int64_t>(params[1]);
if (strMethod == "getreceivedbylabel" && n > 1) ConvertTo<boost::int64_t>(params[1]);
if (strMethod == "getallreceived" && n > 0) ConvertTo<boost::int64_t>(params[0]); // deprecated
if (strMethod == "getallreceived" && n > 1) ConvertTo<bool>(params[1]);
if (strMethod == "listreceivedbyaddress" && n > 0) ConvertTo<boost::int64_t>(params[0]);
if (strMethod == "listreceivedbyaddress" && n > 1) ConvertTo<bool>(params[1]);
if (strMethod == "listreceivedbylabel" && n > 0) ConvertTo<boost::int64_t>(params[0]);
if (strMethod == "listreceivedbylabel" && n > 1) ConvertTo<bool>(params[1]);
// Execute
result = CallRPC(strMethod, params);
}
// Print result
string strResult = (result.type() == str_type ? result.get_str() : write_string(result, true));
if (result.type() != null_type)
{
if (fWindows && fGUI)
// Windows GUI apps can't print to command line,
// so settle for a message box yuck
MyMessageBox(strResult.c_str(), "Bitcoin", wxOK);
else
fprintf(stdout, "%s\n", strResult.c_str());
}
return 0;
}
catch (std::exception& e) {
if (fWindows && fGUI)
MyMessageBox(strprintf("error: %s\n", e.what()).c_str(), "Bitcoin", wxOK);
else
fprintf(stderr, "error: %s\n", e.what());
} catch (...) {
PrintException(NULL, "CommandLineRPC()");
}
return 1;
}
#ifdef TEST
int main(int argc, char *argv[])
{
#ifdef _MSC_VER
// Turn off microsoft heap dump noise
_CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
_CrtSetReportFile(_CRT_WARN, CreateFile("NUL", GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, 0));
#endif
setbuf(stdin, NULL);
setbuf(stdout, NULL);
setbuf(stderr, NULL);
try
{
if (argc >= 2 && string(argv[1]) == "-server")
{
printf("server ready\n");
ThreadRPCServer(NULL);
}
else
{
return CommandLineRPC(argc, argv);
}
}
catch (std::exception& e) {
PrintException(&e, "main()");
} catch (...) {
PrintException(NULL, "main()");
}
return 0;
}
#endif

6
rpc.h Normal file
View File

@@ -0,0 +1,6 @@
// Copyright (c) 2010 Satoshi Nakamoto
// Distributed under the MIT/X11 software license, see the accompanying
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
void ThreadRPCServer(void* parg);
int CommandLineRPC(int argc, char *argv[]);

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2009 Satoshi Nakamoto
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Distributed under the MIT/X11 software license, see the accompanying
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
@@ -660,7 +660,7 @@ bool EvalScript(const CScript& script, const CTransaction& txTo, unsigned int nI
if (stack.size() < 1)
return false;
valtype& vch = stacktop(-1);
valtype vchHash(opcode == OP_RIPEMD160 || opcode == OP_SHA1 || opcode == OP_HASH160 ? 20 : 32);
valtype vchHash((opcode == OP_RIPEMD160 || opcode == OP_SHA1 || opcode == OP_HASH160) ? 20 : 32);
if (opcode == OP_RIPEMD160)
RIPEMD160(&vch[0], vch.size(), &vchHash[0]);
else if (opcode == OP_SHA1)
@@ -753,9 +753,9 @@ bool EvalScript(const CScript& script, const CTransaction& txTo, unsigned int nI
CScript scriptCode(pbegincodehash, pend);
// Drop the signatures, since there's no way for a signature to sign itself
for (int i = 0; i < nSigsCount; i++)
for (int k = 0; k < nSigsCount; k++)
{
valtype& vchSig = stacktop(-isig-i);
valtype& vchSig = stacktop(-isig-k);
scriptCode.FindAndDelete(CScript(vchSig));
}
@@ -909,7 +909,6 @@ bool CheckSig(vector<unsigned char> vchSig, vector<unsigned char> vchPubKey, CSc
bool Solver(const CScript& scriptPubKey, vector<pair<opcodetype, valtype> >& vSolutionRet)
{
// Templates
@@ -919,7 +918,7 @@ bool Solver(const CScript& scriptPubKey, vector<pair<opcodetype, valtype> >& vSo
// Standard tx, sender provides pubkey, receiver adds signature
vTemplates.push_back(CScript() << OP_PUBKEY << OP_CHECKSIG);
// Short account number tx, sender provides hash of pubkey, receiver provides signature and pubkey
// Bitcoin address tx, sender provides hash of pubkey, receiver provides signature and pubkey
vTemplates.push_back(CScript() << OP_DUP << OP_HASH160 << OP_PUBKEYHASH << OP_EQUALVERIFY << OP_CHECKSIG);
}
@@ -1123,5 +1122,13 @@ bool VerifySignature(const CTransaction& txFrom, const CTransaction& txTo, unsig
if (txin.prevout.hash != txFrom.GetHash())
return false;
return EvalScript(txin.scriptSig + CScript(OP_CODESEPARATOR) + txout.scriptPubKey, txTo, nIn, nHashType);
if (!EvalScript(txin.scriptSig + CScript(OP_CODESEPARATOR) + txout.scriptPubKey, txTo, nIn, nHashType))
return false;
// Anytime a signature is successfully verified, it's proof the outpoint is spent,
// so lets update the wallet spent flag if it doesn't know due to wallet.dat being
// restored from backup or the user making copies of wallet.dat.
WalletUpdateSpent(txin.prevout);
return true;
}

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2009 Satoshi Nakamoto
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Distributed under the MIT/X11 software license, see the accompanying
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
@@ -472,7 +472,7 @@ public:
bool GetOp(iterator& pc, opcodetype& opcodeRet, vector<unsigned char>& vchRet)
{
// This is why people hate C++
// Wrapper so it can be called with either iterator or const_iterator
const_iterator pc2 = pc;
bool fRet = GetOp(pc2, opcodeRet, vchRet);
pc = begin() + (pc2 - begin());
@@ -551,6 +551,51 @@ public:
}
uint160 GetBitcoinAddressHash160() const
{
opcodetype opcode;
vector<unsigned char> vch;
CScript::const_iterator pc = begin();
if (!GetOp(pc, opcode, vch) || opcode != OP_DUP) return 0;
if (!GetOp(pc, opcode, vch) || opcode != OP_HASH160) return 0;
if (!GetOp(pc, opcode, vch) || vch.size() != sizeof(uint160)) return 0;
uint160 hash160 = uint160(vch);
if (!GetOp(pc, opcode, vch) || opcode != OP_EQUALVERIFY) return 0;
if (!GetOp(pc, opcode, vch) || opcode != OP_CHECKSIG) return 0;
if (pc != end()) return 0;
return hash160;
}
string GetBitcoinAddress() const
{
uint160 hash160 = GetBitcoinAddressHash160();
if (hash160 == 0)
return "";
return Hash160ToAddress(hash160);
}
void SetBitcoinAddress(const uint160& hash160)
{
this->clear();
*this << OP_DUP << OP_HASH160 << hash160 << OP_EQUALVERIFY << OP_CHECKSIG;
}
void SetBitcoinAddress(const vector<unsigned char>& vchPubKey)
{
SetBitcoinAddress(Hash160(vchPubKey));
}
bool SetBitcoinAddress(const string& strAddress)
{
this->clear();
uint160 hash160;
if (!AddressToHash160(strAddress, hash160))
return false;
SetBitcoinAddress(hash160);
return true;
}
void PrintHex() const
{
printf("CScript(%s)\n", HexStr(begin(), end()).c_str());

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2009 Satoshi Nakamoto
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Distributed under the MIT/X11 software license, see the accompanying
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
@@ -19,7 +19,8 @@ class CScript;
class CDataStream;
class CAutoFile;
static const int VERSION = 105;
static const int VERSION = 210;
static const char* pszSubVer = ".0";
@@ -193,28 +194,32 @@ uint64 ReadCompactSize(Stream& is)
{
unsigned char chSize;
READDATA(is, chSize);
uint64 nSizeRet = 0;
if (chSize < UCHAR_MAX-2)
{
return chSize;
nSizeRet = chSize;
}
else if (chSize == UCHAR_MAX-2)
{
unsigned short nSize;
READDATA(is, nSize);
return nSize;
nSizeRet = nSize;
}
else if (chSize == UCHAR_MAX-1)
{
unsigned int nSize;
READDATA(is, nSize);
return nSize;
nSizeRet = nSize;
}
else
{
uint64 nSize;
READDATA(is, nSize);
return nSize;
nSizeRet = nSize;
}
if (nSizeRet > (uint64)INT_MAX)
throw std::ios_base::failure("ReadCompactSize() : size too large");
return nSizeRet;
}
@@ -459,7 +464,7 @@ void Unserialize_impl(Stream& is, std::vector<T, A>& v, int nType, int nVersion,
unsigned int i = 0;
while (i < nSize)
{
unsigned int blk = min(nSize - i, 1 + 4999999 / sizeof(T));
unsigned int blk = min(nSize - i, (unsigned int)(1 + 4999999 / sizeof(T)));
v.resize(i + blk);
is.read((char*)&v[i], blk * sizeof(T));
i += blk;
@@ -804,6 +809,18 @@ public:
vch.insert(it, first, last);
}
void insert(iterator it, vector<char>::const_iterator first, vector<char>::const_iterator last)
{
if (it == vch.begin() + nReadPos && last - first <= nReadPos)
{
// special case for inserting at the front when there's room
nReadPos -= (last - first);
memcpy(&vch[nReadPos], &first[0], last - first);
}
else
vch.insert(it, first, last);
}
#if !defined(_MSC_VER) || _MSC_VER >= 1300
void insert(iterator it, const char* first, const char* last)
{

150
setup.nsi Normal file
View File

@@ -0,0 +1,150 @@
# Auto-generated by EclipseNSIS Script Wizard
# 3.10.2009 19:00:28
Name Bitcoin
RequestExecutionLevel highest
# General Symbol Definitions
!define REGKEY "SOFTWARE\$(^Name)"
!define VERSION 0.2.0
!define COMPANY "Bitcoin project"
!define URL http://www.bitcoin.org/
# MUI Symbol Definitions
!define MUI_ICON "src\rc\bitcoin.ico"
!define MUI_FINISHPAGE_NOAUTOCLOSE
!define MUI_STARTMENUPAGE_REGISTRY_ROOT HKLM
!define MUI_STARTMENUPAGE_REGISTRY_KEY ${REGKEY}
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME StartMenuGroup
!define MUI_STARTMENUPAGE_DEFAULTFOLDER Bitcoin
!define MUI_FINISHPAGE_RUN $INSTDIR\bitcoin.exe
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"
!define MUI_UNFINISHPAGE_NOAUTOCLOSE
# Included files
!include Sections.nsh
!include MUI2.nsh
# Variables
Var StartMenuGroup
# Installer pages
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_STARTMENU Application $StartMenuGroup
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
# Installer languages
!insertmacro MUI_LANGUAGE English
# Installer attributes
OutFile bitcoin-0.2.0-win32-setup.exe
InstallDir $PROGRAMFILES\Bitcoin
CRCCheck on
XPStyle on
ShowInstDetails show
VIProductVersion 0.2.0.0
VIAddVersionKey ProductName Bitcoin
VIAddVersionKey ProductVersion "${VERSION}"
VIAddVersionKey CompanyName "${COMPANY}"
VIAddVersionKey CompanyWebsite "${URL}"
VIAddVersionKey FileVersion "${VERSION}"
VIAddVersionKey FileDescription ""
VIAddVersionKey LegalCopyright ""
InstallDirRegKey HKCU "${REGKEY}" Path
ShowUninstDetails show
# Installer sections
Section -Main SEC0000
SetOutPath $INSTDIR
SetOverwrite on
File bitcoin.exe
File libeay32.dll
File mingwm10.dll
File license.txt
File readme.txt
SetOutPath $INSTDIR\src
File /r src\*.*
SetOutPath $INSTDIR
WriteRegStr HKCU "${REGKEY}\Components" Main 1
SectionEnd
Section -post SEC0001
WriteRegStr HKCU "${REGKEY}" Path $INSTDIR
SetOutPath $INSTDIR
WriteUninstaller $INSTDIR\uninstall.exe
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
CreateDirectory $SMPROGRAMS\$StartMenuGroup
CreateShortcut "$SMPROGRAMS\$StartMenuGroup\Bitcoin.lnk" $INSTDIR\bitcoin.exe
CreateShortcut "$SMPROGRAMS\$StartMenuGroup\Uninstall Bitcoin.lnk" $INSTDIR\uninstall.exe
!insertmacro MUI_STARTMENU_WRITE_END
WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayName "$(^Name)"
WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayVersion "${VERSION}"
WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" Publisher "${COMPANY}"
WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" URLInfoAbout "${URL}"
WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayIcon $INSTDIR\uninstall.exe
WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" UninstallString $INSTDIR\uninstall.exe
WriteRegDWORD HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" NoModify 1
WriteRegDWORD HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" NoRepair 1
SectionEnd
# Macro for selecting uninstaller sections
!macro SELECT_UNSECTION SECTION_NAME UNSECTION_ID
Push $R0
ReadRegStr $R0 HKCU "${REGKEY}\Components" "${SECTION_NAME}"
StrCmp $R0 1 0 next${UNSECTION_ID}
!insertmacro SelectSection "${UNSECTION_ID}"
GoTo done${UNSECTION_ID}
next${UNSECTION_ID}:
!insertmacro UnselectSection "${UNSECTION_ID}"
done${UNSECTION_ID}:
Pop $R0
!macroend
# Uninstaller sections
Section /o -un.Main UNSEC0000
Delete /REBOOTOK $INSTDIR\bitcoin.exe
Delete /REBOOTOK $INSTDIR\libeay32.dll
Delete /REBOOTOK $INSTDIR\mingwm10.dll
Delete /REBOOTOK $INSTDIR\license.txt
Delete /REBOOTOK $INSTDIR\readme.txt
RMDir /r /REBOOTOK $INSTDIR\src
DeleteRegValue HKCU "${REGKEY}\Components" Main
SectionEnd
Section -un.post UNSEC0001
DeleteRegKey HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)"
Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\Uninstall Bitcoin.lnk"
Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\Bitcoin.lnk"
Delete /REBOOTOK "$SMSTARTUP\Bitcoin.lnk"
Delete /REBOOTOK $INSTDIR\uninstall.exe
Delete /REBOOTOK $INSTDIR\debug.log
Delete /REBOOTOK $INSTDIR\db.log
DeleteRegValue HKCU "${REGKEY}" StartMenuGroup
DeleteRegValue HKCU "${REGKEY}" Path
DeleteRegKey /IfEmpty HKCU "${REGKEY}\Components"
DeleteRegKey /IfEmpty HKCU "${REGKEY}"
RmDir /REBOOTOK $SMPROGRAMS\$StartMenuGroup
RmDir /REBOOTOK $INSTDIR
Push $R0
StrCpy $R0 $StartMenuGroup 1
StrCmp $R0 ">" no_smgroup
no_smgroup:
Pop $R0
SectionEnd
# Installer functions
Function .onInit
InitPluginsDir
FunctionEnd
# Uninstaller functions
Function un.onInit
ReadRegStr $INSTDIR HKCU "${REGKEY}" Path
!insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuGroup
!insertmacro SELECT_UNSECTION Main ${UNSEC0000}
FunctionEnd

84
strlcpy.h Normal file
View File

@@ -0,0 +1,84 @@
/*
* Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/*
* Copy src to string dst of size siz. At most siz-1 characters
* will be copied. Always NUL terminates (unless siz == 0).
* Returns strlen(src); if retval >= siz, truncation occurred.
*/
inline size_t strlcpy(char *dst, const char *src, size_t siz)
{
char *d = dst;
const char *s = src;
size_t n = siz;
/* Copy as many bytes as will fit */
if (n != 0)
{
while (--n != 0)
{
if ((*d++ = *s++) == '\0')
break;
}
}
/* Not enough room in dst, add NUL and traverse rest of src */
if (n == 0)
{
if (siz != 0)
*d = '\0'; /* NUL-terminate dst */
while (*s++)
;
}
return(s - src - 1); /* count does not include NUL */
}
/*
* Appends src to string dst of size siz (unlike strncat, siz is the
* full size of dst, not space left). At most siz-1 characters
* will be copied. Always NUL terminates (unless siz <= strlen(dst)).
* Returns strlen(src) + MIN(siz, strlen(initial dst)).
* If retval >= siz, truncation occurred.
*/
inline size_t strlcat(char *dst, const char *src, size_t siz)
{
char *d = dst;
const char *s = src;
size_t n = siz;
size_t dlen;
/* Find the end of dst and adjust bytes left but don't go past end */
while (n-- != 0 && *d != '\0')
d++;
dlen = d - dst;
n = siz - dlen;
if (n == 0)
return(dlen + strlen(s));
while (*s != '\0')
{
if (n != 1)
{
*d++ = *s;
n--;
}
s++;
}
*d = '\0';
return(dlen + (s - src)); /* count does not include NUL */
}

3275
ui.cpp

File diff suppressed because it is too large Load Diff

339
ui.h
View File

@@ -1,33 +1,70 @@
// Copyright (c) 2009 Satoshi Nakamoto
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Distributed under the MIT/X11 software license, see the accompanying
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
DECLARE_EVENT_TYPE(wxEVT_UITHREADCALL, -1)
#if wxUSE_GUI
static const bool fGUI=true;
#else
static const bool fGUI=false;
#endif
DECLARE_EVENT_TYPE(wxEVT_CROSSTHREADCALL, -1)
DECLARE_EVENT_TYPE(wxEVT_REPLY1, -1)
DECLARE_EVENT_TYPE(wxEVT_REPLY2, -1)
DECLARE_EVENT_TYPE(wxEVT_REPLY3, -1)
DECLARE_EVENT_TYPE(wxEVT_TABLEADDED, -1)
DECLARE_EVENT_TYPE(wxEVT_TABLEUPDATED, -1)
DECLARE_EVENT_TYPE(wxEVT_TABLEDELETED, -1)
enum
inline int MyMessageBox(const wxString& message, const wxString& caption="Message", int style=wxOK, wxWindow* parent=NULL, int x=-1, int y=-1)
{
UICALL_ADDORDER = 1,
UICALL_UPDATEORDER,
};
#if wxUSE_GUI
if (!fDaemon)
return wxMessageBox(message, caption, style, parent, x, y);
#endif
printf("wxMessageBox %s: %s\n", string(caption).c_str(), string(message).c_str());
fprintf(stderr, "%s: %s\n", string(caption).c_str(), string(message).c_str());
return wxOK;
}
#define wxMessageBox MyMessageBox
extern void HandleCtrlA(wxKeyEvent& event);
extern string DateTimeStr(int64 nTime);
extern string FormatTxStatus(const CWalletTx& wtx);
extern void CrossThreadCall(int nID, void* pdata);
extern void MainFrameRepaint();
extern void Shutdown(void* parg);
void HandleCtrlA(wxKeyEvent& event);
string FormatTxStatus(const CWalletTx& wtx);
void UIThreadCall(boost::function0<void>);
int ThreadSafeMessageBox(const string& message, const string& caption="Message", int style=wxOK, wxWindow* parent=NULL, int x=-1, int y=-1);
bool ThreadSafeAskFee(int64 nFeeRequired, const string& strCaption, wxWindow* parent);
void CalledSetStatusBar(const string& strText, int nField);
void MainFrameRepaint();
void CreateMainWindow();
#if !wxUSE_GUI
inline int ThreadSafeMessageBox(const string& message, const string& caption, int style, wxWindow* parent, int x, int y)
{
return MyMessageBox(message, caption, style, parent, x, y);
}
inline bool ThreadSafeAskFee(int64 nFeeRequired, const string& strCaption, wxWindow* parent)
{
return true;
}
inline void CalledSetStatusBar(const string& strText, int nField)
{
}
inline void UIThreadCall(boost::function0<void> fn)
{
}
inline void MainFrameRepaint()
{
}
inline void CreateMainWindow()
{
}
#else // wxUSE_GUI
@@ -37,7 +74,9 @@ class CMainFrame : public CMainFrameBase
{
protected:
// Event handlers
void OnNotebookPageChanged(wxNotebookEvent& event);
void OnClose(wxCloseEvent& event);
void OnIconize(wxIconizeEvent& event);
void OnMouseEvents(wxMouseEvent& event);
void OnKeyDown(wxKeyEvent& event) { HandleCtrlA(event); }
void OnIdle(wxIdleEvent& event);
@@ -45,6 +84,7 @@ protected:
void OnPaintListCtrl(wxPaintEvent& event);
void OnMenuFileExit(wxCommandEvent& event);
void OnMenuOptionsGenerate(wxCommandEvent& event);
void OnUpdateUIOptionsGenerate(wxUpdateUIEvent& event);
void OnMenuOptionsChangeYourAddress(wxCommandEvent& event);
void OnMenuOptionsOptions(wxCommandEvent& event);
void OnMenuHelpAbout(wxCommandEvent& event);
@@ -52,10 +92,10 @@ protected:
void OnButtonAddressBook(wxCommandEvent& event);
void OnSetFocusAddress(wxFocusEvent& event);
void OnMouseEventsAddress(wxMouseEvent& event);
void OnButtonNew(wxCommandEvent& event);
void OnButtonCopy(wxCommandEvent& event);
void OnButtonChange(wxCommandEvent& event);
void OnListColBeginDrag(wxListEvent& event);
void OnListItemActivatedAllTransactions(wxListEvent& event);
void OnListItemActivated(wxListEvent& event);
void OnListItemActivatedProductsSent(wxListEvent& event);
void OnListItemActivatedOrdersSent(wxListEvent& event);
void OnListItemActivatedOrdersReceived(wxListEvent& event);
@@ -66,17 +106,31 @@ public:
~CMainFrame();
// Custom
enum
{
ALL = 0,
SENTRECEIVED = 1,
SENT = 2,
RECEIVED = 3,
};
int nPage;
wxListCtrl* m_listCtrl;
bool fShowGenerated;
bool fShowSent;
bool fShowReceived;
bool fRefreshListCtrl;
bool fRefreshListCtrlRunning;
bool fOnSetFocusAddress;
CBlockIndex* pindexBestLast;
set<uint256> setUnmaturedDisplayed;
unsigned int nListViewUpdated;
bool fRefresh;
void OnCrossThreadCall(wxCommandEvent& event);
void OnUIThreadCall(wxCommandEvent& event);
int GetSortIndex(const string& strSort);
void InsertLine(bool fNew, int nIndex, uint256 hashKey, string strSort, const wxString& str1, const wxString& str2, const wxString& str3, const wxString& str4, const wxString& str5);
void InsertTransaction(const CWalletTx& wtx, bool fNew, int nIndex=-1);
bool DeleteLine(uint256 hashKey);
bool InsertTransaction(const CWalletTx& wtx, bool fNew, int nIndex=-1);
void RefreshListCtrl();
void RefreshStatus();
void RefreshStatusColumn();
};
@@ -102,13 +156,25 @@ class COptionsDialog : public COptionsDialogBase
{
protected:
// Event handlers
void OnListBox(wxCommandEvent& event);
void OnKillFocusTransactionFee(wxFocusEvent& event);
void OnCheckBoxLimitProcessors(wxCommandEvent& event);
void OnCheckBoxUseProxy(wxCommandEvent& event);
void OnKillFocusProxy(wxFocusEvent& event);
void OnButtonOK(wxCommandEvent& event);
void OnButtonCancel(wxCommandEvent& event);
void OnButtonApply(wxCommandEvent& event);
public:
/** Constructor */
COptionsDialog(wxWindow* parent);
// Custom
bool fTmpStartOnSystemStartup;
bool fTmpMinimizeOnClose;
void SelectPage(int nPage);
CAddress GetProxyAddr();
};
@@ -141,6 +207,11 @@ protected:
public:
/** Constructor */
CSendDialog(wxWindow* parent, const wxString& strAddress="");
// Custom
bool fEnabledPrev;
string strFromSave;
string strMessageSave;
};
@@ -164,7 +235,7 @@ public:
int64 nPrice;
CWalletTx wtx;
wxDateTime start;
string strStatus;
char pszStatus[10000];
bool fCanCancel;
bool fAbort;
bool fSuccess;
@@ -187,190 +258,44 @@ void SendingDialogOnReply3(void* parg, CDataStream& vRecv);
class CYourAddressDialog : public CYourAddressDialogBase
{
protected:
// Event handlers
void OnListEndLabelEdit(wxListEvent& event);
void OnListItemSelected(wxListEvent& event);
void OnListItemActivated(wxListEvent& event);
void OnButtonRename(wxCommandEvent& event);
void OnButtonNew(wxCommandEvent& event);
void OnButtonCopy(wxCommandEvent& event);
void OnButtonOK(wxCommandEvent& event);
void OnButtonCancel(wxCommandEvent& event);
void OnClose(wxCloseEvent& event);
public:
/** Constructor */
CYourAddressDialog(wxWindow* parent);
CYourAddressDialog(wxWindow* parent, const string& strInitSelected);
// Custom
wxString GetAddress();
};
class CAddressBookDialog : public CAddressBookDialogBase
{
protected:
// Event handlers
void OnNotebookPageChanged(wxNotebookEvent& event);
void OnListEndLabelEdit(wxListEvent& event);
void OnListItemSelected(wxListEvent& event);
void OnListItemActivated(wxListEvent& event);
void OnButtonEdit(wxCommandEvent& event);
void OnButtonDelete(wxCommandEvent& event);
void OnButtonNew(wxCommandEvent& event);
void OnButtonCopy(wxCommandEvent& event);
void OnButtonEdit(wxCommandEvent& event);
void OnButtonNew(wxCommandEvent& event);
void OnButtonOK(wxCommandEvent& event);
void OnButtonCancel(wxCommandEvent& event);
void OnClose(wxCloseEvent& event);
public:
/** Constructor */
CAddressBookDialog(wxWindow* parent, const wxString& strInitSelected, bool fSendingIn);
CAddressBookDialog(wxWindow* parent, const wxString& strInitSelected, int nPageIn, bool fDuringSendIn);
// Custom
bool fSending;
enum
{
SENDING = 0,
RECEIVING = 1,
};
int nPage;
wxListCtrl* m_listCtrl;
bool fDuringSend;
wxString GetAddress();
wxString GetSelectedAddress();
wxString GetSelectedSendingAddress();
wxString GetSelectedReceivingAddress();
bool CheckIfMine(const string& strAddress, const string& strTitle);
};
class CProductsDialog : public CProductsDialogBase
{
protected:
// Event handlers
void OnKeyDown(wxKeyEvent& event) { HandleCtrlA(event); }
void OnCombobox(wxCommandEvent& event);
void OnButtonSearch(wxCommandEvent& event);
void OnListItemActivated(wxListEvent& event);
public:
/** Constructor */
CProductsDialog(wxWindow* parent);
// Custom
vector<CProduct> m_vProduct;
};
class CEditProductDialog : public CEditProductDialogBase
{
protected:
// Event handlers
void OnKeyDown(wxKeyEvent& event) { HandleCtrlA(event); }
void OnButtonDel0(wxCommandEvent& event);
void OnButtonDel1(wxCommandEvent& event);
void OnButtonDel2(wxCommandEvent& event);
void OnButtonDel3(wxCommandEvent& event);
void OnButtonDel4(wxCommandEvent& event);
void OnButtonDel5(wxCommandEvent& event);
void OnButtonDel6(wxCommandEvent& event);
void OnButtonDel7(wxCommandEvent& event);
void OnButtonDel8(wxCommandEvent& event);
void OnButtonDel9(wxCommandEvent& event);
void OnButtonDel10(wxCommandEvent& event);
void OnButtonDel11(wxCommandEvent& event);
void OnButtonDel12(wxCommandEvent& event);
void OnButtonDel13(wxCommandEvent& event);
void OnButtonDel14(wxCommandEvent& event);
void OnButtonDel15(wxCommandEvent& event);
void OnButtonDel16(wxCommandEvent& event);
void OnButtonDel17(wxCommandEvent& event);
void OnButtonDel18(wxCommandEvent& event);
void OnButtonDel19(wxCommandEvent& event);
void OnButtonAddField(wxCommandEvent& event);
void OnButtonSend(wxCommandEvent& event);
void OnButtonPreview(wxCommandEvent& event);
void OnButtonCancel(wxCommandEvent& event);
public:
/** Constructor */
CEditProductDialog(wxWindow* parent);
// Custom
enum { FIELDS_MAX = 20 };
wxTextCtrl* m_textCtrlLabel[FIELDS_MAX];
wxTextCtrl* m_textCtrlField[FIELDS_MAX];
wxButton* m_buttonDel[FIELDS_MAX];
void LayoutAll();
void ShowLine(int i, bool fShow=true);
void OnButtonDel(wxCommandEvent& event, int n);
void SetProduct(const CProduct& productIn);
void GetProduct(CProduct& product);
};
class CViewProductDialog : public CViewProductDialogBase
{
protected:
// Event handlers
void OnButtonSubmitForm(wxCommandEvent& event);
void OnButtonCancelForm(wxCommandEvent& event);
void OnButtonBack(wxCommandEvent& event);
void OnButtonNext(wxCommandEvent& event);
void OnButtonCancel(wxCommandEvent& event);
public:
/** Constructor */
CViewProductDialog(wxWindow* parent, const CProduct& productIn);
~CViewProductDialog();
// Custom
CProduct product;
enum { FIELDS_MAX = 20 };
wxStaticText* m_staticTextLabel[FIELDS_MAX];
wxTextCtrl* m_textCtrlField[FIELDS_MAX];
wxChoice* m_choiceField[FIELDS_MAX];
void GetOrder(CWalletTx& order);
void UpdateProductDisplay(bool fDetails);
void OnReply1(wxCommandEvent& event);
};
class CViewOrderDialog : public CViewOrderDialogBase
{
protected:
// Event handlers
void OnButtonOK(wxCommandEvent& event);
public:
/** Constructor */
CViewOrderDialog(wxWindow* parent, CWalletTx order, bool fReceived);
// Custom
bool fReceived;
};
class CEditReviewDialog : public CEditReviewDialogBase
{
protected:
// Event handlers
void OnKeyDown(wxKeyEvent& event) { HandleCtrlA(event); }
void OnButtonSubmit(wxCommandEvent& event);
void OnButtonCancel(wxCommandEvent& event);
public:
/** Constructor */
CEditReviewDialog(wxWindow* parent);
// Custom
void GetReview(CReview& review);
};
class CGetTextFromUserDialog : public CGetTextFromUserDialogBase
{
protected:
@@ -396,16 +321,25 @@ public:
const string& strMessage2="",
const string& strValue2="") : CGetTextFromUserDialogBase(parent, wxID_ANY, strCaption)
{
int x = GetSize().GetWidth();
int y = GetSize().GetHeight();
m_staticTextMessage1->SetLabel(strMessage1);
m_textCtrl1->SetValue(strValue1);
y += wxString(strMessage1).Freq('\n') * 14;
if (!strMessage2.empty())
{
m_staticTextMessage2->Show(true);
m_staticTextMessage2->SetLabel(strMessage2);
m_textCtrl2->Show(true);
m_textCtrl2->SetValue(strValue2);
SetSize(wxDefaultCoord, 180);
y += 46 + wxString(strMessage2).Freq('\n') * 14;
}
if (!fWindows)
{
x *= 1.14;
y *= 1.14;
}
SetSize(x, y);
}
// Custom
@@ -416,5 +350,30 @@ public:
class CMyTaskBarIcon : public wxTaskBarIcon
{
protected:
// Event handlers
void OnLeftButtonDClick(wxTaskBarIconEvent& event);
void OnMenuRestore(wxCommandEvent& event);
void OnMenuOptions(wxCommandEvent& event);
void OnUpdateUIGenerate(wxUpdateUIEvent& event);
void OnMenuGenerate(wxCommandEvent& event);
void OnMenuExit(wxCommandEvent& event);
public:
CMyTaskBarIcon() : wxTaskBarIcon()
{
Show(true);
}
void Show(bool fShow=true);
void Hide();
void Restore();
void UpdateTooltip();
virtual wxMenu* CreatePopupMenu();
DECLARE_EVENT_TABLE()
};
#endif // wxUSE_GUI

2758
uibase.cpp

File diff suppressed because it is too large Load Diff

950
uibase.h

File diff suppressed because it is too large Load Diff

View File

@@ -299,19 +299,18 @@ public:
return string(psz, psz + sizeof(pn)*2);
}
void SetHex(const std::string& str)
void SetHex(const char* psz)
{
for (int i = 0; i < WIDTH; i++)
pn[i] = 0;
// skip 0x
const char* psz = str.c_str();
// skip leading spaces
while (isspace(*psz))
psz++;
// skip 0x
if (psz[0] == '0' && tolower(psz[1]) == 'x')
psz += 2;
while (isspace(*psz))
psz++;
// hex string to uint
static char phexdigit[256] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,1,2,3,4,5,6,7,8,9,0,0,0,0,0,0, 0,0xa,0xb,0xc,0xd,0xe,0xf,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0xa,0xb,0xc,0xd,0xe,0xf,0,0,0,0,0,0,0,0,0 };
@@ -332,6 +331,11 @@ public:
}
}
void SetHex(const std::string& str)
{
SetHex(str.c_str());
}
std::string ToString() const
{
return (GetHex());
@@ -384,7 +388,6 @@ typedef base_uint<256> base_uint256;
//
// uint160 and uint256 could be implemented as templates, but to keep
// compile errors and debugging cleaner, they're copy and pasted.
// It's safe to search and replace 160 with 256 and vice versa.
//
@@ -401,6 +404,8 @@ public:
uint160()
{
for (int i = 0; i < WIDTH; i++)
pn[i] = 0;
}
uint160(const basetype& b)
@@ -513,6 +518,8 @@ public:
uint256()
{
for (int i = 0; i < WIDTH; i++)
pn[i] = 0;
}
uint256(const basetype& b)

File diff suppressed because it is too large Load Diff

493
util.cpp
View File

@@ -1,25 +1,32 @@
// Copyright (c) 2009 Satoshi Nakamoto
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Distributed under the MIT/X11 software license, see the accompanying
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
#include "headers.h"
map<string, string> mapArgs;
map<string, vector<string> > mapMultiArgs;
bool fDebug = false;
bool fPrintToConsole = false;
bool fPrintToDebugger = false;
char pszSetDataDir[MAX_PATH] = "";
bool fShutdown = false;
bool fDaemon = false;
bool fCommandLine = false;
// Init openssl library multithreading support
static HANDLE* lock_cs;
void win32_locking_callback(int mode, int type, const char* file, int line)
static wxMutex** ppmutexOpenSSL;
void locking_callback(int mode, int i, const char* file, int line)
{
if (mode & CRYPTO_LOCK)
WaitForSingleObject(lock_cs[type], INFINITE);
ppmutexOpenSSL[i]->Lock();
else
ReleaseMutex(lock_cs[type]);
ppmutexOpenSSL[i]->Unlock();
}
// Init
@@ -29,24 +36,26 @@ public:
CInit()
{
// Init openssl library multithreading support
lock_cs = (HANDLE*)OPENSSL_malloc(CRYPTO_num_locks() * sizeof(HANDLE));
ppmutexOpenSSL = (wxMutex**)OPENSSL_malloc(CRYPTO_num_locks() * sizeof(wxMutex*));
for (int i = 0; i < CRYPTO_num_locks(); i++)
lock_cs[i] = CreateMutex(NULL,FALSE,NULL);
CRYPTO_set_locking_callback(win32_locking_callback);
ppmutexOpenSSL[i] = new wxMutex();
CRYPTO_set_locking_callback(locking_callback);
#ifdef __WXMSW__
// Seed random number generator with screen scrape and other hardware sources
RAND_screen();
#endif
// Seed random number generator with perfmon data
RandAddSeed(true);
// Seed random number generator with performance counter
RandAddSeed();
}
~CInit()
{
// Shutdown openssl library multithreading support
CRYPTO_set_locking_callback(NULL);
for (int i =0 ; i < CRYPTO_num_locks(); i++)
CloseHandle(lock_cs[i]);
OPENSSL_free(lock_cs);
for (int i = 0; i < CRYPTO_num_locks(); i++)
delete ppmutexOpenSSL[i];
OPENSSL_free(ppmutexOpenSSL);
}
}
instance_of_cinit;
@@ -54,41 +63,64 @@ instance_of_cinit;
void RandAddSeed(bool fPerfmon)
void RandAddSeed()
{
// Seed with CPU performance counter
LARGE_INTEGER PerformanceCount;
QueryPerformanceCounter(&PerformanceCount);
RAND_add(&PerformanceCount, sizeof(PerformanceCount), 1.5);
memset(&PerformanceCount, 0, sizeof(PerformanceCount));
int64 nCounter = PerformanceCounter();
RAND_add(&nCounter, sizeof(nCounter), 1.5);
memset(&nCounter, 0, sizeof(nCounter));
}
void RandAddSeedPerfmon()
{
RandAddSeed();
// This can take up to 2 seconds, so only do it every 10 minutes
static int64 nLastPerfmon;
if (fPerfmon || GetTime() > nLastPerfmon + 5 * 60)
if (GetTime() < nLastPerfmon + 10 * 60)
return;
nLastPerfmon = GetTime();
#ifdef __WXMSW__
// Don't need this on Linux, OpenSSL automatically uses /dev/urandom
// Seed with the entire set of perfmon data
unsigned char pdata[250000];
memset(pdata, 0, sizeof(pdata));
unsigned long nSize = sizeof(pdata);
long ret = RegQueryValueExA(HKEY_PERFORMANCE_DATA, "Global", NULL, NULL, pdata, &nSize);
RegCloseKey(HKEY_PERFORMANCE_DATA);
if (ret == ERROR_SUCCESS)
{
nLastPerfmon = GetTime();
uint256 hash;
SHA256(pdata, nSize, (unsigned char*)&hash);
RAND_add(&hash, sizeof(hash), min(nSize/500.0, (double)sizeof(hash)));
hash = 0;
memset(pdata, 0, nSize);
// Seed with the entire set of perfmon data
unsigned char pdata[250000];
memset(pdata, 0, sizeof(pdata));
unsigned long nSize = sizeof(pdata);
long ret = RegQueryValueEx(HKEY_PERFORMANCE_DATA, "Global", NULL, NULL, pdata, &nSize);
RegCloseKey(HKEY_PERFORMANCE_DATA);
if (ret == ERROR_SUCCESS)
{
uint256 hash;
SHA256(pdata, nSize, (unsigned char*)&hash);
RAND_add(&hash, sizeof(hash), min(nSize/500.0, (double)sizeof(hash)));
hash = 0;
memset(pdata, 0, nSize);
time_t nTime;
time(&nTime);
struct tm* ptmTime = gmtime(&nTime);
char pszTime[200];
strftime(pszTime, sizeof(pszTime), "%x %H:%M:%S", ptmTime);
printf("%s RandAddSeed() got %d bytes of performance data\n", pszTime, nSize);
}
printf("%s RandAddSeed() %d bytes\n", DateTimeStrFormat("%x %H:%M:%S", GetTime()).c_str(), nSize);
}
#else
printf("%s RandAddSeed()\n", DateTimeStrFormat("%x %H:%M:%S", GetTime()).c_str());
#endif
}
uint64 GetRand(uint64 nMax)
{
if (nMax == 0)
return 0;
// The range of the random source must be a multiple of the modulus
// to give every possible output value an equal possibility
uint64 nRange = (UINT64_MAX / nMax) * nMax;
uint64 nRand = 0;
do
RAND_bytes((unsigned char*)&nRand, sizeof(nRand));
while (nRand >= nRange);
return (nRand % nMax);
}
@@ -100,6 +132,82 @@ void RandAddSeed(bool fPerfmon)
inline int OutputDebugStringF(const char* pszFormat, ...)
{
int ret = 0;
if (fPrintToConsole || wxTheApp == NULL)
{
// print to console
va_list arg_ptr;
va_start(arg_ptr, pszFormat);
ret = vprintf(pszFormat, arg_ptr);
va_end(arg_ptr);
}
else
{
// print to debug.log
char pszFile[MAX_PATH+100];
GetDataDir(pszFile);
strlcat(pszFile, "/debug.log", sizeof(pszFile));
FILE* fileout = fopen(pszFile, "a");
if (fileout)
{
//// Debug print useful for profiling
//fprintf(fileout, " %"PRI64d" ", wxGetLocalTimeMillis().GetValue());
va_list arg_ptr;
va_start(arg_ptr, pszFormat);
ret = vfprintf(fileout, pszFormat, arg_ptr);
va_end(arg_ptr);
fclose(fileout);
}
}
#ifdef __WXMSW__
if (fPrintToDebugger)
{
// accumulate a line at a time
static CCriticalSection cs_OutputDebugStringF;
CRITICAL_BLOCK(cs_OutputDebugStringF)
{
static char pszBuffer[50000];
static char* pend;
if (pend == NULL)
pend = pszBuffer;
va_list arg_ptr;
va_start(arg_ptr, pszFormat);
int limit = END(pszBuffer) - pend - 2;
int ret = _vsnprintf(pend, limit, pszFormat, arg_ptr);
va_end(arg_ptr);
if (ret < 0 || ret >= limit)
{
pend = END(pszBuffer) - 2;
*pend++ = '\n';
}
else
pend += ret;
*pend = '\0';
char* p1 = pszBuffer;
char* p2;
while (p2 = strchr(p1, '\n'))
{
p2++;
char c = *p2;
*p2 = '\0';
OutputDebugStringA(p1);
*p2 = c;
p1 = p2;
}
if (p1 != pszBuffer)
memmove(pszBuffer, p1, pend - p1 + 1);
pend -= (p1 - pszBuffer);
}
}
#endif
return ret;
}
// Safer snprintf
// - prints up to limit-1 characters
// - output string is always null terminated even if limit reached
@@ -142,11 +250,6 @@ string strprintf(const char* format, ...)
if (p == NULL)
throw std::bad_alloc();
}
#ifdef _MSC_VER
// msvc optimisation
if (p == buffer)
return string(p, p+ret);
#endif
string str(p, p+ret);
if (p != buffer)
delete p;
@@ -172,45 +275,30 @@ bool error(const char* format, ...)
}
void PrintException(std::exception* pex, const char* pszThread)
{
char pszModule[260];
pszModule[0] = '\0';
GetModuleFileName(NULL, pszModule, sizeof(pszModule));
_strlwr(pszModule);
char pszMessage[1000];
if (pex)
snprintf(pszMessage, sizeof(pszMessage),
"EXCEPTION: %s \n%s \n%s in %s \n", typeid(*pex).name(), pex->what(), pszModule, pszThread);
else
snprintf(pszMessage, sizeof(pszMessage),
"UNKNOWN EXCEPTION \n%s in %s \n", pszModule, pszThread);
printf("\n\n************************\n%s", pszMessage);
if (wxTheApp)
wxMessageBox(pszMessage, "Error", wxOK | wxICON_ERROR);
throw;
//DebugBreak();
}
void ParseString(const string& str, char c, vector<string>& v)
{
unsigned int i1 = 0;
unsigned int i2;
do
if (str.empty())
return;
string::size_type i1 = 0;
string::size_type i2;
loop
{
i2 = str.find(c, i1);
if (i2 == str.npos)
{
v.push_back(str.substr(i1));
return;
}
v.push_back(str.substr(i1, i2-i1));
i1 = i2+1;
}
while (i2 != str.npos);
}
string FormatMoney(int64 n, bool fPlus)
{
n /= CENT;
string str = strprintf("%I64d.%02I64d", (n > 0 ? n : -n)/100, (n > 0 ? n : -n)%100);
string str = strprintf("%"PRI64d".%02"PRI64d, (n > 0 ? n : -n)/100, (n > 0 ? n : -n)%100);
for (int i = 6; i < str.size(); i += 4)
if (isdigit(str[str.size() - i - 1]))
str.insert(str.size() - i, 1, ',');
@@ -221,6 +309,12 @@ string FormatMoney(int64 n, bool fPlus)
return str;
}
bool ParseMoney(const string& str, int64& nRet)
{
return ParseMoney(str.c_str(), nRet);
}
bool ParseMoney(const char* pszIn, int64& nRet)
{
string strWhole;
@@ -268,21 +362,204 @@ bool ParseMoney(const char* pszIn, int64& nRet)
}
bool FileExists(const char* psz)
vector<unsigned char> ParseHex(const char* psz)
{
#ifdef WIN32
return GetFileAttributes(psz) != -1;
vector<unsigned char> vch;
while (isspace(*psz))
psz++;
vch.reserve((strlen(psz)+1)/3);
static char phexdigit[256] =
{ -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
0,1,2,3,4,5,6,7,8,9,-1,-1,-1,-1,-1,-1,
-1,0xa,0xb,0xc,0xd,0xe,0xf,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,0xa,0xb,0xc,0xd,0xe,0xf,-1,-1,-1,-1,-1,-1,-1,-1,-1
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, };
while (*psz)
{
char c = phexdigit[(unsigned char)*psz++];
if (c == -1)
break;
unsigned char n = (c << 4);
if (*psz)
{
char c = phexdigit[(unsigned char)*psz++];
if (c == -1)
break;
n |= c;
vch.push_back(n);
}
while (isspace(*psz))
psz++;
}
return vch;
}
vector<unsigned char> ParseHex(const std::string& str)
{
return ParseHex(str.c_str());
}
void ParseParameters(int argc, char* argv[])
{
mapArgs.clear();
mapMultiArgs.clear();
for (int i = 0; i < argc; i++)
{
char psz[10000];
strlcpy(psz, argv[i], sizeof(psz));
char* pszValue = (char*)"";
if (strchr(psz, '='))
{
pszValue = strchr(psz, '=');
*pszValue++ = '\0';
}
#ifdef __WXMSW__
_strlwr(psz);
if (psz[0] == '/')
psz[0] = '-';
#endif
mapArgs[psz] = pszValue;
mapMultiArgs[psz].push_back(pszValue);
}
}
const char* wxGetTranslation(const char* pszEnglish)
{
// Wrapper of wxGetTranslation returning the same const char* type as was passed in
static CCriticalSection cs;
CRITICAL_BLOCK(cs)
{
// Look in cache
static map<string, char*> mapCache;
map<string, char*>::iterator mi = mapCache.find(pszEnglish);
if (mi != mapCache.end())
return (*mi).second;
// wxWidgets translation
wxString strTranslated = wxGetTranslation(wxString(pszEnglish, wxConvUTF8));
// We don't cache unknown strings because caller might be passing in a
// dynamic string and we would keep allocating memory for each variation.
if (strcmp(pszEnglish, strTranslated.utf8_str()) == 0)
return pszEnglish;
// Add to cache, memory doesn't need to be freed. We only cache because
// we must pass back a pointer to permanently allocated memory.
char* pszCached = new char[strlen(strTranslated.utf8_str())+1];
strcpy(pszCached, strTranslated.utf8_str());
mapCache[pszEnglish] = pszCached;
return pszCached;
}
return NULL;
}
void FormatException(char* pszMessage, std::exception* pex, const char* pszThread)
{
#ifdef __WXMSW__
char pszModule[MAX_PATH];
pszModule[0] = '\0';
GetModuleFileNameA(NULL, pszModule, sizeof(pszModule));
#else
return access(psz, 0) != -1;
// might not be thread safe, uses wxString
//const char* pszModule = wxStandardPaths::Get().GetExecutablePath().mb_str();
const char* pszModule = "bitcoin";
#endif
if (pex)
snprintf(pszMessage, 1000,
"EXCEPTION: %s \n%s \n%s in %s \n", typeid(*pex).name(), pex->what(), pszModule, pszThread);
else
snprintf(pszMessage, 1000,
"UNKNOWN EXCEPTION \n%s in %s \n", pszModule, pszThread);
}
void LogException(std::exception* pex, const char* pszThread)
{
char pszMessage[1000];
FormatException(pszMessage, pex, pszThread);
printf("\n%s", pszMessage);
}
void PrintException(std::exception* pex, const char* pszThread)
{
char pszMessage[1000];
FormatException(pszMessage, pex, pszThread);
printf("\n\n************************\n%s\n", pszMessage);
fprintf(stderr, "\n\n************************\n%s\n", pszMessage);
if (wxTheApp && !fDaemon && fGUI)
MyMessageBox(pszMessage, "Error", wxOK | wxICON_ERROR);
throw;
//DebugBreak();
}
void GetDataDir(char* pszDir)
{
// pszDir must be at least MAX_PATH length.
if (pszSetDataDir[0] != 0)
{
strlcpy(pszDir, pszSetDataDir, MAX_PATH);
static bool fMkdirDone;
if (!fMkdirDone)
{
fMkdirDone = true;
_mkdir(pszDir);
}
}
else
{
// This can be called during exceptions by printf, so we cache the
// value so we don't have to do memory allocations after that.
// wxStandardPaths::GetUserDataDir
// Return the directory for the user-dependent application data files:
// Unix: ~/.appname
// Windows: C:\Documents and Settings\username\Application Data\appname
// Mac: ~/Library/Application Support/appname
static char pszCachedDir[MAX_PATH];
if (pszCachedDir[0] == 0)
{
strlcpy(pszCachedDir, wxStandardPaths::Get().GetUserDataDir().c_str(), sizeof(pszCachedDir));
_mkdir(pszCachedDir);
}
strlcpy(pszDir, pszCachedDir, MAX_PATH);
}
}
string GetDataDir()
{
char pszDir[MAX_PATH];
GetDataDir(pszDir);
return pszDir;
}
int GetFilesize(FILE* file)
@@ -295,26 +572,24 @@ int GetFilesize(FILE* file)
return nFilesize;
}
uint64 GetRand(uint64 nMax)
void ShrinkDebugFile()
{
if (nMax == 0)
return 0;
// The range of the random source must be a multiple of the modulus
// to give every possible output value an equal possibility
uint64 nRange = (_UI64_MAX / nMax) * nMax;
uint64 nRand = 0;
do
RAND_bytes((unsigned char*)&nRand, sizeof(nRand));
while (nRand >= nRange);
return (nRand % nMax);
// Scroll debug.log if it's getting too big
string strFile = GetDataDir() + "/debug.log";
FILE* file = fopen(strFile.c_str(), "r");
if (file && GetFilesize(file) > 10 * 1000000)
{
// Restart the file with some of the end
char pch[200000];
fseek(file, -sizeof(pch), SEEK_END);
int nBytes = fread(pch, 1, sizeof(pch), file);
fclose(file);
if (file = fopen(strFile.c_str(), "w"))
{
fwrite(pch, 1, nBytes, file);
fclose(file);
}
}
}
@@ -326,6 +601,7 @@ uint64 GetRand(uint64 nMax)
//
// "Never go to sea with two chronometers; take one or three."
// Our three chronometers are:
@@ -336,7 +612,6 @@ uint64 GetRand(uint64 nMax)
// note: NTP isn't implemented yet, so until then we just use the median
// of other nodes clocks to correct ours.
//
int64 GetTime()
{
return time(NULL);
@@ -363,7 +638,7 @@ void AddTimeData(unsigned int ip, int64 nTime)
if (vTimeOffsets.empty())
vTimeOffsets.push_back(0);
vTimeOffsets.push_back(nOffsetSample);
printf("Added time data, samples %d, ip %08x, offset %+I64d (%+I64d minutes)\n", vTimeOffsets.size(), ip, vTimeOffsets.back(), vTimeOffsets.back()/60);
printf("Added time data, samples %d, offset %+"PRI64d" (%+"PRI64d" minutes)\n", vTimeOffsets.size(), vTimeOffsets.back(), vTimeOffsets.back()/60);
if (vTimeOffsets.size() >= 5 && vTimeOffsets.size() % 2 == 1)
{
sort(vTimeOffsets.begin(), vTimeOffsets.end());
@@ -377,7 +652,7 @@ void AddTimeData(unsigned int ip, int64 nTime)
/// to make sure it doesn't get changed again
}
foreach(int64 n, vTimeOffsets)
printf("%+I64d ", n);
printf("| nTimeOffset = %+I64d (%+I64d minutes)\n", nTimeOffset, nTimeOffset/60);
printf("%+"PRI64d" ", n);
printf("| nTimeOffset = %+"PRI64d" (%+"PRI64d" minutes)\n", nTimeOffset, nTimeOffset/60);
}
}

344
util.h
View File

@@ -1,4 +1,4 @@
// Copyright (c) 2009 Satoshi Nakamoto
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Distributed under the MIT/X11 software license, see the accompanying
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
@@ -13,7 +13,6 @@ typedef unsigned long long uint64;
#if defined(_MSC_VER) && _MSC_VER < 1300
#define for if (false) ; else for
#endif
#ifndef _MSC_VER
#define __forceinline inline
#endif
@@ -25,25 +24,22 @@ typedef unsigned long long uint64;
#define UBEGIN(a) ((unsigned char*)&(a))
#define UEND(a) ((unsigned char*)&((&(a))[1]))
#define ARRAYLEN(array) (sizeof(array)/sizeof((array)[0]))
#ifdef _WINDOWS
#define printf OutputDebugStringF
#endif
#ifdef snprintf
#undef snprintf
#endif
#define snprintf my_snprintf
#ifndef PRId64
#ifndef PRI64d
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__MSVCRT__)
#define PRId64 "I64d"
#define PRIu64 "I64u"
#define PRIx64 "I64x"
#define PRI64d "I64d"
#define PRI64u "I64u"
#define PRI64x "I64x"
#else
#define PRId64 "lld"
#define PRIu64 "llu"
#define PRIx64 "llx"
#define PRI64d "lld"
#define PRI64u "llu"
#define PRI64x "llx"
#endif
#endif
@@ -58,6 +54,55 @@ inline T& REF(const T& val)
return (T&)val;
}
#ifdef __WXMSW__
static const bool fWindows = true;
#define MSG_NOSIGNAL 0
#define MSG_DONTWAIT 0
#ifndef UINT64_MAX
#define UINT64_MAX _UI64_MAX
#define INT64_MAX _I64_MAX
#define INT64_MIN _I64_MIN
#endif
#ifndef S_IRUSR
#define S_IRUSR 0400
#define S_IWUSR 0200
#endif
#define unlink _unlink
typedef int socklen_t;
#else
static const bool fWindows = false;
#define WSAGetLastError() errno
#define WSAEWOULDBLOCK EWOULDBLOCK
#define WSAEMSGSIZE EMSGSIZE
#define WSAEINTR EINTR
#define WSAEINPROGRESS EINPROGRESS
#define WSAEADDRINUSE EADDRINUSE
#define WSAENOTSOCK EBADF
#define INVALID_SOCKET (SOCKET)(~0)
#define SOCKET_ERROR -1
typedef u_int SOCKET;
#define _vsnprintf(a,b,c,d) vsnprintf(a,b,c,d)
#define strlwr(psz) to_lower(psz)
#define _strlwr(psz) to_lower(psz)
#define _mkdir(psz) filesystem::create_directory(psz)
#define MAX_PATH 1024
#define Sleep(n) wxMilliSleep(n)
#define Beep(n1,n2) (0)
#endif
inline int myclosesocket(SOCKET& hSocket)
{
if (hSocket == INVALID_SOCKET)
return WSAENOTSOCK;
#ifdef __WXMSW__
int ret = closesocket(hSocket);
#else
int ret = close(hSocket);
#endif
hSocket = INVALID_SOCKET;
return ret;
}
#define closesocket(s) myclosesocket(s)
@@ -66,18 +111,38 @@ inline T& REF(const T& val)
extern map<string, string> mapArgs;
extern map<string, vector<string> > mapMultiArgs;
extern bool fDebug;
extern bool fPrintToConsole;
extern bool fPrintToDebugger;
extern char pszSetDataDir[MAX_PATH];
extern bool fShutdown;
extern bool fDaemon;
extern bool fCommandLine;
void RandAddSeed(bool fPerfmon=false);
void RandAddSeed();
void RandAddSeedPerfmon();
int OutputDebugStringF(const char* pszFormat, ...);
int my_snprintf(char* buffer, size_t limit, const char* format, ...);
string strprintf(const char* format, ...);
bool error(const char* format, ...);
void PrintException(std::exception* pex, const char* pszThread);
void LogException(std::exception* pex, const char* pszThread);
void ParseString(const string& str, char c, vector<string>& v);
string FormatMoney(int64 n, bool fPlus=false);
bool ParseMoney(const string& str, int64& nRet);
bool ParseMoney(const char* pszIn, int64& nRet);
bool FileExists(const char* psz);
vector<unsigned char> ParseHex(const char* psz);
vector<unsigned char> ParseHex(const std::string& str);
void ParseParameters(int argc, char* argv[]);
const char* wxGetTranslation(const char* psz);
int GetFilesize(FILE* file);
void GetDataDir(char* pszDirRet);
string GetDataDir();
void ShrinkDebugFile();
uint64 GetRand(uint64 nMax);
int64 GetTime();
int64 GetAdjustedTime();
@@ -94,32 +159,42 @@ void AddTimeData(unsigned int ip, int64 nTime);
// Wrapper to automatically initialize critical section
// Could use wxCriticalSection for portability, but it doesn't support TryEnterCriticalSection
// Wrapper to automatically initialize critical sections
class CCriticalSection
{
#ifdef __WXMSW__
protected:
CRITICAL_SECTION cs;
public:
char* pszFile;
int nLine;
explicit CCriticalSection() { InitializeCriticalSection(&cs); }
~CCriticalSection() { DeleteCriticalSection(&cs); }
void Enter() { EnterCriticalSection(&cs); }
void Leave() { LeaveCriticalSection(&cs); }
bool TryEnter() { return TryEnterCriticalSection(&cs); }
CRITICAL_SECTION* operator&() { return &cs; }
#else
protected:
wxMutex mutex;
public:
explicit CCriticalSection() : mutex(wxMUTEX_RECURSIVE) { }
~CCriticalSection() { }
void Enter() { mutex.Lock(); }
void Leave() { mutex.Unlock(); }
bool TryEnter() { return mutex.TryLock() == wxMUTEX_NO_ERROR; }
#endif
public:
const char* pszFile;
int nLine;
};
// Automatically leave critical section when leaving block, needed for exception safety
class CCriticalBlock
{
protected:
CRITICAL_SECTION* pcs;
CCriticalSection* pcs;
public:
CCriticalBlock(CRITICAL_SECTION& csIn) { pcs = &csIn; EnterCriticalSection(pcs); }
CCriticalBlock(CCriticalSection& csIn) { pcs = &csIn; EnterCriticalSection(pcs); }
~CCriticalBlock() { LeaveCriticalSection(pcs); }
CCriticalBlock(CCriticalSection& csIn) { pcs = &csIn; pcs->Enter(); }
~CCriticalBlock() { pcs->Leave(); }
};
// WARNING: This will catch continue and break!
@@ -133,11 +208,10 @@ public:
class CTryCriticalBlock
{
protected:
CRITICAL_SECTION* pcs;
CCriticalSection* pcs;
public:
CTryCriticalBlock(CRITICAL_SECTION& csIn) { pcs = (TryEnterCriticalSection(&csIn) ? &csIn : NULL); }
CTryCriticalBlock(CCriticalSection& csIn) { pcs = (TryEnterCriticalSection(&csIn) ? &csIn : NULL); }
~CTryCriticalBlock() { if (pcs) LeaveCriticalSection(pcs); }
CTryCriticalBlock(CCriticalSection& csIn) { pcs = (csIn.TryEnter() ? &csIn : NULL); }
~CTryCriticalBlock() { if (pcs) pcs->Leave(); }
bool Entered() { return pcs != NULL; }
};
@@ -154,11 +228,9 @@ public:
inline string i64tostr(int64 n)
{
return strprintf("%"PRId64, n);
return strprintf("%"PRI64d, n);
}
inline string itostr(int n)
@@ -194,6 +266,11 @@ inline int roundint(double d)
return (int)(d > 0 ? d + 0.5 : d - 0.5);
}
inline int64 roundint64(double d)
{
return (int64)(d > 0 ? d + 0.5 : d - 0.5);
}
template<typename T>
string HexStr(const T itbegin, const T itend, bool fSpaces=true)
{
@@ -205,6 +282,11 @@ string HexStr(const T itbegin, const T itend, bool fSpaces=true)
return str;
}
inline string HexStr(vector<unsigned char> vch, bool fSpaces=true)
{
return HexStr(vch.begin(), vch.end(), fSpaces);
}
template<typename T>
string HexNumStr(const T itbegin, const T itend, bool f0x=true)
{
@@ -222,77 +304,48 @@ void PrintHex(const T pbegin, const T pend, const char* pszFormat="%s", bool fSp
printf(pszFormat, HexStr(pbegin, pend, fSpaces).c_str());
}
inline int OutputDebugStringF(const char* pszFormat, ...)
inline void PrintHex(vector<unsigned char> vch, const char* pszFormat="%s", bool fSpaces=true)
{
#ifdef __WXDEBUG__
// log file
FILE* fileout = fopen("debug.log", "a");
if (fileout)
{
va_list arg_ptr;
va_start(arg_ptr, pszFormat);
vfprintf(fileout, pszFormat, arg_ptr);
va_end(arg_ptr);
fclose(fileout);
}
// accumulate a line at a time
static CCriticalSection cs_OutputDebugStringF;
CRITICAL_BLOCK(cs_OutputDebugStringF)
{
static char pszBuffer[50000];
static char* pend;
if (pend == NULL)
pend = pszBuffer;
va_list arg_ptr;
va_start(arg_ptr, pszFormat);
int limit = END(pszBuffer) - pend - 2;
int ret = _vsnprintf(pend, limit, pszFormat, arg_ptr);
va_end(arg_ptr);
if (ret < 0 || ret >= limit)
{
pend = END(pszBuffer) - 2;
*pend++ = '\n';
}
else
pend += ret;
*pend = '\0';
char* p1 = pszBuffer;
char* p2;
while (p2 = strchr(p1, '\n'))
{
p2++;
char c = *p2;
*p2 = '\0';
OutputDebugString(p1);
*p2 = c;
p1 = p2;
}
if (p1 != pszBuffer)
memmove(pszBuffer, p1, pend - p1 + 1);
pend -= (p1 - pszBuffer);
return ret;
}
#endif
if (!wxTheApp)
{
// print to console
va_list arg_ptr;
va_start(arg_ptr, pszFormat);
vprintf(pszFormat, arg_ptr);
va_end(arg_ptr);
}
return 0;
printf(pszFormat, HexStr(vch, fSpaces).c_str());
}
inline int64 PerformanceCounter()
{
int64 nCounter = 0;
#ifdef __WXMSW__
QueryPerformanceCounter((LARGE_INTEGER*)&nCounter);
#else
timeval t;
gettimeofday(&t, NULL);
nCounter = t.tv_sec * 1000000 + t.tv_usec;
#endif
return nCounter;
}
inline int64 GetTimeMillis()
{
return wxGetLocalTimeMillis().GetValue();
}
inline string DateTimeStrFormat(const char* pszFormat, int64 nTime)
{
time_t n = nTime;
struct tm* ptmTime = gmtime(&n);
char pszTime[200];
strftime(pszTime, sizeof(pszTime), pszFormat, ptmTime);
return pszTime;
}
template<typename T>
void skipspaces(T& it)
{
while (isspace(*it))
++it;
}
@@ -303,8 +356,11 @@ inline int OutputDebugStringF(const char* pszFormat, ...)
inline void heapchk()
{
if (_heapchk() != _HEAPOK)
DebugBreak();
#ifdef __WXMSW__
/// for debugging
//if (_heapchk() != _HEAPOK)
// DebugBreak();
#endif
}
// Randomize the stack to help protect against buffer overrun exploits
@@ -312,7 +368,7 @@ inline void heapchk()
{ \
static char nLoops; \
if (nLoops <= 0) \
nLoops = GetRand(50) + 1; \
nLoops = GetRand(20) + 1; \
if (nLoops-- > 1) \
{ \
ThreadFn; \
@@ -335,6 +391,7 @@ inline void heapchk()
template<typename T1>
inline uint256 Hash(const T1 pbegin, const T1 pend)
{
@@ -397,3 +454,88 @@ inline uint160 Hash160(const vector<unsigned char>& vch)
RIPEMD160((unsigned char*)&hash1, sizeof(hash1), (unsigned char*)&hash2);
return hash2;
}
// Note: It turns out we might have been able to use boost::thread
// by using TerminateThread(boost::thread.native_handle(), 0);
#ifdef __WXMSW__
typedef HANDLE pthread_t;
inline pthread_t CreateThread(void(*pfn)(void*), void* parg, bool fWantHandle=false)
{
DWORD nUnused = 0;
HANDLE hthread =
CreateThread(
NULL, // default security
0, // inherit stack size from parent
(LPTHREAD_START_ROUTINE)pfn, // function pointer
parg, // argument
0, // creation option, start immediately
&nUnused); // thread identifier
if (hthread == NULL)
{
printf("Error: CreateThread() returned %d\n", GetLastError());
return (pthread_t)0;
}
if (!fWantHandle)
{
CloseHandle(hthread);
return (pthread_t)-1;
}
return hthread;
}
inline void SetThreadPriority(int nPriority)
{
SetThreadPriority(GetCurrentThread(), nPriority);
}
#else
inline pthread_t CreateThread(void(*pfn)(void*), void* parg, bool fWantHandle=false)
{
pthread_t hthread = 0;
int ret = pthread_create(&hthread, NULL, (void*(*)(void*))pfn, parg);
if (ret != 0)
{
printf("Error: pthread_create() returned %d\n", ret);
return (pthread_t)0;
}
if (!fWantHandle)
return (pthread_t)-1;
return hthread;
}
#define THREAD_PRIORITY_LOWEST PRIO_MIN
#define THREAD_PRIORITY_BELOW_NORMAL 2
#define THREAD_PRIORITY_NORMAL 0
#define THREAD_PRIORITY_ABOVE_NORMAL 0
inline void SetThreadPriority(int nPriority)
{
// It's unclear if it's even possible to change thread priorities on Linux,
// but we really and truly need it for the generation threads.
#ifdef PRIO_THREAD
setpriority(PRIO_THREAD, 0, nPriority);
#else
setpriority(PRIO_PROCESS, 0, nPriority);
#endif
}
inline bool TerminateThread(pthread_t hthread, unsigned int nExitCode)
{
return (pthread_cancel(hthread) == 0);
}
inline void ExitThread(unsigned int nExitCode)
{
pthread_exit((void*)nExitCode);
}
#endif

665
xpm/about.xpm Normal file
View File

@@ -0,0 +1,665 @@
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Distributed under the MIT/X11 software license, see the accompanying
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
/* XPM */
static const char * about_xpm[] = {
/* columns rows colors chars-per-pixel */
"96 564 92 1",
" c #001269",
". c #000C72",
"X c #00057F",
"o c #001175",
"O c #000B6A",
"+ c #000E84",
"@ c #000489",
"# c #001583",
"$ c #001B89",
"% c #001B99",
"& c #000B92",
"* c #00208B",
"= c #002B97",
"- c #0004A6",
"; c #001DA7",
": c #0014BC",
"> c #0019BB",
", c #0017B4",
"< c #0023A3",
"1 c #002CAA",
"2 c #0030A4",
"3 c #003BA3",
"4 c #0033AB",
"5 c #003FA8",
"6 c #0027B8",
"7 c #0035BB",
"8 c #003CBA",
"9 c #004ABD",
"0 c #001DC4",
"q c #0017CC",
"w c #000CD0",
"e c #0026C7",
"r c #0035C4",
"t c #003DC5",
"y c #0032CB",
"u c #003BCC",
"i c #002BD3",
"p c #0021DC",
"a c #0025D5",
"s c #0034D5",
"d c #003ADB",
"f c #0016F6",
"g c #0008F9",
"h c #0027E3",
"j c #003CE9",
"k c #002BF5",
"l c #0024F9",
"z c #0033F4",
"x c #0035F8",
"c c #0048CA",
"v c #0055C5",
"b c #0059C3",
"n c #0053CB",
"m c #005ACC",
"M c #004FD4",
"N c #004CDC",
"B c #0047D0",
"V c #005BD6",
"C c #0049E5",
"Z c #0042EA",
"A c #0052E4",
"S c #005CE4",
"D c #0054EC",
"F c #005EEB",
"G c #004AF5",
"H c #0051F2",
"J c #005CFA",
"K c #0058F9",
"L c #0066E4",
"P c #006BE3",
"I c #0064EC",
"U c #006DEF",
"Y c #0074EB",
"T c #0078EC",
"R c #0073E7",
"E c #0065F4",
"W c #006BF5",
"Q c #006BFB",
"! c #0066FD",
"~ c #0073F5",
"^ c #007CF3",
"/ c #0075FB",
"( c #007DFC",
") c #0084FF",
"_ c #008AFF",
"` c #0092FF",
"' c #339CFF",
"] c #33A3FF",
"[ c #33AAFF",
"{ c #66B5FF",
"} c #66BBFF",
"| c #66C0FF",
/* pixels */
"kkkkkkkkkkkk<<<<<<<<<<<<DDDDDDDDDDDDvvvvvvvvvvvv////////////))))))))))))]]]]]]]]]]]]}}}}}}}}}}}}",
"kkkkkkkkkkkk<<<<<<<<<<<<DDDDDDDDDDDDvvvvvvvvvvvv////////////))))))))))))]]]]]]]]]]]]}}}}}}}}}}}}",
"kkkkkkkkkkkk<<<<<<<<<<<<DDDDDDDDDDDDvvvvvvvvvvvv////////////))))))))))))]]]]]]]]]]]]}}}}}}}}}}}}",
"kkkkkkkkkkkk<<<<<<<<<<<<DDDDDDDDDDDDvvvvvvvvvvvv////////////))))))))))))]]]]]]]]]]]]}}}}}}}}}}}}",
"kkkkkkkkkkkk<<<<<<<<<<<<DDDDDDDDDDDDvvvvvvvvvvvv////////////))))))))))))]]]]]]]]]]]]}}}}}}}}}}}}",
"kkkkkkkkkkkk<<<<<<<<<<<<DDDDDDDDDDDDvvvvvvvvvvvv////////////))))))))))))]]]]]]]]]]]]}}}}}}}}}}}}",
"kkkkkkkkkkkk<<<<<<<<<<<<DDDDDDDDDDDDvvvvvvvvvvvv////////////))))))))))))]]]]]]]]]]]]}}}}}}}}}}}}",
"kkkkkkkkkkkk<<<<<<<<<<<<DDDDDDDDDDDDvvvvvvvvvvvv////////////))))))))))))]]]]]]]]]]]]}}}}}}}}}}}}",
"kkkkkkkkkkkk<<<<<<<<<<<<DDDDDDDDDDDDvvvvvvvvvvvv////////////))))))))))))]]]]]]]]]]]]}}}}}}}}}}}}",
"kkkkkkkkkkkk<<<<<<<<<<<<DDDDDDDDDDDDvvvvvvvvvvvv////////////))))))))))))]]]]]]]]]]]]}}}}}}}}}}}}",
"kkkkkkkkkkkk<<<<<<<<<<<<DDDDDDDDDDDDvvvvvvvvvvvv////////////))))))))))))]]]]]]]]]]]]}}}}}}}}}}}}",
"kkkkkkkkkkkk<<<<<<<<<<<<DDDDDDDDDDDDvvvvvvvvvvvv////////////))))))))))))]]]]]]]]]]]]}}}}}}}}}}}}",
"XXXXXXXXXXXXrrrrrrrrrrrr777777777777MMMMMMMMMMMM(((((((((((())))))))))))[[[[[[[[[[[[}}}}}}}}}}}}",
"XXXXXXXXXXXXrrrrrrrrrrrr777777777777MMMMMMMMMMMM(((((((((((())))))))))))[[[[[[[[[[[[}}}}}}}}}}}}",
"XXXXXXXXXXXXrrrrrrrrrrrr777777777777MMMMMMMMMMMM(((((((((((())))))))))))[[[[[[[[[[[[}}}}}}}}}}}}",
"XXXXXXXXXXXXrrrrrrrrrrrr777777777777MMMMMMMMMMMM(((((((((((())))))))))))[[[[[[[[[[[[}}}}}}}}}}}}",
"XXXXXXXXXXXXrrrrrrrrrrrr777777777777MMMMMMMMMMMM(((((((((((())))))))))))[[[[[[[[[[[[}}}}}}}}}}}}",
"XXXXXXXXXXXXrrrrrrrrrrrr777777777777MMMMMMMMMMMM(((((((((((())))))))))))[[[[[[[[[[[[}}}}}}}}}}}}",
"XXXXXXXXXXXXrrrrrrrrrrrr777777777777MMMMMMMMMMMM(((((((((((())))))))))))[[[[[[[[[[[[}}}}}}}}}}}}",
"XXXXXXXXXXXXrrrrrrrrrrrr777777777777MMMMMMMMMMMM(((((((((((())))))))))))[[[[[[[[[[[[}}}}}}}}}}}}",
"XXXXXXXXXXXXrrrrrrrrrrrr777777777777MMMMMMMMMMMM(((((((((((())))))))))))[[[[[[[[[[[[}}}}}}}}}}}}",
"XXXXXXXXXXXXrrrrrrrrrrrr777777777777MMMMMMMMMMMM(((((((((((())))))))))))[[[[[[[[[[[[}}}}}}}}}}}}",
"XXXXXXXXXXXXrrrrrrrrrrrr777777777777MMMMMMMMMMMM(((((((((((())))))))))))[[[[[[[[[[[[}}}}}}}}}}}}",
"XXXXXXXXXXXXrrrrrrrrrrrr777777777777MMMMMMMMMMMM(((((((((((())))))))))))[[[[[[[[[[[[}}}}}}}}}}}}",
"llllllllllll;;;;;;;;;;;;NNNNNNNNNNNNSSSSSSSSSSSS~~~~~~~~~~~~))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
"llllllllllll;;;;;;;;;;;;NNNNNNNNNNNNSSSSSSSSSSSS~~~~~~~~~~~~))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
"llllllllllll;;;;;;;;;;;;NNNNNNNNNNNNSSSSSSSSSSSS~~~~~~~~~~~~))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
"llllllllllll;;;;;;;;;;;;NNNNNNNNNNNNSSSSSSSSSSSS~~~~~~~~~~~~))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
"llllllllllll;;;;;;;;;;;;NNNNNNNNNNNNSSSSSSSSSSSS~~~~~~~~~~~~))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
"llllllllllll;;;;;;;;;;;;NNNNNNNNNNNNSSSSSSSSSSSS~~~~~~~~~~~~))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
"llllllllllll;;;;;;;;;;;;NNNNNNNNNNNNSSSSSSSSSSSS~~~~~~~~~~~~))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
"llllllllllll;;;;;;;;;;;;NNNNNNNNNNNNSSSSSSSSSSSS~~~~~~~~~~~~))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
"llllllllllll;;;;;;;;;;;;NNNNNNNNNNNNSSSSSSSSSSSS~~~~~~~~~~~~))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
"llllllllllll;;;;;;;;;;;;NNNNNNNNNNNNSSSSSSSSSSSS~~~~~~~~~~~~))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
"llllllllllll;;;;;;;;;;;;NNNNNNNNNNNNSSSSSSSSSSSS~~~~~~~~~~~~))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
"llllllllllll;;;;;;;;;;;;NNNNNNNNNNNNSSSSSSSSSSSS~~~~~~~~~~~~))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
"############666666666666uuuuuuuuuuuuJJJJJJJJJJJJ^^^^^^^^^^^^____________]]]]]]]]]]]]{{{{{{{{{{{{",
"############666666666666uuuuuuuuuuuuJJJJJJJJJJJJ^^^^^^^^^^^^____________]]]]]]]]]]]]{{{{{{{{{{{{",
"############666666666666uuuuuuuuuuuuJJJJJJJJJJJJ^^^^^^^^^^^^____________]]]]]]]]]]]]{{{{{{{{{{{{",
"############666666666666uuuuuuuuuuuuJJJJJJJJJJJJ^^^^^^^^^^^^____________]]]]]]]]]]]]{{{{{{{{{{{{",
"############666666666666uuuuuuuuuuuuJJJJJJJJJJJJ^^^^^^^^^^^^____________]]]]]]]]]]]]{{{{{{{{{{{{",
"############666666666666uuuuuuuuuuuuJJJJJJJJJJJJ^^^^^^^^^^^^____________]]]]]]]]]]]]{{{{{{{{{{{{",
"############666666666666uuuuuuuuuuuuJJJJJJJJJJJJ^^^^^^^^^^^^____________]]]]]]]]]]]]{{{{{{{{{{{{",
"############666666666666uuuuuuuuuuuuJJJJJJJJJJJJ^^^^^^^^^^^^____________]]]]]]]]]]]]{{{{{{{{{{{{",
"############666666666666uuuuuuuuuuuuJJJJJJJJJJJJ^^^^^^^^^^^^____________]]]]]]]]]]]]{{{{{{{{{{{{",
"############666666666666uuuuuuuuuuuuJJJJJJJJJJJJ^^^^^^^^^^^^____________]]]]]]]]]]]]{{{{{{{{{{{{",
"############666666666666uuuuuuuuuuuuJJJJJJJJJJJJ^^^^^^^^^^^^____________]]]]]]]]]]]]{{{{{{{{{{{{",
"############666666666666uuuuuuuuuuuuJJJJJJJJJJJJ^^^^^^^^^^^^____________]]]]]]]]]]]]{{{{{{{{{{{{",
"............yyyyyyyyyyyy333333333333AAAAAAAAAAAAWWWWWWWWWWWW____________[[[[[[[[[[[[{{{{{{{{{{{{",
"............yyyyyyyyyyyy333333333333AAAAAAAAAAAAWWWWWWWWWWWW____________[[[[[[[[[[[[{{{{{{{{{{{{",
"............yyyyyyyyyyyy333333333333AAAAAAAAAAAAWWWWWWWWWWWW____________[[[[[[[[[[[[{{{{{{{{{{{{",
"............yyyyyyyyyyyy333333333333AAAAAAAAAAAAWWWWWWWWWWWW____________[[[[[[[[[[[[{{{{{{{{{{{{",
"............yyyyyyyyyyyy333333333333AAAAAAAAAAAAWWWWWWWWWWWW____________[[[[[[[[[[[[{{{{{{{{{{{{",
"............yyyyyyyyyyyy333333333333AAAAAAAAAAAAWWWWWWWWWWWW____________[[[[[[[[[[[[{{{{{{{{{{{{",
"............yyyyyyyyyyyy333333333333AAAAAAAAAAAAWWWWWWWWWWWW____________[[[[[[[[[[[[{{{{{{{{{{{{",
"............yyyyyyyyyyyy333333333333AAAAAAAAAAAAWWWWWWWWWWWW____________[[[[[[[[[[[[{{{{{{{{{{{{",
"............yyyyyyyyyyyy333333333333AAAAAAAAAAAAWWWWWWWWWWWW____________[[[[[[[[[[[[{{{{{{{{{{{{",
"............yyyyyyyyyyyy333333333333AAAAAAAAAAAAWWWWWWWWWWWW____________[[[[[[[[[[[[{{{{{{{{{{{{",
"............yyyyyyyyyyyy333333333333AAAAAAAAAAAAWWWWWWWWWWWW____________[[[[[[[[[[[[{{{{{{{{{{{{",
"............yyyyyyyyyyyy333333333333AAAAAAAAAAAAWWWWWWWWWWWW____________[[[[[[[[[[[[{{{{{{{{{{{{",
"ffffffffffff============yyyyyyyyyyyyJJJJJJJJJJJJRRRRRRRRRRRR))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
"ffffffffffff============yyyyyyyyyyyyJJJJJJJJJJJJRRRRRRRRRRRR))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
"ffffffffffff============yyyyyyyyyyyyJJJJJJJJJJJJRRRRRRRRRRRR))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
"ffffffffffff============yyyyyyyyyyyyJJJJJJJJJJJJRRRRRRRRRRRR))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
"ffffffffffff============yyyyyyyyyyyyJJJJJJJJJJJJRRRRRRRRRRRR))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
"ffffffffffff============yyyyyyyyyyyyJJJJJJJJJJJJRRRRRRRRRRRR))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
"ffffffffffff============yyyyyyyyyyyyJJJJJJJJJJJJRRRRRRRRRRRR))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
"ffffffffffff============yyyyyyyyyyyyJJJJJJJJJJJJRRRRRRRRRRRR))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
"ffffffffffff============yyyyyyyyyyyyJJJJJJJJJJJJRRRRRRRRRRRR))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
"ffffffffffff============yyyyyyyyyyyyJJJJJJJJJJJJRRRRRRRRRRRR))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
"ffffffffffff============yyyyyyyyyyyyJJJJJJJJJJJJRRRRRRRRRRRR))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
"ffffffffffff============yyyyyyyyyyyyJJJJJJJJJJJJRRRRRRRRRRRR))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
"gggggggggggg$$$$$$$$$$$$uuuuuuuuuuuuNNNNNNNNNNNN~~~~~~~~~~~~))))))))))))]]]]]]]]]]]]}}}}}}}}}}}}",
"gggggggggggg$$$$$$$$$$$$uuuuuuuuuuuuNNNNNNNNNNNN~~~~~~~~~~~~))))))))))))]]]]]]]]]]]]}}}}}}}}}}}}",
"gggggggggggg$$$$$$$$$$$$uuuuuuuuuuuuNNNNNNNNNNNN~~~~~~~~~~~~))))))))))))]]]]]]]]]]]]}}}}}}}}}}}}",
"gggggggggggg$$$$$$$$$$$$uuuuuuuuuuuuNNNNNNNNNNNN~~~~~~~~~~~~))))))))))))]]]]]]]]]]]]}}}}}}}}}}}}",
"gggggggggggg$$$$$$$$$$$$uuuuuuuuuuuuNNNNNNNNNNNN~~~~~~~~~~~~))))))))))))]]]]]]]]]]]]}}}}}}}}}}}}",
"gggggggggggg$$$$$$$$$$$$uuuuuuuuuuuuNNNNNNNNNNNN~~~~~~~~~~~~))))))))))))]]]]]]]]]]]]}}}}}}}}}}}}",
"gggggggggggg$$$$$$$$$$$$uuuuuuuuuuuuNNNNNNNNNNNN~~~~~~~~~~~~))))))))))))]]]]]]]]]]]]}}}}}}}}}}}}",
"gggggggggggg$$$$$$$$$$$$uuuuuuuuuuuuNNNNNNNNNNNN~~~~~~~~~~~~))))))))))))]]]]]]]]]]]]}}}}}}}}}}}}",
"gggggggggggg$$$$$$$$$$$$uuuuuuuuuuuuNNNNNNNNNNNN~~~~~~~~~~~~))))))))))))]]]]]]]]]]]]}}}}}}}}}}}}",
"gggggggggggg$$$$$$$$$$$$uuuuuuuuuuuuNNNNNNNNNNNN~~~~~~~~~~~~))))))))))))]]]]]]]]]]]]}}}}}}}}}}}}",
"gggggggggggg$$$$$$$$$$$$uuuuuuuuuuuuNNNNNNNNNNNN~~~~~~~~~~~~))))))))))))]]]]]]]]]]]]}}}}}}}}}}}}",
"gggggggggggg$$$$$$$$$$$$uuuuuuuuuuuuNNNNNNNNNNNN~~~~~~~~~~~~))))))))))))]]]]]]]]]]]]}}}}}}}}}}}}",
"::::::::::::hhhhhhhhhhhhddddddddddddAAAAAAAAAAAAUUUUUUUUUUUU))))))))))))''''''''''''}}}}}}}}}}}}",
"::::::::::::hhhhhhhhhhhhddddddddddddAAAAAAAAAAAAUUUUUUUUUUUU))))))))))))''''''''''''}}}}}}}}}}}}",
"::::::::::::hhhhhhhhhhhhddddddddddddAAAAAAAAAAAAUUUUUUUUUUUU))))))))))))''''''''''''}}}}}}}}}}}}",
"::::::::::::hhhhhhhhhhhhddddddddddddAAAAAAAAAAAAUUUUUUUUUUUU))))))))))))''''''''''''}}}}}}}}}}}}",
"::::::::::::hhhhhhhhhhhhddddddddddddAAAAAAAAAAAAUUUUUUUUUUUU))))))))))))''''''''''''}}}}}}}}}}}}",
"::::::::::::hhhhhhhhhhhhddddddddddddAAAAAAAAAAAAUUUUUUUUUUUU))))))))))))''''''''''''}}}}}}}}}}}}",
"::::::::::::hhhhhhhhhhhhddddddddddddAAAAAAAAAAAAUUUUUUUUUUUU))))))))))))''''''''''''}}}}}}}}}}}}",
"::::::::::::hhhhhhhhhhhhddddddddddddAAAAAAAAAAAAUUUUUUUUUUUU))))))))))))''''''''''''}}}}}}}}}}}}",
"::::::::::::hhhhhhhhhhhhddddddddddddAAAAAAAAAAAAUUUUUUUUUUUU))))))))))))''''''''''''}}}}}}}}}}}}",
"::::::::::::hhhhhhhhhhhhddddddddddddAAAAAAAAAAAAUUUUUUUUUUUU))))))))))))''''''''''''}}}}}}}}}}}}",
"::::::::::::hhhhhhhhhhhhddddddddddddAAAAAAAAAAAAUUUUUUUUUUUU))))))))))))''''''''''''}}}}}}}}}}}}",
"::::::::::::hhhhhhhhhhhhddddddddddddAAAAAAAAAAAAUUUUUUUUUUUU))))))))))))''''''''''''}}}}}}}}}}}}",
"zzzzzzzzzzzzGGGGGGGGGGGGBBBBBBBBBBBBDDDDDDDDDDDDPPPPPPPPPPPP))))))))))))''''''''''''{{{{{{{{{{{{",
"zzzzzzzzzzzzGGGGGGGGGGGGBBBBBBBBBBBBDDDDDDDDDDDDPPPPPPPPPPPP))))))))))))''''''''''''{{{{{{{{{{{{",
"zzzzzzzzzzzzGGGGGGGGGGGGBBBBBBBBBBBBDDDDDDDDDDDDPPPPPPPPPPPP))))))))))))''''''''''''{{{{{{{{{{{{",
"zzzzzzzzzzzzGGGGGGGGGGGGBBBBBBBBBBBBDDDDDDDDDDDDPPPPPPPPPPPP))))))))))))''''''''''''{{{{{{{{{{{{",
"zzzzzzzzzzzzGGGGGGGGGGGGBBBBBBBBBBBBDDDDDDDDDDDDPPPPPPPPPPPP))))))))))))''''''''''''{{{{{{{{{{{{",
"zzzzzzzzzzzzGGGGGGGGGGGGBBBBBBBBBBBBDDDDDDDDDDDDPPPPPPPPPPPP))))))))))))''''''''''''{{{{{{{{{{{{",
"zzzzzzzzzzzzGGGGGGGGGGGGBBBBBBBBBBBBDDDDDDDDDDDDPPPPPPPPPPPP))))))))))))''''''''''''{{{{{{{{{{{{",
"zzzzzzzzzzzzGGGGGGGGGGGGBBBBBBBBBBBBDDDDDDDDDDDDPPPPPPPPPPPP))))))))))))''''''''''''{{{{{{{{{{{{",
"zzzzzzzzzzzzGGGGGGGGGGGGBBBBBBBBBBBBDDDDDDDDDDDDPPPPPPPPPPPP))))))))))))''''''''''''{{{{{{{{{{{{",
"zzzzzzzzzzzzGGGGGGGGGGGGBBBBBBBBBBBBDDDDDDDDDDDDPPPPPPPPPPPP))))))))))))''''''''''''{{{{{{{{{{{{",
"zzzzzzzzzzzzGGGGGGGGGGGGBBBBBBBBBBBBDDDDDDDDDDDDPPPPPPPPPPPP))))))))))))''''''''''''{{{{{{{{{{{{",
"zzzzzzzzzzzzGGGGGGGGGGGGBBBBBBBBBBBBDDDDDDDDDDDDPPPPPPPPPPPP))))))))))))''''''''''''{{{{{{{{{{{{",
"ffffffffffffssssssssssssjjjjjjjjjjjjnnnnnnnnnnnnLLLLLLLLLLLL))))))))))))''''''''''''{{{{{{{{{{{{",
"ffffffffffffssssssssssssjjjjjjjjjjjjnnnnnnnnnnnnLLLLLLLLLLLL))))))))))))''''''''''''{{{{{{{{{{{{",
"ffffffffffffssssssssssssjjjjjjjjjjjjnnnnnnnnnnnnLLLLLLLLLLLL))))))))))))''''''''''''{{{{{{{{{{{{",
"ffffffffffffssssssssssssjjjjjjjjjjjjnnnnnnnnnnnnLLLLLLLLLLLL))))))))))))''''''''''''{{{{{{{{{{{{",
"ffffffffffffssssssssssssjjjjjjjjjjjjnnnnnnnnnnnnLLLLLLLLLLLL))))))))))))''''''''''''{{{{{{{{{{{{",
"ffffffffffffssssssssssssjjjjjjjjjjjjnnnnnnnnnnnnLLLLLLLLLLLL))))))))))))''''''''''''{{{{{{{{{{{{",
"ffffffffffffssssssssssssjjjjjjjjjjjjnnnnnnnnnnnnLLLLLLLLLLLL))))))))))))''''''''''''{{{{{{{{{{{{",
"ffffffffffffssssssssssssjjjjjjjjjjjjnnnnnnnnnnnnLLLLLLLLLLLL))))))))))))''''''''''''{{{{{{{{{{{{",
"ffffffffffffssssssssssssjjjjjjjjjjjjnnnnnnnnnnnnLLLLLLLLLLLL))))))))))))''''''''''''{{{{{{{{{{{{",
"ffffffffffffssssssssssssjjjjjjjjjjjjnnnnnnnnnnnnLLLLLLLLLLLL))))))))))))''''''''''''{{{{{{{{{{{{",
"ffffffffffffssssssssssssjjjjjjjjjjjjnnnnnnnnnnnnLLLLLLLLLLLL))))))))))))''''''''''''{{{{{{{{{{{{",
"ffffffffffffssssssssssssjjjjjjjjjjjjnnnnnnnnnnnnLLLLLLLLLLLL))))))))))))''''''''''''{{{{{{{{{{{{",
"wwwwwwwwwwww<<<<<<<<<<<<888888888888VVVVVVVVVVVV~~~~~~~~~~~~((((((((((((]]]]]]]]]]]]}}}}}}}}}}}}",
"wwwwwwwwwwww<<<<<<<<<<<<888888888888VVVVVVVVVVVV~~~~~~~~~~~~((((((((((((]]]]]]]]]]]]}}}}}}}}}}}}",
"wwwwwwwwwwww<<<<<<<<<<<<888888888888VVVVVVVVVVVV~~~~~~~~~~~~((((((((((((]]]]]]]]]]]]}}}}}}}}}}}}",
"wwwwwwwwwwww<<<<<<<<<<<<888888888888VVVVVVVVVVVV~~~~~~~~~~~~((((((((((((]]]]]]]]]]]]}}}}}}}}}}}}",
"wwwwwwwwwwww<<<<<<<<<<<<888888888888VVVVVVVVVVVV~~~~~~~~~~~~((((((((((((]]]]]]]]]]]]}}}}}}}}}}}}",
"wwwwwwwwwwww<<<<<<<<<<<<888888888888VVVVVVVVVVVV~~~~~~~~~~~~((((((((((((]]]]]]]]]]]]}}}}}}}}}}}}",
"wwwwwwwwwwww<<<<<<<<<<<<888888888888VVVVVVVVVVVV~~~~~~~~~~~~((((((((((((]]]]]]]]]]]]}}}}}}}}}}}}",
"wwwwwwwwwwww<<<<<<<<<<<<888888888888VVVVVVVVVVVV~~~~~~~~~~~~((((((((((((]]]]]]]]]]]]}}}}}}}}}}}}",
"wwwwwwwwwwww<<<<<<<<<<<<888888888888VVVVVVVVVVVV~~~~~~~~~~~~((((((((((((]]]]]]]]]]]]}}}}}}}}}}}}",
"wwwwwwwwwwww<<<<<<<<<<<<888888888888VVVVVVVVVVVV~~~~~~~~~~~~((((((((((((]]]]]]]]]]]]}}}}}}}}}}}}",
"wwwwwwwwwwww<<<<<<<<<<<<888888888888VVVVVVVVVVVV~~~~~~~~~~~~((((((((((((]]]]]]]]]]]]}}}}}}}}}}}}",
"wwwwwwwwwwww<<<<<<<<<<<<888888888888VVVVVVVVVVVV~~~~~~~~~~~~((((((((((((]]]]]]]]]]]]}}}}}}}}}}}}",
"hhhhhhhhhhhh>>>>>>>>>>>>rrrrrrrrrrrrVVVVVVVVVVVVLLLLLLLLLLLL))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
"hhhhhhhhhhhh>>>>>>>>>>>>rrrrrrrrrrrrVVVVVVVVVVVVLLLLLLLLLLLL))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
"hhhhhhhhhhhh>>>>>>>>>>>>rrrrrrrrrrrrVVVVVVVVVVVVLLLLLLLLLLLL))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
"hhhhhhhhhhhh>>>>>>>>>>>>rrrrrrrrrrrrVVVVVVVVVVVVLLLLLLLLLLLL))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
"hhhhhhhhhhhh>>>>>>>>>>>>rrrrrrrrrrrrVVVVVVVVVVVVLLLLLLLLLLLL))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
"hhhhhhhhhhhh>>>>>>>>>>>>rrrrrrrrrrrrVVVVVVVVVVVVLLLLLLLLLLLL))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
"hhhhhhhhhhhh>>>>>>>>>>>>rrrrrrrrrrrrVVVVVVVVVVVVLLLLLLLLLLLL))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
"hhhhhhhhhhhh>>>>>>>>>>>>rrrrrrrrrrrrVVVVVVVVVVVVLLLLLLLLLLLL))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
"hhhhhhhhhhhh>>>>>>>>>>>>rrrrrrrrrrrrVVVVVVVVVVVVLLLLLLLLLLLL))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
"hhhhhhhhhhhh>>>>>>>>>>>>rrrrrrrrrrrrVVVVVVVVVVVVLLLLLLLLLLLL))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
"hhhhhhhhhhhh>>>>>>>>>>>>rrrrrrrrrrrrVVVVVVVVVVVVLLLLLLLLLLLL))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
"hhhhhhhhhhhh>>>>>>>>>>>>rrrrrrrrrrrrVVVVVVVVVVVVLLLLLLLLLLLL))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
"::::::::::::;;;;;;;;;;;;HHHHHHHHHHHHccccccccccccQQQQQQQQQQQQ))))))))))))''''''''''''}}}}}}}}}}}}",
"::::::::::::;;;;;;;;;;;;HHHHHHHHHHHHccccccccccccQQQQQQQQQQQQ))))))))))))''''''''''''}}}}}}}}}}}}",
"::::::::::::;;;;;;;;;;;;HHHHHHHHHHHHccccccccccccQQQQQQQQQQQQ))))))))))))''''''''''''}}}}}}}}}}}}",
"::::::::::::;;;;;;;;;;;;HHHHHHHHHHHHccccccccccccQQQQQQQQQQQQ))))))))))))''''''''''''}}}}}}}}}}}}",
"::::::::::::;;;;;;;;;;;;HHHHHHHHHHHHccccccccccccQQQQQQQQQQQQ))))))))))))''''''''''''}}}}}}}}}}}}",
"::::::::::::;;;;;;;;;;;;HHHHHHHHHHHHccccccccccccQQQQQQQQQQQQ))))))))))))''''''''''''}}}}}}}}}}}}",
"::::::::::::;;;;;;;;;;;;HHHHHHHHHHHHccccccccccccQQQQQQQQQQQQ))))))))))))''''''''''''}}}}}}}}}}}}",
"::::::::::::;;;;;;;;;;;;HHHHHHHHHHHHccccccccccccQQQQQQQQQQQQ))))))))))))''''''''''''}}}}}}}}}}}}",
"::::::::::::;;;;;;;;;;;;HHHHHHHHHHHHccccccccccccQQQQQQQQQQQQ))))))))))))''''''''''''}}}}}}}}}}}}",
"::::::::::::;;;;;;;;;;;;HHHHHHHHHHHHccccccccccccQQQQQQQQQQQQ))))))))))))''''''''''''}}}}}}}}}}}}",
"::::::::::::;;;;;;;;;;;;HHHHHHHHHHHHccccccccccccQQQQQQQQQQQQ))))))))))))''''''''''''}}}}}}}}}}}}",
"::::::::::::;;;;;;;;;;;;HHHHHHHHHHHHccccccccccccQQQQQQQQQQQQ))))))))))))''''''''''''}}}}}}}}}}}}",
"qqqqqqqqqqqqkkkkkkkkkkkk333333333333AAAAAAAAAAAARRRRRRRRRRRR))))))))))))''''''''''''{{{{{{{{{{{{",
"qqqqqqqqqqqqkkkkkkkkkkkk333333333333AAAAAAAAAAAARRRRRRRRRRRR))))))))))))''''''''''''{{{{{{{{{{{{",
"qqqqqqqqqqqqkkkkkkkkkkkk333333333333AAAAAAAAAAAARRRRRRRRRRRR))))))))))))''''''''''''{{{{{{{{{{{{",
"qqqqqqqqqqqqkkkkkkkkkkkk333333333333AAAAAAAAAAAARRRRRRRRRRRR))))))))))))''''''''''''{{{{{{{{{{{{",
"qqqqqqqqqqqqkkkkkkkkkkkk333333333333AAAAAAAAAAAARRRRRRRRRRRR))))))))))))''''''''''''{{{{{{{{{{{{",
"qqqqqqqqqqqqkkkkkkkkkkkk333333333333AAAAAAAAAAAARRRRRRRRRRRR))))))))))))''''''''''''{{{{{{{{{{{{",
"qqqqqqqqqqqqkkkkkkkkkkkk333333333333AAAAAAAAAAAARRRRRRRRRRRR))))))))))))''''''''''''{{{{{{{{{{{{",
"qqqqqqqqqqqqkkkkkkkkkkkk333333333333AAAAAAAAAAAARRRRRRRRRRRR))))))))))))''''''''''''{{{{{{{{{{{{",
"qqqqqqqqqqqqkkkkkkkkkkkk333333333333AAAAAAAAAAAARRRRRRRRRRRR))))))))))))''''''''''''{{{{{{{{{{{{",
"qqqqqqqqqqqqkkkkkkkkkkkk333333333333AAAAAAAAAAAARRRRRRRRRRRR))))))))))))''''''''''''{{{{{{{{{{{{",
"qqqqqqqqqqqqkkkkkkkkkkkk333333333333AAAAAAAAAAAARRRRRRRRRRRR))))))))))))''''''''''''{{{{{{{{{{{{",
"qqqqqqqqqqqqkkkkkkkkkkkk333333333333AAAAAAAAAAAARRRRRRRRRRRR))))))))))))''''''''''''{{{{{{{{{{{{",
"############ppppppppppppssssssssssssIIIIIIIIIIII^^^^^^^^^^^^____________''''''''''''{{{{{{{{{{{{",
"############ppppppppppppssssssssssssIIIIIIIIIIII^^^^^^^^^^^^____________''''''''''''{{{{{{{{{{{{",
"############ppppppppppppssssssssssssIIIIIIIIIIII^^^^^^^^^^^^____________''''''''''''{{{{{{{{{{{{",
"############ppppppppppppssssssssssssIIIIIIIIIIII^^^^^^^^^^^^____________''''''''''''{{{{{{{{{{{{",
"############ppppppppppppssssssssssssIIIIIIIIIIII^^^^^^^^^^^^____________''''''''''''{{{{{{{{{{{{",
"############ppppppppppppssssssssssssIIIIIIIIIIII^^^^^^^^^^^^____________''''''''''''{{{{{{{{{{{{",
"############ppppppppppppssssssssssssIIIIIIIIIIII^^^^^^^^^^^^____________''''''''''''{{{{{{{{{{{{",
"############ppppppppppppssssssssssssIIIIIIIIIIII^^^^^^^^^^^^____________''''''''''''{{{{{{{{{{{{",
"############ppppppppppppssssssssssssIIIIIIIIIIII^^^^^^^^^^^^____________''''''''''''{{{{{{{{{{{{",
"############ppppppppppppssssssssssssIIIIIIIIIIII^^^^^^^^^^^^____________''''''''''''{{{{{{{{{{{{",
"############ppppppppppppssssssssssssIIIIIIIIIIII^^^^^^^^^^^^____________''''''''''''{{{{{{{{{{{{",
"############ppppppppppppssssssssssssIIIIIIIIIIII^^^^^^^^^^^^____________''''''''''''{{{{{{{{{{{{",
"++++++++++++rrrrrrrrrrrr777777777777MMMMMMMMMMMMIIIIIIIIIIII````````````''''''''''''{{{{{{{{{{{{",
"++++++++++++rrrrrrrrrrrr777777777777MMMMMMMMMMMMIIIIIIIIIIII````````````''''''''''''{{{{{{{{{{{{",
"++++++++++++rrrrrrrrrrrr777777777777MMMMMMMMMMMMIIIIIIIIIIII````````````''''''''''''{{{{{{{{{{{{",
"++++++++++++rrrrrrrrrrrr777777777777MMMMMMMMMMMMIIIIIIIIIIII````````````''''''''''''{{{{{{{{{{{{",
"++++++++++++rrrrrrrrrrrr777777777777MMMMMMMMMMMMIIIIIIIIIIII````````````''''''''''''{{{{{{{{{{{{",
"++++++++++++rrrrrrrrrrrr777777777777MMMMMMMMMMMMIIIIIIIIIIII````````````''''''''''''{{{{{{{{{{{{",
"++++++++++++rrrrrrrrrrrr777777777777MMMMMMMMMMMMIIIIIIIIIIII````````````''''''''''''{{{{{{{{{{{{",
"++++++++++++rrrrrrrrrrrr777777777777MMMMMMMMMMMMIIIIIIIIIIII````````````''''''''''''{{{{{{{{{{{{",
"++++++++++++rrrrrrrrrrrr777777777777MMMMMMMMMMMMIIIIIIIIIIII````````````''''''''''''{{{{{{{{{{{{",
"++++++++++++rrrrrrrrrrrr777777777777MMMMMMMMMMMMIIIIIIIIIIII````````````''''''''''''{{{{{{{{{{{{",
"++++++++++++rrrrrrrrrrrr777777777777MMMMMMMMMMMMIIIIIIIIIIII````````````''''''''''''{{{{{{{{{{{{",
"++++++++++++rrrrrrrrrrrr777777777777MMMMMMMMMMMMIIIIIIIIIIII````````````''''''''''''{{{{{{{{{{{{",
"------------$$$$$$$$$$$$999999999999JJJJJJJJJJJJTTTTTTTTTTTT____________]]]]]]]]]]]]{{{{{{{{{{{{",
"------------$$$$$$$$$$$$999999999999JJJJJJJJJJJJTTTTTTTTTTTT____________]]]]]]]]]]]]{{{{{{{{{{{{",
"------------$$$$$$$$$$$$999999999999JJJJJJJJJJJJTTTTTTTTTTTT____________]]]]]]]]]]]]{{{{{{{{{{{{",
"------------$$$$$$$$$$$$999999999999JJJJJJJJJJJJTTTTTTTTTTTT____________]]]]]]]]]]]]{{{{{{{{{{{{",
"------------$$$$$$$$$$$$999999999999JJJJJJJJJJJJTTTTTTTTTTTT____________]]]]]]]]]]]]{{{{{{{{{{{{",
"------------$$$$$$$$$$$$999999999999JJJJJJJJJJJJTTTTTTTTTTTT____________]]]]]]]]]]]]{{{{{{{{{{{{",
"------------$$$$$$$$$$$$999999999999JJJJJJJJJJJJTTTTTTTTTTTT____________]]]]]]]]]]]]{{{{{{{{{{{{",
"------------$$$$$$$$$$$$999999999999JJJJJJJJJJJJTTTTTTTTTTTT____________]]]]]]]]]]]]{{{{{{{{{{{{",
"------------$$$$$$$$$$$$999999999999JJJJJJJJJJJJTTTTTTTTTTTT____________]]]]]]]]]]]]{{{{{{{{{{{{",
"------------$$$$$$$$$$$$999999999999JJJJJJJJJJJJTTTTTTTTTTTT____________]]]]]]]]]]]]{{{{{{{{{{{{",
"------------$$$$$$$$$$$$999999999999JJJJJJJJJJJJTTTTTTTTTTTT____________]]]]]]]]]]]]{{{{{{{{{{{{",
"------------$$$$$$$$$$$$999999999999JJJJJJJJJJJJTTTTTTTTTTTT____________]]]]]]]]]]]]{{{{{{{{{{{{",
"@@@@@@@@@@@@666666666666ttttttttttttWWWWWWWWWWWWPPPPPPPPPPPP))))))))))))''''''''''''{{{{{{{{{{{{",
"@@@@@@@@@@@@666666666666ttttttttttttWWWWWWWWWWWWPPPPPPPPPPPP))))))))))))''''''''''''{{{{{{{{{{{{",
"@@@@@@@@@@@@666666666666ttttttttttttWWWWWWWWWWWWPPPPPPPPPPPP))))))))))))''''''''''''{{{{{{{{{{{{",
"@@@@@@@@@@@@666666666666ttttttttttttWWWWWWWWWWWWPPPPPPPPPPPP))))))))))))''''''''''''{{{{{{{{{{{{",
"@@@@@@@@@@@@666666666666ttttttttttttWWWWWWWWWWWWPPPPPPPPPPPP))))))))))))''''''''''''{{{{{{{{{{{{",
"@@@@@@@@@@@@666666666666ttttttttttttWWWWWWWWWWWWPPPPPPPPPPPP))))))))))))''''''''''''{{{{{{{{{{{{",
"@@@@@@@@@@@@666666666666ttttttttttttWWWWWWWWWWWWPPPPPPPPPPPP))))))))))))''''''''''''{{{{{{{{{{{{",
"@@@@@@@@@@@@666666666666ttttttttttttWWWWWWWWWWWWPPPPPPPPPPPP))))))))))))''''''''''''{{{{{{{{{{{{",
"@@@@@@@@@@@@666666666666ttttttttttttWWWWWWWWWWWWPPPPPPPPPPPP))))))))))))''''''''''''{{{{{{{{{{{{",
"@@@@@@@@@@@@666666666666ttttttttttttWWWWWWWWWWWWPPPPPPPPPPPP))))))))))))''''''''''''{{{{{{{{{{{{",
"@@@@@@@@@@@@666666666666ttttttttttttWWWWWWWWWWWWPPPPPPPPPPPP))))))))))))''''''''''''{{{{{{{{{{{{",
"@@@@@@@@@@@@666666666666ttttttttttttWWWWWWWWWWWWPPPPPPPPPPPP))))))))))))''''''''''''{{{{{{{{{{{{",
"aaaaaaaaaaaazzzzzzzzzzzzBBBBBBBBBBBBbbbbbbbbbbbbPPPPPPPPPPPP____________''''''''''''{{{{{{{{{{{{",
"aaaaaaaaaaaazzzzzzzzzzzzBBBBBBBBBBBBbbbbbbbbbbbbPPPPPPPPPPPP____________''''''''''''{{{{{{{{{{{{",
"aaaaaaaaaaaazzzzzzzzzzzzBBBBBBBBBBBBbbbbbbbbbbbbPPPPPPPPPPPP____________''''''''''''{{{{{{{{{{{{",
"aaaaaaaaaaaazzzzzzzzzzzzBBBBBBBBBBBBbbbbbbbbbbbbPPPPPPPPPPPP____________''''''''''''{{{{{{{{{{{{",
"aaaaaaaaaaaazzzzzzzzzzzzBBBBBBBBBBBBbbbbbbbbbbbbPPPPPPPPPPPP____________''''''''''''{{{{{{{{{{{{",
"aaaaaaaaaaaazzzzzzzzzzzzBBBBBBBBBBBBbbbbbbbbbbbbPPPPPPPPPPPP____________''''''''''''{{{{{{{{{{{{",
"aaaaaaaaaaaazzzzzzzzzzzzBBBBBBBBBBBBbbbbbbbbbbbbPPPPPPPPPPPP____________''''''''''''{{{{{{{{{{{{",
"aaaaaaaaaaaazzzzzzzzzzzzBBBBBBBBBBBBbbbbbbbbbbbbPPPPPPPPPPPP____________''''''''''''{{{{{{{{{{{{",
"aaaaaaaaaaaazzzzzzzzzzzzBBBBBBBBBBBBbbbbbbbbbbbbPPPPPPPPPPPP____________''''''''''''{{{{{{{{{{{{",
"aaaaaaaaaaaazzzzzzzzzzzzBBBBBBBBBBBBbbbbbbbbbbbbPPPPPPPPPPPP____________''''''''''''{{{{{{{{{{{{",
"aaaaaaaaaaaazzzzzzzzzzzzBBBBBBBBBBBBbbbbbbbbbbbbPPPPPPPPPPPP____________''''''''''''{{{{{{{{{{{{",
"aaaaaaaaaaaazzzzzzzzzzzzBBBBBBBBBBBBbbbbbbbbbbbbPPPPPPPPPPPP____________''''''''''''{{{{{{{{{{{{",
"------------%%%%%%%%%%%%ttttttttttttNNNNNNNNNNNN^^^^^^^^^^^^))))))))))))''''''''''''}}}}}}}}}}}}",
"------------%%%%%%%%%%%%ttttttttttttNNNNNNNNNNNN^^^^^^^^^^^^))))))))))))''''''''''''}}}}}}}}}}}}",
"------------%%%%%%%%%%%%ttttttttttttNNNNNNNNNNNN^^^^^^^^^^^^))))))))))))''''''''''''}}}}}}}}}}}}",
"------------%%%%%%%%%%%%ttttttttttttNNNNNNNNNNNN^^^^^^^^^^^^))))))))))))''''''''''''}}}}}}}}}}}}",
"------------%%%%%%%%%%%%ttttttttttttNNNNNNNNNNNN^^^^^^^^^^^^))))))))))))''''''''''''}}}}}}}}}}}}",
"------------%%%%%%%%%%%%ttttttttttttNNNNNNNNNNNN^^^^^^^^^^^^))))))))))))''''''''''''}}}}}}}}}}}}",
"------------%%%%%%%%%%%%ttttttttttttNNNNNNNNNNNN^^^^^^^^^^^^))))))))))))''''''''''''}}}}}}}}}}}}",
"------------%%%%%%%%%%%%ttttttttttttNNNNNNNNNNNN^^^^^^^^^^^^))))))))))))''''''''''''}}}}}}}}}}}}",
"------------%%%%%%%%%%%%ttttttttttttNNNNNNNNNNNN^^^^^^^^^^^^))))))))))))''''''''''''}}}}}}}}}}}}",
"------------%%%%%%%%%%%%ttttttttttttNNNNNNNNNNNN^^^^^^^^^^^^))))))))))))''''''''''''}}}}}}}}}}}}",
"------------%%%%%%%%%%%%ttttttttttttNNNNNNNNNNNN^^^^^^^^^^^^))))))))))))''''''''''''}}}}}}}}}}}}",
"------------%%%%%%%%%%%%ttttttttttttNNNNNNNNNNNN^^^^^^^^^^^^))))))))))))''''''''''''}}}}}}}}}}}}",
" 000000000000888888888888FFFFFFFFFFFF~~~~~~~~~~~~))))))))))))''''''''''''}}}}}}}}}}}}",
" 000000000000888888888888FFFFFFFFFFFF~~~~~~~~~~~~))))))))))))''''''''''''}}}}}}}}}}}}",
" 000000000000888888888888FFFFFFFFFFFF~~~~~~~~~~~~))))))))))))''''''''''''}}}}}}}}}}}}",
" 000000000000888888888888FFFFFFFFFFFF~~~~~~~~~~~~))))))))))))''''''''''''}}}}}}}}}}}}",
" 000000000000888888888888FFFFFFFFFFFF~~~~~~~~~~~~))))))))))))''''''''''''}}}}}}}}}}}}",
" 000000000000888888888888FFFFFFFFFFFF~~~~~~~~~~~~))))))))))))''''''''''''}}}}}}}}}}}}",
" 000000000000888888888888FFFFFFFFFFFF~~~~~~~~~~~~))))))))))))''''''''''''}}}}}}}}}}}}",
" 000000000000888888888888FFFFFFFFFFFF~~~~~~~~~~~~))))))))))))''''''''''''}}}}}}}}}}}}",
" 000000000000888888888888FFFFFFFFFFFF~~~~~~~~~~~~))))))))))))''''''''''''}}}}}}}}}}}}",
" 000000000000888888888888FFFFFFFFFFFF~~~~~~~~~~~~))))))))))))''''''''''''}}}}}}}}}}}}",
" 000000000000888888888888FFFFFFFFFFFF~~~~~~~~~~~~))))))))))))''''''''''''}}}}}}}}}}}}",
" 000000000000888888888888FFFFFFFFFFFF~~~~~~~~~~~~))))))))))))''''''''''''}}}}}}}}}}}}",
"++++++++++++222222222222xxxxxxxxxxxxNNNNNNNNNNNNEEEEEEEEEEEE))))))))))))''''''''''''}}}}}}}}}}}}",
"++++++++++++222222222222xxxxxxxxxxxxNNNNNNNNNNNNEEEEEEEEEEEE))))))))))))''''''''''''}}}}}}}}}}}}",
"++++++++++++222222222222xxxxxxxxxxxxNNNNNNNNNNNNEEEEEEEEEEEE))))))))))))''''''''''''}}}}}}}}}}}}",
"++++++++++++222222222222xxxxxxxxxxxxNNNNNNNNNNNNEEEEEEEEEEEE))))))))))))''''''''''''}}}}}}}}}}}}",
"++++++++++++222222222222xxxxxxxxxxxxNNNNNNNNNNNNEEEEEEEEEEEE))))))))))))''''''''''''}}}}}}}}}}}}",
"++++++++++++222222222222xxxxxxxxxxxxNNNNNNNNNNNNEEEEEEEEEEEE))))))))))))''''''''''''}}}}}}}}}}}}",
"++++++++++++222222222222xxxxxxxxxxxxNNNNNNNNNNNNEEEEEEEEEEEE))))))))))))''''''''''''}}}}}}}}}}}}",
"++++++++++++222222222222xxxxxxxxxxxxNNNNNNNNNNNNEEEEEEEEEEEE))))))))))))''''''''''''}}}}}}}}}}}}",
"++++++++++++222222222222xxxxxxxxxxxxNNNNNNNNNNNNEEEEEEEEEEEE))))))))))))''''''''''''}}}}}}}}}}}}",
"++++++++++++222222222222xxxxxxxxxxxxNNNNNNNNNNNNEEEEEEEEEEEE))))))))))))''''''''''''}}}}}}}}}}}}",
"++++++++++++222222222222xxxxxxxxxxxxNNNNNNNNNNNNEEEEEEEEEEEE))))))))))))''''''''''''}}}}}}}}}}}}",
"++++++++++++222222222222xxxxxxxxxxxxNNNNNNNNNNNNEEEEEEEEEEEE))))))))))))''''''''''''}}}}}}}}}}}}",
"$$$$$$$$$$$$000000000000GGGGGGGGGGGGnnnnnnnnnnnnLLLLLLLLLLLL))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
"$$$$$$$$$$$$000000000000GGGGGGGGGGGGnnnnnnnnnnnnLLLLLLLLLLLL))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
"$$$$$$$$$$$$000000000000GGGGGGGGGGGGnnnnnnnnnnnnLLLLLLLLLLLL))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
"$$$$$$$$$$$$000000000000GGGGGGGGGGGGnnnnnnnnnnnnLLLLLLLLLLLL))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
"$$$$$$$$$$$$000000000000GGGGGGGGGGGGnnnnnnnnnnnnLLLLLLLLLLLL))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
"$$$$$$$$$$$$000000000000GGGGGGGGGGGGnnnnnnnnnnnnLLLLLLLLLLLL))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
"$$$$$$$$$$$$000000000000GGGGGGGGGGGGnnnnnnnnnnnnLLLLLLLLLLLL))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
"$$$$$$$$$$$$000000000000GGGGGGGGGGGGnnnnnnnnnnnnLLLLLLLLLLLL))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
"$$$$$$$$$$$$000000000000GGGGGGGGGGGGnnnnnnnnnnnnLLLLLLLLLLLL))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
"$$$$$$$$$$$$000000000000GGGGGGGGGGGGnnnnnnnnnnnnLLLLLLLLLLLL))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
"$$$$$$$$$$$$000000000000GGGGGGGGGGGGnnnnnnnnnnnnLLLLLLLLLLLL))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
"$$$$$$$$$$$$000000000000GGGGGGGGGGGGnnnnnnnnnnnnLLLLLLLLLLLL))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
"ooooooooooooffffffffffffccccccccccccbbbbbbbbbbbbRRRRRRRRRRRR____________''''''''''''{{{{{{{{{{{{",
"ooooooooooooffffffffffffccccccccccccbbbbbbbbbbbbRRRRRRRRRRRR____________''''''''''''{{{{{{{{{{{{",
"ooooooooooooffffffffffffccccccccccccbbbbbbbbbbbbRRRRRRRRRRRR____________''''''''''''{{{{{{{{{{{{",
"ooooooooooooffffffffffffccccccccccccbbbbbbbbbbbbRRRRRRRRRRRR____________''''''''''''{{{{{{{{{{{{",
"ooooooooooooffffffffffffccccccccccccbbbbbbbbbbbbRRRRRRRRRRRR____________''''''''''''{{{{{{{{{{{{",
"ooooooooooooffffffffffffccccccccccccbbbbbbbbbbbbRRRRRRRRRRRR____________''''''''''''{{{{{{{{{{{{",
"ooooooooooooffffffffffffccccccccccccbbbbbbbbbbbbRRRRRRRRRRRR____________''''''''''''{{{{{{{{{{{{",
"ooooooooooooffffffffffffccccccccccccbbbbbbbbbbbbRRRRRRRRRRRR____________''''''''''''{{{{{{{{{{{{",
"ooooooooooooffffffffffffccccccccccccbbbbbbbbbbbbRRRRRRRRRRRR____________''''''''''''{{{{{{{{{{{{",
"ooooooooooooffffffffffffccccccccccccbbbbbbbbbbbbRRRRRRRRRRRR____________''''''''''''{{{{{{{{{{{{",
"ooooooooooooffffffffffffccccccccccccbbbbbbbbbbbbRRRRRRRRRRRR____________''''''''''''{{{{{{{{{{{{",
"ooooooooooooffffffffffffccccccccccccbbbbbbbbbbbbRRRRRRRRRRRR____________''''''''''''{{{{{{{{{{{{",
"@@@@@@@@@@@@111111111111777777777777JJJJJJJJJJJJPPPPPPPPPPPP((((((((((((''''''''''''{{{{{{{{{{{{",
"@@@@@@@@@@@@111111111111777777777777JJJJJJJJJJJJPPPPPPPPPPPP((((((((((((''''''''''''{{{{{{{{{{{{",
"@@@@@@@@@@@@111111111111777777777777JJJJJJJJJJJJPPPPPPPPPPPP((((((((((((''''''''''''{{{{{{{{{{{{",
"@@@@@@@@@@@@111111111111777777777777JJJJJJJJJJJJPPPPPPPPPPPP((((((((((((''''''''''''{{{{{{{{{{{{",
"@@@@@@@@@@@@111111111111777777777777JJJJJJJJJJJJPPPPPPPPPPPP((((((((((((''''''''''''{{{{{{{{{{{{",
"@@@@@@@@@@@@111111111111777777777777JJJJJJJJJJJJPPPPPPPPPPPP((((((((((((''''''''''''{{{{{{{{{{{{",
"@@@@@@@@@@@@111111111111777777777777JJJJJJJJJJJJPPPPPPPPPPPP((((((((((((''''''''''''{{{{{{{{{{{{",
"@@@@@@@@@@@@111111111111777777777777JJJJJJJJJJJJPPPPPPPPPPPP((((((((((((''''''''''''{{{{{{{{{{{{",
"@@@@@@@@@@@@111111111111777777777777JJJJJJJJJJJJPPPPPPPPPPPP((((((((((((''''''''''''{{{{{{{{{{{{",
"@@@@@@@@@@@@111111111111777777777777JJJJJJJJJJJJPPPPPPPPPPPP((((((((((((''''''''''''{{{{{{{{{{{{",
"@@@@@@@@@@@@111111111111777777777777JJJJJJJJJJJJPPPPPPPPPPPP((((((((((((''''''''''''{{{{{{{{{{{{",
"@@@@@@@@@@@@111111111111777777777777JJJJJJJJJJJJPPPPPPPPPPPP((((((((((((''''''''''''{{{{{{{{{{{{",
" iiiiiiiiiiiiGGGGGGGGGGGGVVVVVVVVVVVV~~~~~~~~~~~~____________''''''''''''}}}}}}}}}}}}",
" iiiiiiiiiiiiGGGGGGGGGGGGVVVVVVVVVVVV~~~~~~~~~~~~____________''''''''''''}}}}}}}}}}}}",
" iiiiiiiiiiiiGGGGGGGGGGGGVVVVVVVVVVVV~~~~~~~~~~~~____________''''''''''''}}}}}}}}}}}}",
" iiiiiiiiiiiiGGGGGGGGGGGGVVVVVVVVVVVV~~~~~~~~~~~~____________''''''''''''}}}}}}}}}}}}",
" iiiiiiiiiiiiGGGGGGGGGGGGVVVVVVVVVVVV~~~~~~~~~~~~____________''''''''''''}}}}}}}}}}}}",
" iiiiiiiiiiiiGGGGGGGGGGGGVVVVVVVVVVVV~~~~~~~~~~~~____________''''''''''''}}}}}}}}}}}}",
" iiiiiiiiiiiiGGGGGGGGGGGGVVVVVVVVVVVV~~~~~~~~~~~~____________''''''''''''}}}}}}}}}}}}",
" iiiiiiiiiiiiGGGGGGGGGGGGVVVVVVVVVVVV~~~~~~~~~~~~____________''''''''''''}}}}}}}}}}}}",
" iiiiiiiiiiiiGGGGGGGGGGGGVVVVVVVVVVVV~~~~~~~~~~~~____________''''''''''''}}}}}}}}}}}}",
" iiiiiiiiiiiiGGGGGGGGGGGGVVVVVVVVVVVV~~~~~~~~~~~~____________''''''''''''}}}}}}}}}}}}",
" iiiiiiiiiiiiGGGGGGGGGGGGVVVVVVVVVVVV~~~~~~~~~~~~____________''''''''''''}}}}}}}}}}}}",
" iiiiiiiiiiiiGGGGGGGGGGGGVVVVVVVVVVVV~~~~~~~~~~~~____________''''''''''''}}}}}}}}}}}}",
"------------222222222222KKKKKKKKKKKKIIIIIIIIIIIIQQQQQQQQQQQQ____________''''''''''''{{{{{{{{{{{{",
"------------222222222222KKKKKKKKKKKKIIIIIIIIIIIIQQQQQQQQQQQQ____________''''''''''''{{{{{{{{{{{{",
"------------222222222222KKKKKKKKKKKKIIIIIIIIIIIIQQQQQQQQQQQQ____________''''''''''''{{{{{{{{{{{{",
"------------222222222222KKKKKKKKKKKKIIIIIIIIIIIIQQQQQQQQQQQQ____________''''''''''''{{{{{{{{{{{{",
"------------222222222222KKKKKKKKKKKKIIIIIIIIIIIIQQQQQQQQQQQQ____________''''''''''''{{{{{{{{{{{{",
"------------222222222222KKKKKKKKKKKKIIIIIIIIIIIIQQQQQQQQQQQQ____________''''''''''''{{{{{{{{{{{{",
"------------222222222222KKKKKKKKKKKKIIIIIIIIIIIIQQQQQQQQQQQQ____________''''''''''''{{{{{{{{{{{{",
"------------222222222222KKKKKKKKKKKKIIIIIIIIIIIIQQQQQQQQQQQQ____________''''''''''''{{{{{{{{{{{{",
"------------222222222222KKKKKKKKKKKKIIIIIIIIIIIIQQQQQQQQQQQQ____________''''''''''''{{{{{{{{{{{{",
"------------222222222222KKKKKKKKKKKKIIIIIIIIIIIIQQQQQQQQQQQQ____________''''''''''''{{{{{{{{{{{{",
"------------222222222222KKKKKKKKKKKKIIIIIIIIIIIIQQQQQQQQQQQQ____________''''''''''''{{{{{{{{{{{{",
"------------222222222222KKKKKKKKKKKKIIIIIIIIIIIIQQQQQQQQQQQQ____________''''''''''''{{{{{{{{{{{{",
"&&&&&&&&&&&&222222222222333333333333WWWWWWWWWWWW~~~~~~~~~~~~____________''''''''''''{{{{{{{{{{{{",
"&&&&&&&&&&&&222222222222333333333333WWWWWWWWWWWW~~~~~~~~~~~~____________''''''''''''{{{{{{{{{{{{",
"&&&&&&&&&&&&222222222222333333333333WWWWWWWWWWWW~~~~~~~~~~~~____________''''''''''''{{{{{{{{{{{{",
"&&&&&&&&&&&&222222222222333333333333WWWWWWWWWWWW~~~~~~~~~~~~____________''''''''''''{{{{{{{{{{{{",
"&&&&&&&&&&&&222222222222333333333333WWWWWWWWWWWW~~~~~~~~~~~~____________''''''''''''{{{{{{{{{{{{",
"&&&&&&&&&&&&222222222222333333333333WWWWWWWWWWWW~~~~~~~~~~~~____________''''''''''''{{{{{{{{{{{{",
"&&&&&&&&&&&&222222222222333333333333WWWWWWWWWWWW~~~~~~~~~~~~____________''''''''''''{{{{{{{{{{{{",
"&&&&&&&&&&&&222222222222333333333333WWWWWWWWWWWW~~~~~~~~~~~~____________''''''''''''{{{{{{{{{{{{",
"&&&&&&&&&&&&222222222222333333333333WWWWWWWWWWWW~~~~~~~~~~~~____________''''''''''''{{{{{{{{{{{{",
"&&&&&&&&&&&&222222222222333333333333WWWWWWWWWWWW~~~~~~~~~~~~____________''''''''''''{{{{{{{{{{{{",
"&&&&&&&&&&&&222222222222333333333333WWWWWWWWWWWW~~~~~~~~~~~~____________''''''''''''{{{{{{{{{{{{",
"&&&&&&&&&&&&222222222222333333333333WWWWWWWWWWWW~~~~~~~~~~~~____________''''''''''''{{{{{{{{{{{{",
"wwwwwwwwwwww============555555555555EEEEEEEEEEEEEEEEEEEEEEEE____________''''''''''''||||||||||||",
"wwwwwwwwwwww============555555555555EEEEEEEEEEEEEEEEEEEEEEEE____________''''''''''''||||||||||||",
"wwwwwwwwwwww============555555555555EEEEEEEEEEEEEEEEEEEEEEEE____________''''''''''''||||||||||||",
"wwwwwwwwwwww============555555555555EEEEEEEEEEEEEEEEEEEEEEEE____________''''''''''''||||||||||||",
"wwwwwwwwwwww============555555555555EEEEEEEEEEEEEEEEEEEEEEEE____________''''''''''''||||||||||||",
"wwwwwwwwwwww============555555555555EEEEEEEEEEEEEEEEEEEEEEEE____________''''''''''''||||||||||||",
"wwwwwwwwwwww============555555555555EEEEEEEEEEEEEEEEEEEEEEEE____________''''''''''''||||||||||||",
"wwwwwwwwwwww============555555555555EEEEEEEEEEEEEEEEEEEEEEEE____________''''''''''''||||||||||||",
"wwwwwwwwwwww============555555555555EEEEEEEEEEEEEEEEEEEEEEEE____________''''''''''''||||||||||||",
"wwwwwwwwwwww============555555555555EEEEEEEEEEEEEEEEEEEEEEEE____________''''''''''''||||||||||||",
"wwwwwwwwwwww============555555555555EEEEEEEEEEEEEEEEEEEEEEEE____________''''''''''''||||||||||||",
"wwwwwwwwwwww============555555555555EEEEEEEEEEEEEEEEEEEEEEEE____________''''''''''''||||||||||||",
"ffffffffffff>>>>>>>>>>>>rrrrrrrrrrrrnnnnnnnnnnnn~~~~~~~~~~~~____________]]]]]]]]]]]]{{{{{{{{{{{{",
"ffffffffffff>>>>>>>>>>>>rrrrrrrrrrrrnnnnnnnnnnnn~~~~~~~~~~~~____________]]]]]]]]]]]]{{{{{{{{{{{{",
"ffffffffffff>>>>>>>>>>>>rrrrrrrrrrrrnnnnnnnnnnnn~~~~~~~~~~~~____________]]]]]]]]]]]]{{{{{{{{{{{{",
"ffffffffffff>>>>>>>>>>>>rrrrrrrrrrrrnnnnnnnnnnnn~~~~~~~~~~~~____________]]]]]]]]]]]]{{{{{{{{{{{{",
"ffffffffffff>>>>>>>>>>>>rrrrrrrrrrrrnnnnnnnnnnnn~~~~~~~~~~~~____________]]]]]]]]]]]]{{{{{{{{{{{{",
"ffffffffffff>>>>>>>>>>>>rrrrrrrrrrrrnnnnnnnnnnnn~~~~~~~~~~~~____________]]]]]]]]]]]]{{{{{{{{{{{{",
"ffffffffffff>>>>>>>>>>>>rrrrrrrrrrrrnnnnnnnnnnnn~~~~~~~~~~~~____________]]]]]]]]]]]]{{{{{{{{{{{{",
"ffffffffffff>>>>>>>>>>>>rrrrrrrrrrrrnnnnnnnnnnnn~~~~~~~~~~~~____________]]]]]]]]]]]]{{{{{{{{{{{{",
"ffffffffffff>>>>>>>>>>>>rrrrrrrrrrrrnnnnnnnnnnnn~~~~~~~~~~~~____________]]]]]]]]]]]]{{{{{{{{{{{{",
"ffffffffffff>>>>>>>>>>>>rrrrrrrrrrrrnnnnnnnnnnnn~~~~~~~~~~~~____________]]]]]]]]]]]]{{{{{{{{{{{{",
"ffffffffffff>>>>>>>>>>>>rrrrrrrrrrrrnnnnnnnnnnnn~~~~~~~~~~~~____________]]]]]]]]]]]]{{{{{{{{{{{{",
"ffffffffffff>>>>>>>>>>>>rrrrrrrrrrrrnnnnnnnnnnnn~~~~~~~~~~~~____________]]]]]]]]]]]]{{{{{{{{{{{{",
"############$$$$$$$$$$$$CCCCCCCCCCCCEEEEEEEEEEEE(((((((((((())))))))))))''''''''''''}}}}}}}}}}}}",
"############$$$$$$$$$$$$CCCCCCCCCCCCEEEEEEEEEEEE(((((((((((())))))))))))''''''''''''}}}}}}}}}}}}",
"############$$$$$$$$$$$$CCCCCCCCCCCCEEEEEEEEEEEE(((((((((((())))))))))))''''''''''''}}}}}}}}}}}}",
"############$$$$$$$$$$$$CCCCCCCCCCCCEEEEEEEEEEEE(((((((((((())))))))))))''''''''''''}}}}}}}}}}}}",
"############$$$$$$$$$$$$CCCCCCCCCCCCEEEEEEEEEEEE(((((((((((())))))))))))''''''''''''}}}}}}}}}}}}",
"############$$$$$$$$$$$$CCCCCCCCCCCCEEEEEEEEEEEE(((((((((((())))))))))))''''''''''''}}}}}}}}}}}}",
"############$$$$$$$$$$$$CCCCCCCCCCCCEEEEEEEEEEEE(((((((((((())))))))))))''''''''''''}}}}}}}}}}}}",
"############$$$$$$$$$$$$CCCCCCCCCCCCEEEEEEEEEEEE(((((((((((())))))))))))''''''''''''}}}}}}}}}}}}",
"############$$$$$$$$$$$$CCCCCCCCCCCCEEEEEEEEEEEE(((((((((((())))))))))))''''''''''''}}}}}}}}}}}}",
"############$$$$$$$$$$$$CCCCCCCCCCCCEEEEEEEEEEEE(((((((((((())))))))))))''''''''''''}}}}}}}}}}}}",
"############$$$$$$$$$$$$CCCCCCCCCCCCEEEEEEEEEEEE(((((((((((())))))))))))''''''''''''}}}}}}}}}}}}",
"############$$$$$$$$$$$$CCCCCCCCCCCCEEEEEEEEEEEE(((((((((((())))))))))))''''''''''''}}}}}}}}}}}}",
",,,,,,,,,,,,666666666666ddddddddddddHHHHHHHHHHHHEEEEEEEEEEEE____________]]]]]]]]]]]]{{{{{{{{{{{{",
",,,,,,,,,,,,666666666666ddddddddddddHHHHHHHHHHHHEEEEEEEEEEEE____________]]]]]]]]]]]]{{{{{{{{{{{{",
",,,,,,,,,,,,666666666666ddddddddddddHHHHHHHHHHHHEEEEEEEEEEEE____________]]]]]]]]]]]]{{{{{{{{{{{{",
",,,,,,,,,,,,666666666666ddddddddddddHHHHHHHHHHHHEEEEEEEEEEEE____________]]]]]]]]]]]]{{{{{{{{{{{{",
",,,,,,,,,,,,666666666666ddddddddddddHHHHHHHHHHHHEEEEEEEEEEEE____________]]]]]]]]]]]]{{{{{{{{{{{{",
",,,,,,,,,,,,666666666666ddddddddddddHHHHHHHHHHHHEEEEEEEEEEEE____________]]]]]]]]]]]]{{{{{{{{{{{{",
",,,,,,,,,,,,666666666666ddddddddddddHHHHHHHHHHHHEEEEEEEEEEEE____________]]]]]]]]]]]]{{{{{{{{{{{{",
",,,,,,,,,,,,666666666666ddddddddddddHHHHHHHHHHHHEEEEEEEEEEEE____________]]]]]]]]]]]]{{{{{{{{{{{{",
",,,,,,,,,,,,666666666666ddddddddddddHHHHHHHHHHHHEEEEEEEEEEEE____________]]]]]]]]]]]]{{{{{{{{{{{{",
",,,,,,,,,,,,666666666666ddddddddddddHHHHHHHHHHHHEEEEEEEEEEEE____________]]]]]]]]]]]]{{{{{{{{{{{{",
",,,,,,,,,,,,666666666666ddddddddddddHHHHHHHHHHHHEEEEEEEEEEEE____________]]]]]]]]]]]]{{{{{{{{{{{{",
",,,,,,,,,,,,666666666666ddddddddddddHHHHHHHHHHHHEEEEEEEEEEEE____________]]]]]]]]]]]]{{{{{{{{{{{{",
"xxxxxxxxxxxxjjjjjjjjjjjjccccccccccccSSSSSSSSSSSSPPPPPPPPPPPP))))))))))))]]]]]]]]]]]]}}}}}}}}}}}}",
"xxxxxxxxxxxxjjjjjjjjjjjjccccccccccccSSSSSSSSSSSSPPPPPPPPPPPP))))))))))))]]]]]]]]]]]]}}}}}}}}}}}}",
"xxxxxxxxxxxxjjjjjjjjjjjjccccccccccccSSSSSSSSSSSSPPPPPPPPPPPP))))))))))))]]]]]]]]]]]]}}}}}}}}}}}}",
"xxxxxxxxxxxxjjjjjjjjjjjjccccccccccccSSSSSSSSSSSSPPPPPPPPPPPP))))))))))))]]]]]]]]]]]]}}}}}}}}}}}}",
"xxxxxxxxxxxxjjjjjjjjjjjjccccccccccccSSSSSSSSSSSSPPPPPPPPPPPP))))))))))))]]]]]]]]]]]]}}}}}}}}}}}}",
"xxxxxxxxxxxxjjjjjjjjjjjjccccccccccccSSSSSSSSSSSSPPPPPPPPPPPP))))))))))))]]]]]]]]]]]]}}}}}}}}}}}}",
"xxxxxxxxxxxxjjjjjjjjjjjjccccccccccccSSSSSSSSSSSSPPPPPPPPPPPP))))))))))))]]]]]]]]]]]]}}}}}}}}}}}}",
"xxxxxxxxxxxxjjjjjjjjjjjjccccccccccccSSSSSSSSSSSSPPPPPPPPPPPP))))))))))))]]]]]]]]]]]]}}}}}}}}}}}}",
"xxxxxxxxxxxxjjjjjjjjjjjjccccccccccccSSSSSSSSSSSSPPPPPPPPPPPP))))))))))))]]]]]]]]]]]]}}}}}}}}}}}}",
"xxxxxxxxxxxxjjjjjjjjjjjjccccccccccccSSSSSSSSSSSSPPPPPPPPPPPP))))))))))))]]]]]]]]]]]]}}}}}}}}}}}}",
"xxxxxxxxxxxxjjjjjjjjjjjjccccccccccccSSSSSSSSSSSSPPPPPPPPPPPP))))))))))))]]]]]]]]]]]]}}}}}}}}}}}}",
"xxxxxxxxxxxxjjjjjjjjjjjjccccccccccccSSSSSSSSSSSSPPPPPPPPPPPP))))))))))))]]]]]]]]]]]]}}}}}}}}}}}}",
"000000000000%%%%%%%%%%%%ttttttttttttmmmmmmmmmmmm////////////````````````''''''''''''{{{{{{{{{{{{",
"000000000000%%%%%%%%%%%%ttttttttttttmmmmmmmmmmmm////////////````````````''''''''''''{{{{{{{{{{{{",
"000000000000%%%%%%%%%%%%ttttttttttttmmmmmmmmmmmm////////////````````````''''''''''''{{{{{{{{{{{{",
"000000000000%%%%%%%%%%%%ttttttttttttmmmmmmmmmmmm////////////````````````''''''''''''{{{{{{{{{{{{",
"000000000000%%%%%%%%%%%%ttttttttttttmmmmmmmmmmmm////////////````````````''''''''''''{{{{{{{{{{{{",
"000000000000%%%%%%%%%%%%ttttttttttttmmmmmmmmmmmm////////////````````````''''''''''''{{{{{{{{{{{{",
"000000000000%%%%%%%%%%%%ttttttttttttmmmmmmmmmmmm////////////````````````''''''''''''{{{{{{{{{{{{",
"000000000000%%%%%%%%%%%%ttttttttttttmmmmmmmmmmmm////////////````````````''''''''''''{{{{{{{{{{{{",
"000000000000%%%%%%%%%%%%ttttttttttttmmmmmmmmmmmm////////////````````````''''''''''''{{{{{{{{{{{{",
"000000000000%%%%%%%%%%%%ttttttttttttmmmmmmmmmmmm////////////````````````''''''''''''{{{{{{{{{{{{",
"000000000000%%%%%%%%%%%%ttttttttttttmmmmmmmmmmmm////////////````````````''''''''''''{{{{{{{{{{{{",
"000000000000%%%%%%%%%%%%ttttttttttttmmmmmmmmmmmm////////////````````````''''''''''''{{{{{{{{{{{{",
">>>>>>>>>>>>uuuuuuuuuuuuZZZZZZZZZZZZmmmmmmmmmmmmLLLLLLLLLLLL))))))))))))''''''''''''{{{{{{{{{{{{",
">>>>>>>>>>>>uuuuuuuuuuuuZZZZZZZZZZZZmmmmmmmmmmmmLLLLLLLLLLLL))))))))))))''''''''''''{{{{{{{{{{{{",
">>>>>>>>>>>>uuuuuuuuuuuuZZZZZZZZZZZZmmmmmmmmmmmmLLLLLLLLLLLL))))))))))))''''''''''''{{{{{{{{{{{{",
">>>>>>>>>>>>uuuuuuuuuuuuZZZZZZZZZZZZmmmmmmmmmmmmLLLLLLLLLLLL))))))))))))''''''''''''{{{{{{{{{{{{",
">>>>>>>>>>>>uuuuuuuuuuuuZZZZZZZZZZZZmmmmmmmmmmmmLLLLLLLLLLLL))))))))))))''''''''''''{{{{{{{{{{{{",
">>>>>>>>>>>>uuuuuuuuuuuuZZZZZZZZZZZZmmmmmmmmmmmmLLLLLLLLLLLL))))))))))))''''''''''''{{{{{{{{{{{{",
">>>>>>>>>>>>uuuuuuuuuuuuZZZZZZZZZZZZmmmmmmmmmmmmLLLLLLLLLLLL))))))))))))''''''''''''{{{{{{{{{{{{",
">>>>>>>>>>>>uuuuuuuuuuuuZZZZZZZZZZZZmmmmmmmmmmmmLLLLLLLLLLLL))))))))))))''''''''''''{{{{{{{{{{{{",
">>>>>>>>>>>>uuuuuuuuuuuuZZZZZZZZZZZZmmmmmmmmmmmmLLLLLLLLLLLL))))))))))))''''''''''''{{{{{{{{{{{{",
">>>>>>>>>>>>uuuuuuuuuuuuZZZZZZZZZZZZmmmmmmmmmmmmLLLLLLLLLLLL))))))))))))''''''''''''{{{{{{{{{{{{",
">>>>>>>>>>>>uuuuuuuuuuuuZZZZZZZZZZZZmmmmmmmmmmmmLLLLLLLLLLLL))))))))))))''''''''''''{{{{{{{{{{{{",
">>>>>>>>>>>>uuuuuuuuuuuuZZZZZZZZZZZZmmmmmmmmmmmmLLLLLLLLLLLL))))))))))))''''''''''''{{{{{{{{{{{{",
"OOOOOOOOOOOO444444444444888888888888KKKKKKKKKKKKTTTTTTTTTTTT))))))))))))''''''''''''{{{{{{{{{{{{",
"OOOOOOOOOOOO444444444444888888888888KKKKKKKKKKKKTTTTTTTTTTTT))))))))))))''''''''''''{{{{{{{{{{{{",
"OOOOOOOOOOOO444444444444888888888888KKKKKKKKKKKKTTTTTTTTTTTT))))))))))))''''''''''''{{{{{{{{{{{{",
"OOOOOOOOOOOO444444444444888888888888KKKKKKKKKKKKTTTTTTTTTTTT))))))))))))''''''''''''{{{{{{{{{{{{",
"OOOOOOOOOOOO444444444444888888888888KKKKKKKKKKKKTTTTTTTTTTTT))))))))))))''''''''''''{{{{{{{{{{{{",
"OOOOOOOOOOOO444444444444888888888888KKKKKKKKKKKKTTTTTTTTTTTT))))))))))))''''''''''''{{{{{{{{{{{{",
"OOOOOOOOOOOO444444444444888888888888KKKKKKKKKKKKTTTTTTTTTTTT))))))))))))''''''''''''{{{{{{{{{{{{",
"OOOOOOOOOOOO444444444444888888888888KKKKKKKKKKKKTTTTTTTTTTTT))))))))))))''''''''''''{{{{{{{{{{{{",
"OOOOOOOOOOOO444444444444888888888888KKKKKKKKKKKKTTTTTTTTTTTT))))))))))))''''''''''''{{{{{{{{{{{{",
"OOOOOOOOOOOO444444444444888888888888KKKKKKKKKKKKTTTTTTTTTTTT))))))))))))''''''''''''{{{{{{{{{{{{",
"OOOOOOOOOOOO444444444444888888888888KKKKKKKKKKKKTTTTTTTTTTTT))))))))))))''''''''''''{{{{{{{{{{{{",
"OOOOOOOOOOOO444444444444888888888888KKKKKKKKKKKKTTTTTTTTTTTT))))))))))))''''''''''''{{{{{{{{{{{{",
"++++++++++++666666666666CCCCCCCCCCCCQQQQQQQQQQQQYYYYYYYYYYYY____________''''''''''''}}}}}}}}}}}}",
"++++++++++++666666666666CCCCCCCCCCCCQQQQQQQQQQQQYYYYYYYYYYYY____________''''''''''''}}}}}}}}}}}}",
"++++++++++++666666666666CCCCCCCCCCCCQQQQQQQQQQQQYYYYYYYYYYYY____________''''''''''''}}}}}}}}}}}}",
"++++++++++++666666666666CCCCCCCCCCCCQQQQQQQQQQQQYYYYYYYYYYYY____________''''''''''''}}}}}}}}}}}}",
"++++++++++++666666666666CCCCCCCCCCCCQQQQQQQQQQQQYYYYYYYYYYYY____________''''''''''''}}}}}}}}}}}}",
"++++++++++++666666666666CCCCCCCCCCCCQQQQQQQQQQQQYYYYYYYYYYYY____________''''''''''''}}}}}}}}}}}}",
"++++++++++++666666666666CCCCCCCCCCCCQQQQQQQQQQQQYYYYYYYYYYYY____________''''''''''''}}}}}}}}}}}}",
"++++++++++++666666666666CCCCCCCCCCCCQQQQQQQQQQQQYYYYYYYYYYYY____________''''''''''''}}}}}}}}}}}}",
"++++++++++++666666666666CCCCCCCCCCCCQQQQQQQQQQQQYYYYYYYYYYYY____________''''''''''''}}}}}}}}}}}}",
"++++++++++++666666666666CCCCCCCCCCCCQQQQQQQQQQQQYYYYYYYYYYYY____________''''''''''''}}}}}}}}}}}}",
"++++++++++++666666666666CCCCCCCCCCCCQQQQQQQQQQQQYYYYYYYYYYYY____________''''''''''''}}}}}}}}}}}}",
"++++++++++++666666666666CCCCCCCCCCCCQQQQQQQQQQQQYYYYYYYYYYYY____________''''''''''''}}}}}}}}}}}}",
"oooooooooooo,,,,,,,,,,,,DDDDDDDDDDDDmmmmmmmmmmmmLLLLLLLLLLLL))))))))))))''''''''''''}}}}}}}}}}}}",
"oooooooooooo,,,,,,,,,,,,DDDDDDDDDDDDmmmmmmmmmmmmLLLLLLLLLLLL))))))))))))''''''''''''}}}}}}}}}}}}",
"oooooooooooo,,,,,,,,,,,,DDDDDDDDDDDDmmmmmmmmmmmmLLLLLLLLLLLL))))))))))))''''''''''''}}}}}}}}}}}}",
"oooooooooooo,,,,,,,,,,,,DDDDDDDDDDDDmmmmmmmmmmmmLLLLLLLLLLLL))))))))))))''''''''''''}}}}}}}}}}}}",
"oooooooooooo,,,,,,,,,,,,DDDDDDDDDDDDmmmmmmmmmmmmLLLLLLLLLLLL))))))))))))''''''''''''}}}}}}}}}}}}",
"oooooooooooo,,,,,,,,,,,,DDDDDDDDDDDDmmmmmmmmmmmmLLLLLLLLLLLL))))))))))))''''''''''''}}}}}}}}}}}}",
"oooooooooooo,,,,,,,,,,,,DDDDDDDDDDDDmmmmmmmmmmmmLLLLLLLLLLLL))))))))))))''''''''''''}}}}}}}}}}}}",
"oooooooooooo,,,,,,,,,,,,DDDDDDDDDDDDmmmmmmmmmmmmLLLLLLLLLLLL))))))))))))''''''''''''}}}}}}}}}}}}",
"oooooooooooo,,,,,,,,,,,,DDDDDDDDDDDDmmmmmmmmmmmmLLLLLLLLLLLL))))))))))))''''''''''''}}}}}}}}}}}}",
"oooooooooooo,,,,,,,,,,,,DDDDDDDDDDDDmmmmmmmmmmmmLLLLLLLLLLLL))))))))))))''''''''''''}}}}}}}}}}}}",
"oooooooooooo,,,,,,,,,,,,DDDDDDDDDDDDmmmmmmmmmmmmLLLLLLLLLLLL))))))))))))''''''''''''}}}}}}}}}}}}",
"oooooooooooo,,,,,,,,,,,,DDDDDDDDDDDDmmmmmmmmmmmmLLLLLLLLLLLL))))))))))))''''''''''''}}}}}}}}}}}}",
"::::::::::::eeeeeeeeeeee444444444444mmmmmmmmmmmm^^^^^^^^^^^^____________''''''''''''{{{{{{{{{{{{",
"::::::::::::eeeeeeeeeeee444444444444mmmmmmmmmmmm^^^^^^^^^^^^____________''''''''''''{{{{{{{{{{{{",
"::::::::::::eeeeeeeeeeee444444444444mmmmmmmmmmmm^^^^^^^^^^^^____________''''''''''''{{{{{{{{{{{{",
"::::::::::::eeeeeeeeeeee444444444444mmmmmmmmmmmm^^^^^^^^^^^^____________''''''''''''{{{{{{{{{{{{",
"::::::::::::eeeeeeeeeeee444444444444mmmmmmmmmmmm^^^^^^^^^^^^____________''''''''''''{{{{{{{{{{{{",
"::::::::::::eeeeeeeeeeee444444444444mmmmmmmmmmmm^^^^^^^^^^^^____________''''''''''''{{{{{{{{{{{{",
"::::::::::::eeeeeeeeeeee444444444444mmmmmmmmmmmm^^^^^^^^^^^^____________''''''''''''{{{{{{{{{{{{",
"::::::::::::eeeeeeeeeeee444444444444mmmmmmmmmmmm^^^^^^^^^^^^____________''''''''''''{{{{{{{{{{{{",
"::::::::::::eeeeeeeeeeee444444444444mmmmmmmmmmmm^^^^^^^^^^^^____________''''''''''''{{{{{{{{{{{{",
"::::::::::::eeeeeeeeeeee444444444444mmmmmmmmmmmm^^^^^^^^^^^^____________''''''''''''{{{{{{{{{{{{",
"::::::::::::eeeeeeeeeeee444444444444mmmmmmmmmmmm^^^^^^^^^^^^____________''''''''''''{{{{{{{{{{{{",
"::::::::::::eeeeeeeeeeee444444444444mmmmmmmmmmmm^^^^^^^^^^^^____________''''''''''''{{{{{{{{{{{{",
"............666666666666ZZZZZZZZZZZZbbbbbbbbbbbbPPPPPPPPPPPP````````````''''''''''''{{{{{{{{{{{{",
"............666666666666ZZZZZZZZZZZZbbbbbbbbbbbbPPPPPPPPPPPP````````````''''''''''''{{{{{{{{{{{{",
"............666666666666ZZZZZZZZZZZZbbbbbbbbbbbbPPPPPPPPPPPP````````````''''''''''''{{{{{{{{{{{{",
"............666666666666ZZZZZZZZZZZZbbbbbbbbbbbbPPPPPPPPPPPP````````````''''''''''''{{{{{{{{{{{{",
"............666666666666ZZZZZZZZZZZZbbbbbbbbbbbbPPPPPPPPPPPP````````````''''''''''''{{{{{{{{{{{{",
"............666666666666ZZZZZZZZZZZZbbbbbbbbbbbbPPPPPPPPPPPP````````````''''''''''''{{{{{{{{{{{{",
"............666666666666ZZZZZZZZZZZZbbbbbbbbbbbbPPPPPPPPPPPP````````````''''''''''''{{{{{{{{{{{{",
"............666666666666ZZZZZZZZZZZZbbbbbbbbbbbbPPPPPPPPPPPP````````````''''''''''''{{{{{{{{{{{{",
"............666666666666ZZZZZZZZZZZZbbbbbbbbbbbbPPPPPPPPPPPP````````````''''''''''''{{{{{{{{{{{{",
"............666666666666ZZZZZZZZZZZZbbbbbbbbbbbbPPPPPPPPPPPP````````````''''''''''''{{{{{{{{{{{{",
"............666666666666ZZZZZZZZZZZZbbbbbbbbbbbbPPPPPPPPPPPP````````````''''''''''''{{{{{{{{{{{{",
"............666666666666ZZZZZZZZZZZZbbbbbbbbbbbbPPPPPPPPPPPP````````````''''''''''''{{{{{{{{{{{{",
"aaaaaaaaaaaaiiiiiiiiiiiizzzzzzzzzzzzJJJJJJJJJJJJPPPPPPPPPPPP))))))))))))''''''''''''{{{{{{{{{{{{",
"aaaaaaaaaaaaiiiiiiiiiiiizzzzzzzzzzzzJJJJJJJJJJJJPPPPPPPPPPPP))))))))))))''''''''''''{{{{{{{{{{{{",
"aaaaaaaaaaaaiiiiiiiiiiiizzzzzzzzzzzzJJJJJJJJJJJJPPPPPPPPPPPP))))))))))))''''''''''''{{{{{{{{{{{{",
"aaaaaaaaaaaaiiiiiiiiiiiizzzzzzzzzzzzJJJJJJJJJJJJPPPPPPPPPPPP))))))))))))''''''''''''{{{{{{{{{{{{",
"aaaaaaaaaaaaiiiiiiiiiiiizzzzzzzzzzzzJJJJJJJJJJJJPPPPPPPPPPPP))))))))))))''''''''''''{{{{{{{{{{{{",
"aaaaaaaaaaaaiiiiiiiiiiiizzzzzzzzzzzzJJJJJJJJJJJJPPPPPPPPPPPP))))))))))))''''''''''''{{{{{{{{{{{{",
"aaaaaaaaaaaaiiiiiiiiiiiizzzzzzzzzzzzJJJJJJJJJJJJPPPPPPPPPPPP))))))))))))''''''''''''{{{{{{{{{{{{",
"aaaaaaaaaaaaiiiiiiiiiiiizzzzzzzzzzzzJJJJJJJJJJJJPPPPPPPPPPPP))))))))))))''''''''''''{{{{{{{{{{{{",
"aaaaaaaaaaaaiiiiiiiiiiiizzzzzzzzzzzzJJJJJJJJJJJJPPPPPPPPPPPP))))))))))))''''''''''''{{{{{{{{{{{{",
"aaaaaaaaaaaaiiiiiiiiiiiizzzzzzzzzzzzJJJJJJJJJJJJPPPPPPPPPPPP))))))))))))''''''''''''{{{{{{{{{{{{",
"aaaaaaaaaaaaiiiiiiiiiiiizzzzzzzzzzzzJJJJJJJJJJJJPPPPPPPPPPPP))))))))))))''''''''''''{{{{{{{{{{{{",
"aaaaaaaaaaaaiiiiiiiiiiiizzzzzzzzzzzzJJJJJJJJJJJJPPPPPPPPPPPP))))))))))))''''''''''''{{{{{{{{{{{{",
"............eeeeeeeeeeee444444444444IIIIIIIIIIIIWWWWWWWWWWWW))))))))))))''''''''''''}}}}}}}}}}}}",
"............eeeeeeeeeeee444444444444IIIIIIIIIIIIWWWWWWWWWWWW))))))))))))''''''''''''}}}}}}}}}}}}",
"............eeeeeeeeeeee444444444444IIIIIIIIIIIIWWWWWWWWWWWW))))))))))))''''''''''''}}}}}}}}}}}}",
"............eeeeeeeeeeee444444444444IIIIIIIIIIIIWWWWWWWWWWWW))))))))))))''''''''''''}}}}}}}}}}}}",
"............eeeeeeeeeeee444444444444IIIIIIIIIIIIWWWWWWWWWWWW))))))))))))''''''''''''}}}}}}}}}}}}",
"............eeeeeeeeeeee444444444444IIIIIIIIIIIIWWWWWWWWWWWW))))))))))))''''''''''''}}}}}}}}}}}}",
"............eeeeeeeeeeee444444444444IIIIIIIIIIIIWWWWWWWWWWWW))))))))))))''''''''''''}}}}}}}}}}}}",
"............eeeeeeeeeeee444444444444IIIIIIIIIIIIWWWWWWWWWWWW))))))))))))''''''''''''}}}}}}}}}}}}",
"............eeeeeeeeeeee444444444444IIIIIIIIIIIIWWWWWWWWWWWW))))))))))))''''''''''''}}}}}}}}}}}}",
"............eeeeeeeeeeee444444444444IIIIIIIIIIIIWWWWWWWWWWWW))))))))))))''''''''''''}}}}}}}}}}}}",
"............eeeeeeeeeeee444444444444IIIIIIIIIIIIWWWWWWWWWWWW))))))))))))''''''''''''}}}}}}}}}}}}",
"............eeeeeeeeeeee444444444444IIIIIIIIIIIIWWWWWWWWWWWW))))))))))))''''''''''''}}}}}}}}}}}}",
"llllllllllll444444444444HHHHHHHHHHHHvvvvvvvvvvvv((((((((((((____________]]]]]]]]]]]]}}}}}}}}}}}}",
"llllllllllll444444444444HHHHHHHHHHHHvvvvvvvvvvvv((((((((((((____________]]]]]]]]]]]]}}}}}}}}}}}}",
"llllllllllll444444444444HHHHHHHHHHHHvvvvvvvvvvvv((((((((((((____________]]]]]]]]]]]]}}}}}}}}}}}}",
"llllllllllll444444444444HHHHHHHHHHHHvvvvvvvvvvvv((((((((((((____________]]]]]]]]]]]]}}}}}}}}}}}}",
"llllllllllll444444444444HHHHHHHHHHHHvvvvvvvvvvvv((((((((((((____________]]]]]]]]]]]]}}}}}}}}}}}}",
"llllllllllll444444444444HHHHHHHHHHHHvvvvvvvvvvvv((((((((((((____________]]]]]]]]]]]]}}}}}}}}}}}}",
"llllllllllll444444444444HHHHHHHHHHHHvvvvvvvvvvvv((((((((((((____________]]]]]]]]]]]]}}}}}}}}}}}}",
"llllllllllll444444444444HHHHHHHHHHHHvvvvvvvvvvvv((((((((((((____________]]]]]]]]]]]]}}}}}}}}}}}}",
"llllllllllll444444444444HHHHHHHHHHHHvvvvvvvvvvvv((((((((((((____________]]]]]]]]]]]]}}}}}}}}}}}}",
"llllllllllll444444444444HHHHHHHHHHHHvvvvvvvvvvvv((((((((((((____________]]]]]]]]]]]]}}}}}}}}}}}}",
"llllllllllll444444444444HHHHHHHHHHHHvvvvvvvvvvvv((((((((((((____________]]]]]]]]]]]]}}}}}}}}}}}}",
"llllllllllll444444444444HHHHHHHHHHHHvvvvvvvvvvvv((((((((((((____________]]]]]]]]]]]]}}}}}}}}}}}}",
"qqqqqqqqqqqq111111111111ssssssssssssGGGGGGGGGGGGQQQQQQQQQQQQ____________[[[[[[[[[[[[{{{{{{{{{{{{",
"qqqqqqqqqqqq111111111111ssssssssssssGGGGGGGGGGGGQQQQQQQQQQQQ____________[[[[[[[[[[[[{{{{{{{{{{{{",
"qqqqqqqqqqqq111111111111ssssssssssssGGGGGGGGGGGGQQQQQQQQQQQQ____________[[[[[[[[[[[[{{{{{{{{{{{{",
"qqqqqqqqqqqq111111111111ssssssssssssGGGGGGGGGGGGQQQQQQQQQQQQ____________[[[[[[[[[[[[{{{{{{{{{{{{",
"qqqqqqqqqqqq111111111111ssssssssssssGGGGGGGGGGGGQQQQQQQQQQQQ____________[[[[[[[[[[[[{{{{{{{{{{{{",
"qqqqqqqqqqqq111111111111ssssssssssssGGGGGGGGGGGGQQQQQQQQQQQQ____________[[[[[[[[[[[[{{{{{{{{{{{{",
"qqqqqqqqqqqq111111111111ssssssssssssGGGGGGGGGGGGQQQQQQQQQQQQ____________[[[[[[[[[[[[{{{{{{{{{{{{",
"qqqqqqqqqqqq111111111111ssssssssssssGGGGGGGGGGGGQQQQQQQQQQQQ____________[[[[[[[[[[[[{{{{{{{{{{{{",
"qqqqqqqqqqqq111111111111ssssssssssssGGGGGGGGGGGGQQQQQQQQQQQQ____________[[[[[[[[[[[[{{{{{{{{{{{{",
"qqqqqqqqqqqq111111111111ssssssssssssGGGGGGGGGGGGQQQQQQQQQQQQ____________[[[[[[[[[[[[{{{{{{{{{{{{",
"qqqqqqqqqqqq111111111111ssssssssssssGGGGGGGGGGGGQQQQQQQQQQQQ____________[[[[[[[[[[[[{{{{{{{{{{{{",
"qqqqqqqqqqqq111111111111ssssssssssssGGGGGGGGGGGGQQQQQQQQQQQQ____________[[[[[[[[[[[[{{{{{{{{{{{{",
"ppppppppppppkkkkkkkkkkkkttttttttttttSSSSSSSSSSSS!!!!!!!!!!!!))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
"ppppppppppppkkkkkkkkkkkkttttttttttttSSSSSSSSSSSS!!!!!!!!!!!!))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
"ppppppppppppkkkkkkkkkkkkttttttttttttSSSSSSSSSSSS!!!!!!!!!!!!))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
"ppppppppppppkkkkkkkkkkkkttttttttttttSSSSSSSSSSSS!!!!!!!!!!!!))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
"ppppppppppppkkkkkkkkkkkkttttttttttttSSSSSSSSSSSS!!!!!!!!!!!!))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
"ppppppppppppkkkkkkkkkkkkttttttttttttSSSSSSSSSSSS!!!!!!!!!!!!))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
"ppppppppppppkkkkkkkkkkkkttttttttttttSSSSSSSSSSSS!!!!!!!!!!!!))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
"ppppppppppppkkkkkkkkkkkkttttttttttttSSSSSSSSSSSS!!!!!!!!!!!!))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
"ppppppppppppkkkkkkkkkkkkttttttttttttSSSSSSSSSSSS!!!!!!!!!!!!))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
"ppppppppppppkkkkkkkkkkkkttttttttttttSSSSSSSSSSSS!!!!!!!!!!!!))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
"ppppppppppppkkkkkkkkkkkkttttttttttttSSSSSSSSSSSS!!!!!!!!!!!!))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
"ppppppppppppkkkkkkkkkkkkttttttttttttSSSSSSSSSSSS!!!!!!!!!!!!))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
"ppppppppppppzzzzzzzzzzzzddddddddddddFFFFFFFFFFFFLLLLLLLLLLLL````````````''''''''''''{{{{{{{{{{{{",
"ppppppppppppzzzzzzzzzzzzddddddddddddFFFFFFFFFFFFLLLLLLLLLLLL````````````''''''''''''{{{{{{{{{{{{",
"ppppppppppppzzzzzzzzzzzzddddddddddddFFFFFFFFFFFFLLLLLLLLLLLL````````````''''''''''''{{{{{{{{{{{{",
"ppppppppppppzzzzzzzzzzzzddddddddddddFFFFFFFFFFFFLLLLLLLLLLLL````````````''''''''''''{{{{{{{{{{{{",
"ppppppppppppzzzzzzzzzzzzddddddddddddFFFFFFFFFFFFLLLLLLLLLLLL````````````''''''''''''{{{{{{{{{{{{",
"ppppppppppppzzzzzzzzzzzzddddddddddddFFFFFFFFFFFFLLLLLLLLLLLL````````````''''''''''''{{{{{{{{{{{{",
"ppppppppppppzzzzzzzzzzzzddddddddddddFFFFFFFFFFFFLLLLLLLLLLLL````````````''''''''''''{{{{{{{{{{{{",
"ppppppppppppzzzzzzzzzzzzddddddddddddFFFFFFFFFFFFLLLLLLLLLLLL````````````''''''''''''{{{{{{{{{{{{",
"ppppppppppppzzzzzzzzzzzzddddddddddddFFFFFFFFFFFFLLLLLLLLLLLL````````````''''''''''''{{{{{{{{{{{{",
"ppppppppppppzzzzzzzzzzzzddddddddddddFFFFFFFFFFFFLLLLLLLLLLLL````````````''''''''''''{{{{{{{{{{{{",
"ppppppppppppzzzzzzzzzzzzddddddddddddFFFFFFFFFFFFLLLLLLLLLLLL````````````''''''''''''{{{{{{{{{{{{",
"ppppppppppppzzzzzzzzzzzzddddddddddddFFFFFFFFFFFFLLLLLLLLLLLL````````````''''''''''''{{{{{{{{{{{{",
"666666666666************777777777777MMMMMMMMMMMMLLLLLLLLLLLL````````````''''''''''''{{{{{{{{{{{{",
"666666666666************777777777777MMMMMMMMMMMMLLLLLLLLLLLL````````````''''''''''''{{{{{{{{{{{{",
"666666666666************777777777777MMMMMMMMMMMMLLLLLLLLLLLL````````````''''''''''''{{{{{{{{{{{{",
"666666666666************777777777777MMMMMMMMMMMMLLLLLLLLLLLL````````````''''''''''''{{{{{{{{{{{{",
"666666666666************777777777777MMMMMMMMMMMMLLLLLLLLLLLL````````````''''''''''''{{{{{{{{{{{{",
"666666666666************777777777777MMMMMMMMMMMMLLLLLLLLLLLL````````````''''''''''''{{{{{{{{{{{{",
"666666666666************777777777777MMMMMMMMMMMMLLLLLLLLLLLL````````````''''''''''''{{{{{{{{{{{{",
"666666666666************777777777777MMMMMMMMMMMMLLLLLLLLLLLL````````````''''''''''''{{{{{{{{{{{{",
"666666666666************777777777777MMMMMMMMMMMMLLLLLLLLLLLL````````````''''''''''''{{{{{{{{{{{{",
"666666666666************777777777777MMMMMMMMMMMMLLLLLLLLLLLL````````````''''''''''''{{{{{{{{{{{{",
"666666666666************777777777777MMMMMMMMMMMMLLLLLLLLLLLL````````````''''''''''''{{{{{{{{{{{{",
"666666666666************777777777777MMMMMMMMMMMMLLLLLLLLLLLL````````````''''''''''''{{{{{{{{{{{{"
};

278
xpm/addressbook16.xpm Normal file
View File

@@ -0,0 +1,278 @@
/* XPM */
static const char * addressbook16_xpm[] = {
/* columns rows colors chars-per-pixel */
"16 16 256 2",
" c #FFFFFF",
". c #F7FFFF",
"X c #F7F7FF",
"o c #EFF7FF",
"O c #E6EFF7",
"+ c #E6E6F7",
"@ c #CEE6F7",
"# c #DEDEEF",
"$ c #D6DEEF",
"% c #D6DEE6",
"& c #CEDEF7",
"* c #CEDEEF",
"= c #EFF708",
"- c #C5DEF7",
"; c #CED6EF",
": c None",
"> c #C5D6E6",
", c #BDD6F7",
"< c #BDD6EF",
"1 c #D6CECE",
"2 c #BDCEE6",
"3 c #BDC5E6",
"4 c #B5C5DE",
"5 c #BDD631",
"6 c #ADBDDE",
"7 c #B5B5BD",
"8 c #A5B5D6",
"9 c #00FFFF",
"0 c #9CB5CE",
"q c #9CADD6",
"w c #94A5D6",
"e c #8CA5D6",
"r c #8CA5CE",
"t c #8CA5C5",
"y c #849CC5",
"u c #7B9CD6",
"i c #7B9CCE",
"p c #31BDCE",
"a c #6B9CD6",
"s c #00F708",
"d c #8494AD",
"f c #7B94B5",
"g c #6B94D6",
"h c #6B9C84",
"j c #7B8CAD",
"k c #738CAD",
"l c #638CC5",
"z c #10CE42",
"x c #638CBD",
"c c #7B849C",
"v c #73849C",
"b c #6B84A5",
"n c #7B7BA5",
"m c #6B849C",
"M c #7B8C42",
"N c #5A84C5",
"B c #29AD6B",
"V c #F74A4A",
"C c #6384A5",
"Z c #5284C5",
"A c #637BA5",
"S c #637B9C",
"D c #9C637B",
"F c #6B7B5A",
"G c #637394",
"H c #52739C",
"J c #5A7384",
"K c #526B94",
"L c #426B94",
"P c #52638C",
"I c #426B7B",
"U c #5A5A8C",
"Y c #524A7B",
"T c #425273",
"R c #21636B",
"E c #106394",
"W c #106B52",
"Q c #3A4273",
"! c #31426B",
"~ c #523163",
"^ c #29426B",
"/ c #293A63",
"( c #213A63",
") c #193A63",
"_ c #193163",
"` c #19315A",
"' c #212963",
"] c #10315A",
"[ c #082952",
"{ c #FFCC33",
"} c #33FF33",
"| c #66FF33",
" . c #99FF33",
".. c #CCFF33",
"X. c #FFFF33",
"o. c #000066",
"O. c #330066",
"+. c #660066",
"@. c #990066",
"#. c #CC0066",
"$. c #FF0066",
"%. c #003366",
"&. c #333366",
"*. c #663366",
"=. c #993366",
"-. c #CC3366",
";. c #FF3366",
":. c #006666",
">. c #336666",
",. c #666666",
"<. c #996666",
"1. c #CC6666",
"2. c #009966",
"3. c #339966",
"4. c #669966",
"5. c #999966",
"6. c #CC9966",
"7. c #FF9966",
"8. c #00CC66",
"9. c #33CC66",
"0. c #99CC66",
"q. c #CCCC66",
"w. c #FFCC66",
"e. c #00FF66",
"r. c #33FF66",
"t. c #99FF66",
"y. c #CCFF66",
"u. c #FF00CC",
"i. c #CC00FF",
"p. c #009999",
"a. c #993399",
"s. c #990099",
"d. c #CC0099",
"f. c #000099",
"g. c #333399",
"h. c #660099",
"j. c #CC3399",
"k. c #FF0099",
"l. c #006699",
"z. c #336699",
"x. c #663399",
"c. c #996699",
"v. c #CC6699",
"b. c #FF3399",
"n. c #339999",
"m. c #669999",
"M. c #999999",
"N. c #CC9999",
"B. c #FF9999",
"V. c #00CC99",
"C. c #33CC99",
"Z. c #66CC66",
"A. c #99CC99",
"S. c #CCCC99",
"D. c #FFCC99",
"F. c #00FF99",
"G. c #33FF99",
"H. c #66CC99",
"J. c #99FF99",
"K. c #CCFF99",
"L. c #FFFF99",
"P. c #0000CC",
"I. c #330099",
"U. c #6600CC",
"Y. c #9900CC",
"T. c #CC00CC",
"R. c #003399",
"E. c #3333CC",
"W. c #6633CC",
"Q. c #9933CC",
"!. c #CC33CC",
"~. c #FF33CC",
"^. c #0066CC",
"/. c #3366CC",
"(. c #666699",
"). c #9966CC",
"_. c #CC66CC",
"`. c #FF6699",
"'. c #0099CC",
"]. c #3399CC",
"[. c #6699CC",
"{. c #9999CC",
"}. c #CC99CC",
"|. c #FF99CC",
" X c #00CCCC",
".X c #33CCCC",
"XX c #66CCCC",
"oX c #99CCCC",
"OX c #CCCCCC",
"+X c #FFCCCC",
"@X c #00FFCC",
"#X c #33FFCC",
"$X c #66FF99",
"%X c #99FFCC",
"&X c #CCFFCC",
"*X c #FFFFCC",
"=X c #3300CC",
"-X c #6600FF",
";X c #9900FF",
":X c #0033CC",
">X c #3333FF",
",X c #6633FF",
"<X c #9933FF",
"1X c #CC33FF",
"2X c #FF33FF",
"3X c #0066FF",
"4X c #3366FF",
"5X c #6666CC",
"6X c #9966FF",
"7X c #CC66FF",
"8X c #FF66CC",
"9X c #0099FF",
"0X c #3399FF",
"qX c #6699FF",
"wX c #9999FF",
"eX c #CC99FF",
"rX c #FF99FF",
"tX c #00CCFF",
"yX c #33CCFF",
"uX c #66CCFF",
"iX c #99CCFF",
"pX c #CCCCFF",
"aX c #FFCCFF",
"sX c #33FFFF",
"dX c #66FFCC",
"fX c #99FFFF",
"gX c #CCFFFF",
"hX c #FF6666",
"jX c #66FF66",
"kX c #FFFF66",
"lX c #6666FF",
"zX c #FF66FF",
"xX c #66FFFF",
"cX c #A50021",
"vX c #5F5F5F",
"bX c #777777",
"nX c #868686",
"mX c #969696",
"MX c #CBCBCB",
"NX c #B2B2B2",
"BX c #D7D7D7",
"VX c #DDDDDD",
"CX c #E3E3E3",
"ZX c #EAEAEA",
"AX c #F1F1F1",
"SX c #F8F8F8",
"DX c #FFFBF0",
"FX c #A0A0A4",
"GX c #808080",
"HX c #FF0000",
"JX c #00FF00",
"KX c #FFFF00",
"LX c #0000FF",
"PX c #FF00FF",
"IX c #00FFFF",
"UX c #FFFFFF",
/* pixels */
": : : : : : : : : : : : : : : : ",
": : H H H A d : 7 G K H H : : : ",
"n n c X 4 k j X b n n : ",
"n 2 c $ 8 6 4 x < + 4 4 C V ~ : ",
"n * c X o $ y N u 6 $ + b D Y : ",
"n * c X > g , S z R : ",
"n * c * r r y g , 6 r q S s W : ",
"n * c X 4 N u + m B I : ",
"n * c X ; a - S 5 F : ",
"n * c * r r r g - S = M : ",
"n * c X 4 N - m h J : ",
"n * c X ; a - A 9 E : ",
"n * ( ] ` ^ P l y T / / ( p L : ",
"n O > 0 f ) ! t 8 % n : ",
"U U U U U U U ' Q U U U U U U : ",
": : : : : : : : : : : : : : : : "
};

282
xpm/addressbook20.xpm Normal file
View File

@@ -0,0 +1,282 @@
/* XPM */
static const char * addressbook20_xpm[] = {
/* columns rows colors chars-per-pixel */
"20 20 256 2",
" c #FFFFFF",
". c #F7FFFF",
"X c #F7F7FF",
"o c #EFF7FF",
"O c #EFF7F7",
"+ c #E6EFFF",
"@ c #E6EFF7",
"# c #DEEFFF",
"$ c #DEE6F7",
"% c #DEE6EF",
"& c #D6E6F7",
"* c #FFFF00",
"= c #DEDEE6",
"- c #D6DEE6",
"; c #D6D6DE",
": c #CED6E6",
"> c None",
", c #C5D6E6",
"< c #C5CEE6",
"1 c #B5CEEF",
"2 c #C5C5C5",
"3 c #C5DE31",
"4 c #B5C5DE",
"5 c #BDC5C5",
"6 c #ADC5EF",
"7 c #B5C5CE",
"8 c #BDBDBD",
"9 c #B5BDCE",
"0 c #ADBDDE",
"q c #ADBDD6",
"w c #B5CE52",
"e c #ADB5C5",
"r c #00FFFF",
"t c #A5B5C5",
"y c #9CB5CE",
"u c #94B5DE",
"i c #9CADD6",
"p c #A5ADB5",
"a c #94ADDE",
"s c #94ADD6",
"d c #9CADBD",
"f c #8CADDE",
"g c #BD9CA5",
"h c #9CA5BD",
"j c #9CA5B5",
"k c #29D6E6",
"l c #8CA5CE",
"z c #849CCE",
"x c #6BA5C5",
"c c #739CDE",
"v c #00FF00",
"b c #739CD6",
"n c #7B94CE",
"m c #8494AD",
"M c #7394CE",
"N c #7B94B5",
"B c #4AB584",
"V c #848CB5",
"C c #6B94CE",
"Z c #6394D6",
"A c #6394CE",
"S c #7B8CAD",
"D c #6B8CC5",
"F c #738CAD",
"G c #5294B5",
"H c #6B84C5",
"J c #7384A5",
"K c #73849C",
"L c #738494",
"P c #FF4A4A",
"I c #FF4A42",
"U c #737B8C",
"Y c #637BAD",
"T c #527BBD",
"R c #637394",
"E c #637352",
"W c #5A6B8C",
"Q c #526B9C",
"! c #63638C",
"~ c #5A734A",
"^ c #4A6B9C",
"/ c #526B63",
"( c #0884A5",
") c #526384",
"_ c #52637B",
"` c #4A6B5A",
"' c #52636B",
"] c #525A8C",
"[ c #525A7B",
"{ c #426363",
"} c #4A5A7B",
"| c #425A8C",
" . c #196B94",
".. c #3A5A8C",
"X. c #3A5A84",
"o. c #087B4A",
"O. c #21636B",
"+. c #634263",
"@. c #3A527B",
"#. c #424A84",
"$. c #315284",
"%. c #295284",
"&. c #3A4A6B",
"*. c #42427B",
"=. c #424273",
"-. c #294A84",
";. c #3A3A73",
":. c #194284",
">. c #104A63",
",. c #213A6B",
"<. c #31316B",
"1. c #21315A",
"2. c #212163",
"3. c #08295A",
"4. c #082152",
"5. c #101952",
"6. c #CC9966",
"7. c #FF9966",
"8. c #00CC66",
"9. c #33CC66",
"0. c #99CC66",
"q. c #CCCC66",
"w. c #FFCC66",
"e. c #00FF66",
"r. c #33FF66",
"t. c #99FF66",
"y. c #CCFF66",
"u. c #FF00CC",
"i. c #CC00FF",
"p. c #009999",
"a. c #993399",
"s. c #990099",
"d. c #CC0099",
"f. c #000099",
"g. c #333399",
"h. c #660099",
"j. c #CC3399",
"k. c #FF0099",
"l. c #006699",
"z. c #336699",
"x. c #663399",
"c. c #996699",
"v. c #CC6699",
"b. c #FF3399",
"n. c #339999",
"m. c #669999",
"M. c #999999",
"N. c #CC9999",
"B. c #FF9999",
"V. c #00CC99",
"C. c #33CC99",
"Z. c #66CC66",
"A. c #99CC99",
"S. c #CCCC99",
"D. c #FFCC99",
"F. c #00FF99",
"G. c #33FF99",
"H. c #66CC99",
"J. c #99FF99",
"K. c #CCFF99",
"L. c #FFFF99",
"P. c #0000CC",
"I. c #330099",
"U. c #6600CC",
"Y. c #9900CC",
"T. c #CC00CC",
"R. c #003399",
"E. c #3333CC",
"W. c #6633CC",
"Q. c #9933CC",
"!. c #CC33CC",
"~. c #FF33CC",
"^. c #0066CC",
"/. c #3366CC",
"(. c #666699",
"). c #9966CC",
"_. c #CC66CC",
"`. c #FF6699",
"'. c #0099CC",
"]. c #3399CC",
"[. c #6699CC",
"{. c #9999CC",
"}. c #CC99CC",
"|. c #FF99CC",
" X c #00CCCC",
".X c #33CCCC",
"XX c #66CCCC",
"oX c #99CCCC",
"OX c #CCCCCC",
"+X c #FFCCCC",
"@X c #00FFCC",
"#X c #33FFCC",
"$X c #66FF99",
"%X c #99FFCC",
"&X c #CCFFCC",
"*X c #FFFFCC",
"=X c #3300CC",
"-X c #6600FF",
";X c #9900FF",
":X c #0033CC",
">X c #3333FF",
",X c #6633FF",
"<X c #9933FF",
"1X c #CC33FF",
"2X c #FF33FF",
"3X c #0066FF",
"4X c #3366FF",
"5X c #6666CC",
"6X c #9966FF",
"7X c #CC66FF",
"8X c #FF66CC",
"9X c #0099FF",
"0X c #3399FF",
"qX c #6699FF",
"wX c #9999FF",
"eX c #CC99FF",
"rX c #FF99FF",
"tX c #00CCFF",
"yX c #33CCFF",
"uX c #66CCFF",
"iX c #99CCFF",
"pX c #CCCCFF",
"aX c #FFCCFF",
"sX c #33FFFF",
"dX c #66FFCC",
"fX c #99FFFF",
"gX c #CCFFFF",
"hX c #FF6666",
"jX c #66FF66",
"kX c #FFFF66",
"lX c #6666FF",
"zX c #FF66FF",
"xX c #66FFFF",
"cX c #A50021",
"vX c #5F5F5F",
"bX c #777777",
"nX c #868686",
"mX c #969696",
"MX c #CBCBCB",
"NX c #B2B2B2",
"BX c #D7D7D7",
"VX c #DDDDDD",
"CX c #E3E3E3",
"ZX c #EAEAEA",
"AX c #F1F1F1",
"SX c #F8F8F8",
"DX c #FFFBF0",
"FX c #A0A0A4",
"GX c #808080",
"HX c #FF0000",
"JX c #00FF00",
"KX c #FFFF00",
"LX c #0000FF",
"PX c #FF00FF",
"IX c #00FFFF",
"UX c #FFFFFF",
/* pixels */
"> > > > > > > > > > > > > > > > > > > > ",
"> > > > > > > > > > > > > > > > > > > > ",
"> > U $.| | ^ S 2 > p W | | @.L > > > > ",
"8 5 R - < Y j S O - ) g e > > ",
"! V K - % a Q # - +.P <.> > ",
"! & K - 0 z n D C b f n n z q +.P <.> > ",
"! & K - % M A 1 - %.G #.> > ",
"! & K - % u b # - o.v >.> > ",
"! & K - 0 z n H M b 6 z n z q o.v >.> > ",
"! & K - X - M A a - O.B @.> > ",
"! & K - X % u b # - ` 3 / > > ",
"! & K - 0 l i 4 u b # - ~ * E > > ",
"! & K - X o $ s T b # - { w ' > > ",
"! & K - % f b # - .k -.> > ",
"! & K m d t 7 , u b # ; 9 9 h ( r :.> > ",
"! & h _ _ [ &.4.$.A ,.1.} _ _ F x ] > > ",
"! @ , y N _ 3._ N y , @ ! > > ",
"*.*.*.*.*.*.*.*.;.5.*.*.*.*.*.*.*.2.> > ",
"> > > > > > > > > > > > > > > > > > > > ",
"> > > > > > > > > > > > > > > > > > > > "
};

203
xpm/bitcoin16.xpm Normal file
View File

@@ -0,0 +1,203 @@
/* XPM */
static const char * bitcoin16_xpm[] = {
/* columns rows colors chars-per-pixel */
"16 16 181 2",
" c #775605",
". c #745507",
"X c #785806",
"o c #7D5A06",
"O c #745508",
"+ c #755508",
"@ c #755608",
"# c #775708",
"$ c #77580B",
"% c #7A5A0B",
"& c #7D5E14",
"* c #86630D",
"= c #8D6B16",
"- c #886818",
"; c #927019",
": c #91701E",
"> c #9A751E",
", c #957627",
"< c #9A7925",
"1 c #987827",
"2 c #98782B",
"3 c #9D7C2F",
"4 c #9E7E31",
"5 c #A57D22",
"6 c #A88227",
"7 c #B78D2E",
"8 c #B78F2E",
"9 c #A78430",
"0 c #A48733",
"q c #A68536",
"w c #A98937",
"e c #B98F31",
"r c #B49233",
"t c #B39337",
"y c #C09837",
"u c #C39936",
"i c #C49936",
"p c #C69C39",
"a c #C89C3A",
"s c #CCA23A",
"d c #AF9240",
"f c #B99644",
"g c #BE9C46",
"h c #BF9D4A",
"j c #BA9F58",
"k c #BEA04B",
"l c #BBA253",
"z c #BAA057",
"x c #C29E44",
"c c #C2A144",
"v c #CAA246",
"b c #CCA344",
"n c #CEA645",
"m c #C2A04A",
"M c #C7A349",
"N c #C5A34A",
"B c #C7A64D",
"V c #CFA649",
"C c #CEAA4C",
"Z c #D1A84B",
"A c #D4AC49",
"S c #D5AC49",
"D c #D7AD48",
"F c #D5AF4D",
"G c #C0A451",
"H c #CAA550",
"J c #CBAA58",
"K c #CAAD5D",
"L c #D9AD53",
"P c #DFB757",
"I c #D5B058",
"U c #D7B75D",
"Y c #DCB75A",
"T c #DFBB5E",
"R c #E1B957",
"E c #E3B759",
"W c #E6BC5B",
"Q c #E7BE5D",
"! c #E5BC5E",
"~ c #CAAE62",
"^ c #C8AF6A",
"/ c #CDB565",
"( c #CDB46D",
") c #D7B360",
"_ c #D5B862",
"` c #D1B66C",
"' c #D8BB68",
"] c #DBBA6E",
"[ c #DFBE6D",
"{ c #D0B872",
"} c #D2B974",
"| c #DABF74",
" . c #D8BF77",
".. c #D6BD79",
"X. c #D5BE7B",
"o. c #D7BF7A",
"O. c #E8BC61",
"+. c #DDC075",
"@. c #DCC279",
"#. c #DCC47E",
"$. c #EDC661",
"%. c #EEC562",
"&. c #E0C16B",
"*. c #E0C36B",
"=. c #E3C26A",
"-. c #E7C26A",
";. c #E3C569",
":. c #E3C26C",
">. c #E4C16C",
",. c #EEC969",
"<. c #F4C664",
"1. c #F0CA68",
"2. c #F7CA68",
"3. c #F6CD69",
"4. c #F7CD69",
"5. c #F7CF68",
"6. c #E6C374",
"7. c #E1C47A",
"8. c #E1C77B",
"9. c #E5C578",
"0. c #E4C579",
"q. c #E4C67A",
"w. c #E5C67C",
"e. c #E8C57B",
"r. c #E8CB7B",
"t. c #EDCC78",
"y. c #EBCB7C",
"u. c #F0CF73",
"i. c #F6CF74",
"p. c #F4D173",
"a. c #F7D072",
"s. c #F5D376",
"d. c #FAD071",
"f. c #FBD470",
"g. c #FAD572",
"h. c #FDD671",
"j. c #FDD773",
"k. c #F3DB76",
"l. c #F8D578",
"z. c #FBDB79",
"x. c #FFE57E",
"c. c #DEC681",
"v. c #DFC782",
"b. c #E0C682",
"n. c #E1C984",
"m. c #E2C985",
"M. c #E3CB87",
"N. c #E9C980",
"B. c #EBCC82",
"V. c #E3CC88",
"C. c #E4CF8D",
"Z. c #EFD187",
"A. c #EFD488",
"S. c #EFD58D",
"D. c #F6D581",
"F. c #F1D687",
"G. c #F9D680",
"H. c #F7DA8B",
"J. c #F2DE93",
"K. c #FADF93",
"L. c #F3DB98",
"P. c #F0DB9B",
"I. c #FEE081",
"U. c #FEE18C",
"Y. c #FCE38F",
"T. c #F7E98E",
"R. c #FFE88C",
"E. c #F6E491",
"W. c #FBEA91",
"Q. c #FFE897",
"!. c #FFEE9A",
"~. c #FEE99D",
"^. c #FEEC9F",
"/. c #FEF092",
"(. c #FFF29A",
"). c #FBE7A9",
"_. c #F4EDA8",
"`. c #FAEBAA",
"'. c #FEEBAD",
"]. c #FEFABD",
"[. c None",
/* pixels */
"[.[.[.[.[.3 f M m q [.[.[.[.[.[.",
"[.[.[.4 A 5.j.f.3.3.! 6 [.[.[.[.",
"[.[.9 %.h.%.D s n -.z.l.c % [.[.",
"[.1 1.g.S p i i C 6.7.W./.t [.[.",
"[._ U.Z e 7 7 y B | #.*.T.k.* [.",
", E.F.c.).).C.g K `.`.C.' x.r + ",
"d !.y.M.).j '.( ).L.h M I z.F + ",
"G (.t.M.'.'.C.j ).b.T Q O.d.R X ",
"k T.O.M.`.^ `.X.).V.;.! L i.E ",
"w I.6.c.'.).C.{ c.).).C.H d.v + ",
"[.,.u.~ } X.@.@.| .#.` V 2.5 ",
"[.x p.U J ] B.Z.9.) v a <.E o [.",
"[.[.Y s.-.[ 0.0.N.e.w.H.D.> + [.",
"[.[.2 &.).Y.A.S.L.`.]._.0 . [.[.",
"[.[.[.[.l r.Y.Q.~.J./ = $ [.[.[.",
"[.[.[.[.[.[.: 1 ; - & [.[.[.[.[."
};

226
xpm/bitcoin20.xpm Normal file
View File

@@ -0,0 +1,226 @@
/* XPM */
static const char * bitcoin20_xpm[] = {
/* columns rows colors chars-per-pixel */
"20 20 200 2",
" c #7B5500",
". c #7B5900",
"X c #735508",
"o c #7B5908",
"O c #7B5D08",
"+ c #7B5910",
"@ c #7B6118",
"# c #845D08",
"$ c #846108",
"% c #8C6510",
"& c #8C6910",
"* c #8C6918",
"= c #946D10",
"- c #947118",
"; c #9C7518",
": c #A57918",
"> c #846929",
", c #846D29",
"< c #947121",
"1 c #8C7539",
"2 c #947939",
"3 c #8C7542",
"4 c #AD8221",
"5 c #B58E29",
"6 c #B58E31",
"7 c #B59231",
"8 c #BD9231",
"9 c #BD9631",
"0 c #C69A31",
"q c #C69A39",
"w c #C69E39",
"e c #CE9E39",
"r c #CEA239",
"t c #948652",
"y c #A58A4A",
"u c #BD9642",
"i c #BD9A42",
"p c #B5964A",
"a c #B59A4A",
"s c #BD9E4A",
"d c #A58E5A",
"f c #BD9A52",
"g c #BD9E52",
"h c #BDA252",
"j c #BDA25A",
"k c #BD9E63",
"l c #A59673",
"z c #AD9A73",
"x c #AD9E7B",
"c c #BDA263",
"v c #BDA26B",
"b c #BDA273",
"n c #BDA673",
"m c #B5A27B",
"M c #BDAA7B",
"N c #C69E42",
"B c #CE9E42",
"V c #C6A242",
"C c #CEA242",
"Z c #CEA642",
"A c #C6A24A",
"S c #C6A64A",
"D c #CEA64A",
"F c #CEAA4A",
"G c #D6A642",
"H c #DEAE4A",
"J c #DEB24A",
"K c #C6A252",
"L c #C6A652",
"P c #CEAA52",
"I c #CEAE52",
"U c #C6A65A",
"Y c #C6AA5A",
"T c #CEAA5A",
"R c #CEAE5A",
"E c #D6AE52",
"W c #DEAE52",
"Q c #D6AE5A",
"! c #D6B252",
"~ c #DEB252",
"^ c #DEB652",
"/ c #D6B65A",
"( c #DEB65A",
") c #DEBA5A",
"_ c #EFBE52",
"` c #E7BA5A",
"' c #E7BE5A",
"] c #EFBE5A",
"[ c #C6A663",
"{ c #C6AE63",
"} c #CEAE63",
"| c #D6AE63",
" . c #CEB26B",
".. c #CEB66B",
"X. c #DEB663",
"o. c #D6BE63",
"O. c #DEBA63",
"+. c #DEBE63",
"@. c #D6B66B",
"#. c #DEB66B",
"$. c #D6BA6B",
"%. c #D6BE6B",
"&. c #DEBA6B",
"*. c #DEBE6B",
"=. c #D6BA73",
"-. c #DEBE73",
";. c #EFBE63",
":. c #E7BE73",
">. c #DEC37B",
",. c #E7C363",
"<. c #EFC763",
"1. c #EFCF63",
"2. c #E7C36B",
"3. c #E7C76B",
"4. c #EFC36B",
"5. c #EFC76B",
"6. c #E7CB6B",
"7. c #EFCB6B",
"8. c #F7CB63",
"9. c #F7CB6B",
"0. c #F7CF6B",
"q. c #FFCB6B",
"w. c #F7D36B",
"e. c #FFD36B",
"r. c #E7C373",
"t. c #E7CB73",
"y. c #EFCF73",
"u. c #E7C37B",
"i. c #E7C77B",
"p. c #E7CB7B",
"a. c #EFCB7B",
"s. c #F7CF73",
"d. c #EFD373",
"f. c #EFD37B",
"g. c #F7D373",
"h. c #FFD373",
"j. c #FFD773",
"k. c #FFDB73",
"l. c #F7DB7B",
"z. c #FFDF7B",
"x. c #ADA284",
"c. c #BDAA84",
"v. c #BDAE84",
"b. c #B5A68C",
"n. c #B5AE9C",
"m. c #BDB6A5",
"M. c #C6BA9C",
"N. c #C6BAA5",
"B. c #C6BEA5",
"V. c #DEC784",
"C. c #E7CB84",
"Z. c #E7CF84",
"A. c #EFCF84",
"S. c #E7CF8C",
"D. c #EFCF8C",
"F. c #EFD384",
"G. c #E7D38C",
"H. c #EFD38C",
"J. c #EFD78C",
"K. c #F7D784",
"L. c #FFD784",
"P. c #F7DB84",
"I. c #F7DF84",
"U. c #FFDB84",
"Y. c #FFDF84",
"T. c #F7DB8C",
"R. c #EFD394",
"E. c #EFD794",
"W. c #EFDB94",
"Q. c #EFDB9C",
"!. c #F7DB9C",
"~. c #F7DF9C",
"^. c #FFE384",
"/. c #FFE784",
"(. c #FFE38C",
"). c #FFEB8C",
"_. c #EFE79C",
"`. c #FFE794",
"'. c #FFEB94",
"]. c #FFEF94",
"[. c #FFEB9C",
"{. c #FFEF9C",
"}. c #FFF394",
"|. c #FFF794",
" X c #C6C3B5",
".X c #CEC7BD",
"XX c #F7E3A5",
"oX c #FFE7A5",
"OX c #F7EBA5",
"+X c #FFEBA5",
"@X c #FFEFA5",
"#X c #FFE7AD",
"$X c #FFEBAD",
"%X c #FFEFAD",
"&X c #FFF3AD",
"*X c #FFF7B5",
"=X c #FFFBB5",
"-X c #FFFFBD",
";X c #CEC7C6",
":X c None",
/* pixels */
":X:X:X:X:X:XM.v f i g k c..X:X:X:X:X:X:X",
":X:X:X:XM.u H 8.j.j.e.0.^ 7 d X:X:X:X:X",
":X:X:Xn Z 0.k.j.8._ ] 9.h.h.~ ; b.:X:X:X",
":X:Xn J j.j.' C 0 0 w E a.K.^.d.- x.:X:X",
":XN.F k.w.G w q 0 0 D 2.i.a.].|.6.$ m.:X",
":Xg (.U.C 9 8 8 8 q S *.H.f.y.].).9 , :X",
"B.o.{.p.-.>.>.>.R 7 N =.G.E.Z.&./.1.# n.",
"M I.[.| R.$X..~.#Xs V.$XG.h @.T l.z.; t ",
"c {.'.X.E.$Xj G.$XU #X$Xg ) ! ( 0.k.5 > ",
"j }.`.O.E.$XE.oXC.p $X$XA ,.' ;.5.j.9 o ",
"j ).I.Q E.$X .Q.#X .$X$XP 7.` W 4.j.8 X ",
"c z.Y.P R.$X[ S.$X{ XX$X$.) P D 5.h.4 @ ",
"v.<.Y.I R.$XW.oXXX} @.XX#XE.XXK 8.8.& 3 ",
".XC j.3.s a h Y .J.A.T Y h 6 e 8.H . x ",
":Xk <.g./ P #.i.F.A.r.X.E B r 9.q.: + :X",
":X.Xi s.g.+.O.r.i.u.i.u.:.r.L.L.N l :X",
":X:XN.V U.(.T.a.i.C.D.!.%X-X=X%.# 1 :X:X",
":X:X:XN.g _.+X`.[.+X@X&X*XOXh O 1 :X:X:X",
":X:X:X:X;Xb i +.f.P.K.t.L = o z :X:X:X:X",
":X:X:X:X:X:X.Xm y < % * 2 x :X:X:X:X:X:X"
};

223
xpm/bitcoin32.xpm Normal file
View File

@@ -0,0 +1,223 @@
/* XPM */
static const char * bitcoin32_xpm[] = {
/* columns rows colors chars-per-pixel */
"32 32 185 2",
" c #715103",
". c #725203",
"X c #725204",
"o c #735304",
"O c #745404",
"+ c #765504",
"@ c #775504",
"# c #785604",
"$ c #795704",
"% c #795705",
"& c #77580A",
"* c #77580B",
"= c #77580C",
"- c #785808",
"; c #785809",
": c #78590D",
"> c #795A0D",
", c #7F5E0D",
"< c #7C5C0E",
"1 c #815F0E",
"2 c #89650F",
"3 c #8C670F",
"4 c #8D680F",
"5 c #836110",
"6 c #866410",
"7 c #8F6A11",
"8 c #926C12",
"9 c #946F14",
"0 c #967015",
"q c #987217",
"w c #997318",
"e c #9A751C",
"r c #9B761E",
"t c #9C7720",
"y c #9D7924",
"u c #9D7B28",
"i c #9E7C2C",
"p c #A07F31",
"a c #AA852D",
"s c #A9852E",
"d c #AC872D",
"f c #AE892E",
"g c #AF8A2E",
"h c #B08B2F",
"j c #A18133",
"k c #A78533",
"l c #A28235",
"z c #A48435",
"x c #A68535",
"c c #A58536",
"v c #A68536",
"b c #A88530",
"n c #B18C30",
"m c #B18D33",
"M c #B08D37",
"N c #B08F3B",
"B c #B08F3D",
"V c #BC9537",
"C c #BE9736",
"Z c #BF9737",
"A c #B6933B",
"S c #B0903F",
"D c #B2913E",
"F c #B4923D",
"G c #B99438",
"H c #C09736",
"J c #C19835",
"K c #C29836",
"L c #C39937",
"P c #C39A37",
"I c #C49B38",
"U c #C59C3A",
"Y c #C69D3B",
"T c #C79E3C",
"R c #C89F3D",
"E c #CAA03F",
"W c #C6A247",
"Q c #CAA140",
"! c #C9A242",
"~ c #C8A245",
"^ c #C2A14B",
"/ c #C3A24D",
"( c #C3A24F",
") c #C2A351",
"_ c #C1A352",
"` c #C0A355",
"' c #C1A457",
"] c #C1A458",
"[ c #C1A55A",
"{ c #C2A65C",
"} c #C3A75D",
"| c #C3A85E",
" . c #C6AA5D",
".. c #C7AA5D",
"X. c #C5A95E",
"o. c #CFAE5A",
"O. c #C8AB5E",
"+. c #D4AF56",
"@. c #D1AE58",
"#. c #D6B056",
"$. c #D8B155",
"%. c #D9B256",
"&. c #DAB357",
"*. c #DBB457",
"=. c #DDB558",
"-. c #DFB759",
";. c #E2BB5B",
":. c #E3BC5D",
">. c #E4BD5E",
",. c #C9AC61",
"<. c #C9AD62",
"1. c #CAAE62",
"2. c #CCAF62",
"3. c #DDBC69",
"4. c #DFBD68",
"5. c #DCBB6E",
"6. c #DCBC6C",
"7. c #DBBC70",
"8. c #DABD72",
"9. c #DBBE74",
"0. c #E4BD61",
"q. c #E4BE60",
"w. c #E3BE65",
"e. c #E2BF66",
"r. c #DDC177",
"t. c #DFC279",
"y. c #EFCB6F",
"u. c #F1CA6B",
"i. c #F4CB6A",
"p. c #F5CC6A",
"a. c #F7CD6B",
"s. c #F0CA6D",
"d. c #F7CF6E",
"f. c #EFCD72",
"g. c #EFCE77",
"h. c #E0C47B",
"j. c #E3C77E",
"k. c #E4C87F",
"l. c #F7D070",
"z. c #F8D171",
"x. c #F8D272",
"c. c #FAD473",
"v. c #FBD676",
"b. c #FCD574",
"n. c #FCD674",
"m. c #FCD777",
"M. c #F0D17E",
"N. c #FCD778",
"B. c #FCDA7A",
"V. c #FDDC7C",
"C. c #FDDE7E",
"Z. c #E6CA80",
"A. c #E8CC83",
"S. c #EACD84",
"D. c #ECD086",
"F. c #EFD286",
"G. c #EED287",
"H. c #F0D283",
"J. c #FDDF80",
"K. c #F6DF91",
"L. c #F5DE92",
"P. c #F4DE95",
"I. c #F4DF98",
"U. c #FDE081",
"Y. c #FCE184",
"T. c #FBE188",
"R. c #FAE18B",
"E. c #F8E08D",
"W. c #F5E19B",
"Q. c #F5E29C",
"!. c #F7E49D",
"~. c #F9E69B",
"^. c #FBE89B",
"/. c #FDEB9B",
"(. c #FDEC9B",
"). c #FEEE9B",
"_. c #FEEF9C",
"`. c #FEEEA3",
"'. c #FDEBA9",
"]. c #FDEBAC",
"[. c #FDEBAD",
"{. c #FDECAD",
"}. c #FDF0B0",
"|. c #FDF2B1",
" X c None",
/* pixels */
" X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X",
" X X X X X X X X X X X Xc F z z F z j X X X X X X X X X X X X X",
" X X X X X X X X Xz b V ~ %.;.u.e.-.! f e i X X X X X X X X X X",
" X X X X X X Xz d ! >.a.l.B.v.c.a.a.a.a.>.R w 6 X X X X X X X X",
" X X X X X Xb L q.a.n.c.n.n.c.a.i.i.a.a.z.z.>.m 3 5 X X X X X X",
" X X X X Xs +.a.c.n.B.c.>.#.E E ! +.>.n.J.v.z.z.~ 8 & X X X X X",
" X X X Xs %.c.n.B.l.*.E Y L L L L W +.r.Z.H.Y.Y.R.+.7 ; X X X X",
" X X Xk %.n.J.n.>.! Y Y I L L L T *.w.h.7.5.K.).).).W 6 = X X X",
" X Xj T V.B.n.;.L L L I L L L Y ~ *.s.Z.G.D.B._._._.Y.h % > X X",
" X Xm H.R.Y.0.L H H L L C V C Y ! ..8.G.E.H.M.g._._.Y.q.8 o X X",
" Xj o.)./.K.@.^ A F M N M s n C W ) { <.9.9.2.X.#./.Y.C.m % > X",
" XM D.)._.t.,.[.[.[.[.{.[.W.A G C O.I.[.[.[.[.{.5.y.Y.B.*.2 o X",
" XA /.).~.%.{ [.[.[.| D.[.[.I.b ,.[.[.[.j.) ' D.5.@.Y.V.a.w . X",
"i O.).).E.3.X.[.[.[.S X.[.[.'.i Q.[.{.D.z X.~ A ) %.B.V.n.s + = ",
"z 6._._.R.w.<.[.[.[.S <.[.[.I.F [.[.[.X.) 0.>.;.>.>.l.B.n.C % > ",
"z e._._.H.e.,.[.[.[.j.W.[.D.S { [.[.].' -.>.>.>.e.0.s.N.n.Y % & ",
"v s.)._.M.3.O.[.].].W.'.[.].{ { [.[.[.' 3.e.;.;.%.-.s.N.n.R # . ",
"z ;.T.E.g.-.{ [.].].S <.[.{.].` [.[.[.<.e.f.e.*.$.$.s.V.n.L $ O ",
"j o.Y.Y.g.+.] {.].]._ | [.[.[.F ].[.[.A.) y.e.@.W @.s.N.n.h $ = ",
" XZ J.Y.N.@.' [.[.].F 7.[.[.].z h.[.[.].7.^ ^ 5.2.U z.z.a.r X = ",
" Xs n.V.Y.+.` [.[.].].].{.{.9.2...A.{.[.[.[.].[.2.! a.u.;.3 = ",
" XF *.m.B.s.^ X.,.{ ,.<.1.] 2.G.D.O.` 2.9.7.2.^ d ;.u.a.K $ X X",
" X Xm z.c.v.o.^ ^ ^ { <.7.Z.K.K.H.Z.6.o.^ A f h E a.i.0.w X = X",
" X Xz #.l.z.f.X.O.<.5.t.Z.D.D.A.j.7.*.@.^ ! Y ! i.a.a.Y , X X X",
" X X Xd u.l.z.y.o.o.3.r.j.Z.h.r.9.5.%.%.#.+.#.c.B.z.-.8 . & X X",
" X X Xj m f.c.v.l.s.3.4.h.t.r.k.D.G.H.D.A.D./.!.E.M.y + X X X X",
" X X X Xj Z v.J.T.R.E.Z.7.t.Z.A.S.H.D.Q.|.|.|.|.!.b % . X X X X",
" X X X X Xj A D.|.`.~.~.!.E.I.I.Q.{.|.|.|.|.|.D.u % X < X X X X",
" X X X X X Xj z 9.{.`.~.~.^././.`.`.`.}.|.Q.] 9 $ X X X X X X X",
" X X X X X X X Xj s X.k.Y.R.~.~./.~.K.h.) e , . = X X X X X X X",
" X X X X X X X X X X9 w t n A C A s r 3 $ X > X X X X X X X X X",
" X X X X X X X X X X X X X5 2 1 $ ; 5 5 5 X X X X X X X X X X X"
};

278
xpm/bitcoin48.xpm Normal file
View File

@@ -0,0 +1,278 @@
/* XPM */
static const char * bitcoin48_xpm[] = {
/* columns rows colors chars-per-pixel */
"48 48 224 2",
" c #715103",
". c #735203",
"X c #735204",
"o c #745405",
"O c #755506",
"+ c #775606",
"@ c #785707",
"# c #7A5806",
"$ c #7C5905",
"% c #7D5A05",
"& c #7E5B05",
"* c #7F5C07",
"= c #7E5C0A",
"- c #7B5C11",
"; c #7C5D13",
": c #7D5E15",
"> c #805C05",
", c #805C06",
"< c #8B6813",
"1 c #8D6912",
"2 c #8F6A12",
"3 c #896816",
"4 c #806219",
"5 c #82631A",
"6 c #876719",
"7 c #84651B",
"8 c #906C13",
"9 c #916D15",
"0 c #936F18",
"q c #94701B",
"w c #95721B",
"e c #98731A",
"r c #99741B",
"t c #99751E",
"y c #9A761F",
"u c #9B7822",
"i c #9F7A21",
"p c #9D7922",
"a c #A27C20",
"s c #A47E21",
"d c #A67F22",
"f c #9E8038",
"g c #9E803B",
"h c #9E813C",
"j c #9F833D",
"k c #A68023",
"l c #A78124",
"z c #A98326",
"x c #AA8427",
"c c #A7832B",
"v c #A7832C",
"b c #A6832D",
"n c #A98429",
"m c #A8842B",
"M c #AD892F",
"N c #AE8A2F",
"B c #AF8A2F",
"V c #B28B2E",
"C c #B48C2E",
"Z c #B68E2F",
"A c #B78E2F",
"S c #A38232",
"D c #A08136",
"F c #AC8931",
"G c #AB8934",
"H c #AA8836",
"J c #AA8937",
"K c #A1843F",
"L c #A2853F",
"P c #AB8A39",
"I c #AB8B3A",
"U c #AD8C3C",
"Y c #AE8E3E",
"T c #B89030",
"R c #BA9131",
"E c #BC9332",
"W c #BE9533",
"Q c #C09733",
"! c #C29834",
"~ c #C39934",
"^ c #C39935",
"/ c #C39A37",
"( c #C39A38",
") c #C49A38",
"_ c #C49B38",
"` c #C59C3A",
"' c #C69E3C",
"] c #C69E3E",
"[ c #C79F3F",
"{ c #A48640",
"} c #A58741",
"| c #A68842",
" . c #A78A43",
".. c #AA8D45",
"X. c #AD9046",
"o. c #B19040",
"O. c #B59443",
"+. c #B29447",
"@. c #B79745",
"#. c #B79847",
"$. c #B89846",
"%. c #B69748",
"&. c #C8A040",
"*. c #CAA241",
"=. c #CBA343",
"-. c #C9A346",
";. c #CBA445",
":. c #C7A44D",
">. c #C5A44F",
",. c #C9A448",
"<. c #C9A44A",
"1. c #C5A551",
"2. c #C4A554",
"3. c #CBAA57",
"4. c #CDAA57",
"5. c #C3A559",
"6. c #C4A65A",
"7. c #C7A85A",
"8. c #D0AB55",
"9. c #D2AD56",
"0. c #D4AE57",
"q. c #D4AF58",
"w. c #D5B05A",
"e. c #D5B15C",
"r. c #D5B25E",
"t. c #DFB65A",
"y. c #DEB75B",
"u. c #E1B759",
"i. c #E2B95B",
"p. c #E4BA5C",
"a. c #E4BC5F",
"s. c #D4B567",
"d. c #D8B764",
"f. c #D5B769",
"g. c #D4B76A",
"h. c #D4B86B",
"j. c #E5BD61",
"k. c #E6BE62",
"l. c #E6BF63",
"z. c #E0BF6F",
"x. c #E7C063",
"c. c #EAC263",
"v. c #EDC563",
"b. c #EBC364",
"n. c #EEC565",
"m. c #EEC767",
"M. c #E1C06F",
"N. c #EBC76D",
"B. c #EEC869",
"V. c #F7CD6A",
"C. c #F6CD6B",
"Z. c #F4CE6F",
"A. c #F8CD6A",
"S. c #F9CF6E",
"D. c #FAD16F",
"F. c #E1C071",
"G. c #E4C370",
"H. c #E1C174",
"J. c #E0C276",
"K. c #E1C377",
"L. c #E8C670",
"P. c #E2C479",
"I. c #E0C47A",
"U. c #E2C57C",
"Y. c #E3C77E",
"T. c #F3D073",
"R. c #FBD270",
"E. c #FCD572",
"W. c #FCD674",
"Q. c #FDD774",
"!. c #FED876",
"~. c #FED977",
"^. c #F2D278",
"/. c #F1D37B",
"(. c #FDDA78",
"). c #FDDB7A",
"_. c #FDDB7C",
"`. c #FDDD7D",
"'. c #FDDF7F",
"]. c #E4C880",
"[. c #E6CA83",
"{. c #E7CD86",
"}. c #E9CF89",
"|. c #EBD089",
" X c #EFD289",
".X c #F2D382",
"XX c #F0D387",
"oX c #FDDF80",
"OX c #FCDF84",
"+X c #FBDF89",
"@X c #F9DE8B",
"#X c #FBE08B",
"$X c #FBE28C",
"%X c #FCE48F",
"&X c #FDE592",
"*X c #FEE692",
"=X c #FEE693",
"-X c #FEE895",
";X c #FEEA96",
":X c #FEEC97",
">X c #FEEE98",
",X c #FEEE99",
"<X c #FEEE9A",
"1X c #FDEB9C",
"2X c #FCE99E",
"3X c #F7E4A4",
"4X c #FAE7A1",
"5X c #F8E5A3",
"6X c #F8E5A5",
"7X c #F8E5A6",
"8X c #F9E6A7",
"9X c #FCE8AA",
"0X c #FDEAAC",
"qX c #FDEBAC",
"wX c #FDECAC",
"eX c #FDEDAC",
"rX c #FDEEAD",
"tX c #FDF2B1",
"yX c #FDF4B3",
"uX c #FEF6B5",
"iX c #FEF8B7",
"pX c #FEF9B8",
"aX c #FEF8B9",
"sX c None",
/* pixels */
"sXsXsXsXsXsXsXsXsXsXsXsXsXsXsXsXsXsXsXsXsXsXsXsXsXsXsXsXsXsXsXsXsXsXsXsXsXsXsXsXsXsXsXsXsXsXsXsX",
"sXsXsXsXsXsXsXsXsXsXsXsXsXsXsXsXsXsXh ..X.........X...p sXsXsXsXsXsXsXsXsXsXsXsXsXsXsXsXsXsXsXsX",
"sXsXsXsXsXsXsXsXsXsXsXsXsXsXsX .P m l l l n V W R M z s p u K sXsXsXsXsXsXsXsXsXsXsXsXsXsXsXsXsX",
"sXsXsXsXsXsXsXsXsXsXsXsXsX .m l n _ q.l.C.A.E.(.`.!.m.u.-.B d q 1 3 sXsXsXsXsXsXsXsXsXsXsXsXsXsX",
"sXsXsXsXsXsXsXsXsXsXsX .n z W u.V.V.A.R.!.!.W.E.S.S.A.A.C.C.p.[ k e = 6 sXsXsXsXsXsXsXsXsXsXsXsX",
"sXsXsXsXsXsXsXsXsXsXG l R p.C.A.E.E.W.(.(.(.E.A.C.C.C.A.C.C.A.D.m.` s 1 * sXsXsXsXsXsXsXsXsXsXsX",
"sXsXsXsXsXsXsXsXg n n 9.C.V.A.E.!.(.(.!.!.R.A.V.C.C.C.A.C.S.D.R.D.V.i.M r & ; sXsXsXsXsXsXsXsXsX",
"sXsXsXsXsXsXsXL n C k.C.R.R.R.(.oXW.R.v.i.w.=.=.9.u.p.B.T.W._.(.W.Z.V.V./ p & # sXsXsXsXsXsXsXsX",
"sXsXsXsXsXsXL z R m.S.D.W.(.W.W.m.u.=._ ~ ~ ! ! ! ` ] <.y./.%X+X!.^.E.'.'.<.a * + sXsXsXsXsXsXsX",
"sXsXsXsXsXh n R m.R.!.!.!.(.A.0.*.=._ _ ~ Q / ! ! ] -.0.z.G.z.[.#X#X%X*X&X%X;.r * O sXsXsXsXsXsX",
"sXsXsXsXsXm Z C.R._.oX!.S.p.;.[ ] _ _ _ ~ ~ ^ _ ( -.w.a.N.U.z.s.M.*X>X>X:X:X%X' 0 O # sXsXsXsXsX",
"sXsXsXsXG n m.(.!.(.(.S.;.] [ _ ` _ ^ ^ ! Q ^ _ ` 9.k.M.U.K.U.H.U./.>X>X>X>X>X#XV < . - sXsXsXsX",
"sXsXsXh n w._._.(.W.S.;._ _ _ / _ _ _ _ Q Q / ` [ 9.d.G.H.|.XX@X#X#X).:X>X>X>X>Xm.a > sXsXsXsX",
"sXsXsXG @.#X+XOX_.R.8._ _ _ _ ! ^ _ ) ! W W _ ] [ <.r.h.{.@X6X&X#X#X).).>X>X>X;X#X' 8 + + sXsXsX",
"sXsXL M H.;X=X&X#Xk.] E R T Z T A A A A R E _ ` &.<.4.F.Y.[.U.H.z.h.z.L.^.>X>X;X'.m.k > : sXsX",
"sXsXP @.,X,X1X;X+X3.%.o.G H F m m b b a s z E _ [ 1.2.2.2.7.h.h.h.h.2.$.1.^.;X#X'.).` 2 . + sXsX",
"sXsXF f.<X1X1X;Xz.@.7X9XqXqXqXqX9X0X0X7XH.b F / -.$.+.U.3XqXqXqX0X0X0X3XH.1.%X#X`.'.c.y # sXsX",
"sX .F $X<X1X1X$Xr.Y 7XqXqXqXqXqX0X0X0X0XwX Xc W O.1.3X0XqXqXqXqX0X0X0X0X}.o.N.).`.`.`.B * - sX",
"sXP #.,X<X1X1X.Xr.P 7XqXqXqXqX6.{ 8X0X0X0X0X2.m @.6X0XwXqXqX X@.S Y s.6X{.Y y.#X'.`.`.*.2 . o sX",
"sXF q.,X<X1X,XL.r.U 7XqXqXqXqX5.6 |.0XwXwXwXh.u |.qXwX0XqX3Xf Y #.$.F P s.] w.(.'.`.~.y.w + X sX",
"sXM M.,X<X<X;XL.s.o.6X0XqXqXqX6.q U.0XwX0XwX7. .0X0XwX0XqX5.P 9.y.y.4.<.<.q.u.Z.'.).!.v.i $ - ",
"h M /.,X<X<X=XN.z.O.6X0XqXqXqX6.2 |.wX0X0X0X+.5.wXwX0XwXqXG :.k.k.p.a.a.k.k.k.B.`.~.E.V.k $ - ",
"| B OX,X<X<X$XT.z.O.6X0XqXqXqXh.X.0X0XwX0X].q h.0XwXwX0X6XS 4.b.l.c.c.m.m.c.k.c.`.E.E.E.k & . = ",
"| M $X:X<X,X+XT.z.O.6XwXqXqXqX0XwXwX0X9X5.q u U.wX0X0X0X6XS 0.b.k.p.i.k.k.p.p.k.).~.E.E.x * . + ",
"L M #X;X>X>X/.L.d.o.6X0X0XwXwX0X0XwXwX0X9XI.u I.0XwXqXqX3XG r.B.c.i.u.u.u.u.y.p.`.!.E.E.x * X ",
" .n ^.&X;X;X.Xx.d.Y 6X0XwX0X0X5.u 3X0XwXwX9X5.h.wX0XqXqX6XP d.T.N.c.i.u.y.0.0.k.(.!.W.E.k * X ",
"L x C.'.*X&X^.j.r.P 7XqX0XwX0X6.0 I.wX0XwX0XI.@.0XqXqXqX0X+.q.T.T.N.a.y.9.8.9.l._.!.!.D.s $ - ",
"sXx k.#X#X$X.Xy.8.G 3XqXwX0XwX7.u I.0XwX0XwX}.u qXqXqXqX0Xh.$.G.T.N.p.9.-.-.8.N._.!.E.b.i # X : ",
"sXc 9.'.'.#X'.y.4.H 7XqX0XwX0X6.q ].9XwX0XwXU.u {.0XwX0XwX8X%.#.w.4.$.#.f.W -.Z.W.R.R.y.r O = ",
"sXN _ '.'.'.#Xx.3.P 7XqXwX0XwXh.+.8XwX0X0X0X7.X.#.8X0XwX0XwX6Xh.2.5.U.6X{.F *.R.R.R.S.*.1 ; ",
"sXX.x E.`.).`.T.1.G 8XwX0XwXwX0XwX0X0XwX0X}.%.h.7.5.3X0X0XwX0XwXwX0X0X0X[.z 9.A.V.V.V.n * X sX",
"sXg x y.~.).).#X4.o.3X3X3X3X3X3X3X7X3X Xh.%.h. X|.3.#.h.3X0X0X0X0X0X8X}.2.V c.A.C.V.i.e # X X sX",
"sXsXn W E.E.).`.L.$.P g u p f D d . .+.6.U. X@X@X}.f.1.U Y %.%.+.H y e l &.A.A.V.V.' 8 X ; sX",
"sXsX..x k.T.T.T.W.9.#.#.#.#.1.7.4.s.h.z.}.}.@X@X X X].z.d.3.:.@.V V V C E c.A.A.A.c.s > sXsX",
"sXsXsXb W T.T.T./.T.:.1.3.4.r.h.z.].[. X X X X X[.Y.H.z.z.d.0.;.` / Q Q u.A.A.A.D.*.9 O X # sXsX",
"sXsXsX| l y.T.T.T./.N.<.1.4.r.f.z.z.].[.{.{.[.].H.z.s.r.8.8.-.-.*.] ] u.D.E.D.D.k.a > sXsXsX",
"sXsXsXsXn F B.T.T.T.^.N.1.4.w.s.z.z.U.[.{.].J.J.H.F.h.r.w.r.w.0.8.8.k.W.W.R.D.T.Z 1 O @ sXsXsX",
"sXsXsXsXf x W T.T.T.^./.T.r.r.d.z.L.U.].U.z.z.P.Y.[.[.U.P.F.G.h.h..X@XOXOX.X.X<.9 # sXsXsXsX",
"sXsXsXsXsXL x [ W.W.W.)._.OXN.d.z.z.I.U.I.z.U. X.X X XXXXX X XXXwXyX,X1X1X=Xs.p > X ; sXsXsXsX",
"sXsXsXsXsXsX| x :._.oX_.OX$X=X+X/.G.h.z.I.].}.}.|.|. X X X3XtXpXpXpXpXpXaXP.a > X - sXsXsXsXsX",
"sXsXsXsXsXsXsX{ c <.+X@X=X;X;X&X=X&XXX[.U.P.U.].[.}.XX3XyXpXpXpXpXpXpXpXh.a > O sXsXsXsXsXsX",
"sXsXsXsXsXsXsXsXL c @.+XpXpXuX1X=X=X;X1X1X1X1XrXwXwXyXyXyXuXpXaXpXuX3X2.u > . @ sXsXsXsXsXsXsX",
"sXsXsXsXsXsXsXsXsXj n Y I.aXaX0X=X=X&X;X=X1X1X1X<X0XwXwXwXyXyXyXwXU.F 9 $ - sXsXsXsXsXsXsXsX",
"sXsXsXsXsXsXsXsXsXsXsX| l o.h.@X&X&X&X&X=X-X-X-X<X2X2X<XwXwX4XH.O.y * @ 5 sXsXsXsXsXsXsXsXsX",
"sXsXsXsXsXsXsXsXsXsXsXsXh p a F :.M..X%X&X&X&X=X=X=X=X@XI.3.F u < $ @ sXsXsXsXsXsXsXsXsXsXsX",
"sXsXsXsXsXsXsXsXsXsXsXsXsXsXy w w a z V ( -.:.:.1.@.V l p 9 * # # sXsXsXsXsXsXsXsXsXsXsXsXsX",
"sXsXsXsXsXsXsXsXsXsXsXsXsXsXsXsXsXq : < 1 9 8 8 8 3 = * @ X X X 6 sXsXsXsXsXsXsXsXsXsXsXsXsXsXsX",
"sXsXsXsXsXsXsXsXsXsXsXsXsXsXsXsXsXsXsXsX5 5 6 : O O @ : 6 5 sXsXsXsXsXsXsXsXsXsXsXsXsXsXsXsXsXsX"
};

41
xpm/check.xpm Normal file
View File

@@ -0,0 +1,41 @@
/* XPM */
static const char * check_xpm[] = {
/* columns rows colors chars-per-pixel */
"32 32 3 1",
" c #008000",
". c #00FF00",
"X c None",
/* pixels */
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXXX XXXXXXXXXXXX",
"XXXXXXXXXXXXXXXXX . XXXXXXXXXXX",
"XXXXXXXXXXXXXXXX .. XXXXXXXXXXXX",
"XXXXXXXXXXXXXXXX . XXXXXXXXXXXX",
"XXXXXXXXXXXXXXX .. XXXXXXXXXXXXX",
"XXXXXXXXXXX XX . XXXXXXXXXXXXX",
"XXXXXXXXXXX . .. XXXXXXXXXXXXXX",
"XXXXXXXXXXX .. . XXXXXXXXXXXXXX",
"XXXXXXXXXXXX ... XXXXXXXXXXXXXXX",
"XXXXXXXXXXXXX . XXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXX XXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
};

278
xpm/send16.xpm Normal file
View File

@@ -0,0 +1,278 @@
/* XPM */
static const char * send16_xpm[] = {
/* columns rows colors chars-per-pixel */
"16 16 256 2",
" c #ADF7AD",
". c #9CFF9C",
"X c None",
"o c #ADEFAD",
"O c #94FF94",
"+ c #D6CECE",
"@ c #8CFF8C",
"# c #CECECE",
"$ c #CECEC5",
"% c #84FF84",
"& c #CEC5C5",
"* c #73FF73",
"= c #C5C5C5",
"- c #6BFF6B",
"; c #73F773",
": c #C5BDBD",
"> c #6BF76B",
", c #BDBDBD",
"< c #63F763",
"1 c #B5B5B5",
"2 c #52F752",
"3 c #42FF42",
"4 c #3AFF3A",
"5 c #ADADAD",
"6 c #ADADA5",
"7 c #4AEF4A",
"8 c #29FF29",
"9 c #A5A5A5",
"0 c #42E642",
"q c #9CA59C",
"w c #3AE63A",
"e c #10FF10",
"r c #08FF08",
"t c #949C94",
"y c #00FF00",
"u c #00F700",
"i c #8C948C",
"p c #00EF00",
"a c #08E608",
"s c #10DE10",
"d c #00E600",
"f c #00DE00",
"g c #19C519",
"h c #00CE00",
"j c #00C500",
"k c #008C00",
"l c #008400",
"z c #669900",
"x c #999900",
"c c #CC9900",
"v c #FF9900",
"b c #00CC00",
"n c #33CC00",
"m c #66CC00",
"M c #99CC00",
"N c #CCCC00",
"B c #FFCC00",
"V c #66FF00",
"C c #99FF00",
"Z c #CCFF00",
"A c #000033",
"S c #330033",
"D c #660033",
"F c #990033",
"G c #CC0033",
"H c #FF0033",
"J c #003333",
"K c #333333",
"L c #663333",
"P c #993333",
"I c #CC3333",
"U c #FF3333",
"Y c #006633",
"T c #336633",
"R c #666633",
"E c #996633",
"W c #CC6633",
"Q c #FF6633",
"! c #009933",
"~ c #339933",
"^ c #669933",
"/ c #999933",
"( c #CC9933",
") c #FF9933",
"_ c #00CC33",
"` c #33CC33",
"' c #66CC33",
"] c #99CC33",
"[ c #CCCC33",
"{ c #FFCC33",
"} c #33FF33",
"| c #66FF33",
" . c #99FF33",
".. c #CCFF33",
"X. c #FFFF33",
"o. c #000066",
"O. c #330066",
"+. c #660066",
"@. c #990066",
"#. c #CC0066",
"$. c #FF0066",
"%. c #003366",
"&. c #333366",
"*. c #663366",
"=. c #993366",
"-. c #CC3366",
";. c #FF3366",
":. c #006666",
">. c #336666",
",. c #666666",
"<. c #996666",
"1. c #CC6666",
"2. c #009966",
"3. c #339966",
"4. c #669966",
"5. c #999966",
"6. c #CC9966",
"7. c #FF9966",
"8. c #00CC66",
"9. c #33CC66",
"0. c #99CC66",
"q. c #CCCC66",
"w. c #FFCC66",
"e. c #00FF66",
"r. c #33FF66",
"t. c #99FF66",
"y. c #CCFF66",
"u. c #FF00CC",
"i. c #CC00FF",
"p. c #009999",
"a. c #993399",
"s. c #990099",
"d. c #CC0099",
"f. c #000099",
"g. c #333399",
"h. c #660099",
"j. c #CC3399",
"k. c #FF0099",
"l. c #006699",
"z. c #336699",
"x. c #663399",
"c. c #996699",
"v. c #CC6699",
"b. c #FF3399",
"n. c #339999",
"m. c #669999",
"M. c #999999",
"N. c #CC9999",
"B. c #FF9999",
"V. c #00CC99",
"C. c #33CC99",
"Z. c #66CC66",
"A. c #99CC99",
"S. c #CCCC99",
"D. c #FFCC99",
"F. c #00FF99",
"G. c #33FF99",
"H. c #66CC99",
"J. c #99FF99",
"K. c #CCFF99",
"L. c #FFFF99",
"P. c #0000CC",
"I. c #330099",
"U. c #6600CC",
"Y. c #9900CC",
"T. c #CC00CC",
"R. c #003399",
"E. c #3333CC",
"W. c #6633CC",
"Q. c #9933CC",
"!. c #CC33CC",
"~. c #FF33CC",
"^. c #0066CC",
"/. c #3366CC",
"(. c #666699",
"). c #9966CC",
"_. c #CC66CC",
"`. c #FF6699",
"'. c #0099CC",
"]. c #3399CC",
"[. c #6699CC",
"{. c #9999CC",
"}. c #CC99CC",
"|. c #FF99CC",
" X c #00CCCC",
".X c #33CCCC",
"XX c #66CCCC",
"oX c #99CCCC",
"OX c #CCCCCC",
"+X c #FFCCCC",
"@X c #00FFCC",
"#X c #33FFCC",
"$X c #66FF99",
"%X c #99FFCC",
"&X c #CCFFCC",
"*X c #FFFFCC",
"=X c #3300CC",
"-X c #6600FF",
";X c #9900FF",
":X c #0033CC",
">X c #3333FF",
",X c #6633FF",
"<X c #9933FF",
"1X c #CC33FF",
"2X c #FF33FF",
"3X c #0066FF",
"4X c #3366FF",
"5X c #6666CC",
"6X c #9966FF",
"7X c #CC66FF",
"8X c #FF66CC",
"9X c #0099FF",
"0X c #3399FF",
"qX c #6699FF",
"wX c #9999FF",
"eX c #CC99FF",
"rX c #FF99FF",
"tX c #00CCFF",
"yX c #33CCFF",
"uX c #66CCFF",
"iX c #99CCFF",
"pX c #CCCCFF",
"aX c #FFCCFF",
"sX c #33FFFF",
"dX c #66FFCC",
"fX c #99FFFF",
"gX c #CCFFFF",
"hX c #FF6666",
"jX c #66FF66",
"kX c #FFFF66",
"lX c #6666FF",
"zX c #FF66FF",
"xX c #66FFFF",
"cX c #A50021",
"vX c #5F5F5F",
"bX c #777777",
"nX c #868686",
"mX c #969696",
"MX c #CBCBCB",
"NX c #B2B2B2",
"BX c #D7D7D7",
"VX c #DDDDDD",
"CX c #E3E3E3",
"ZX c #EAEAEA",
"AX c #F1F1F1",
"SX c #F8F8F8",
"DX c #FFFBF0",
"FX c #A0A0A4",
"GX c #808080",
"HX c #FF0000",
"JX c #00FF00",
"KX c #FFFF00",
"LX c #0000FF",
"PX c #FF00FF",
"IX c #00FFFF",
"UX c #FFFFFF",
/* pixels */
"X X X X X X X k k X X X X X X X ",
"X X X X X X X k j k X X X X X X ",
"X X X X X X X k o j k X X X X X ",
"X X X X X X X k * o j k X X X X ",
"l k k k k k k k * * . j k X X X ",
"l @ @ @ @ @ @ @ 4 e e % j k X X ",
"l O 3 8 e r r r r r r e ; j k X ",
"l @ e e r r r r r u p a f < j k ",
"l @ r u p a a a a a f f w j k i ",
"l O ; ; ; ; ; < a f b 0 j k t : ",
"l k k k k k k k s j 7 j k q = X ",
"X $ = = = = = k g 7 j k 9 & X X ",
"X X X X X X X k 2 j k 6 $ X X X ",
"X X X X X X X k j k 5 + X X X X ",
"X X X X X X X k k 1 + X X X X X ",
"X X X X X X X = , X X X X X X X "
};

278
xpm/send16noshadow.xpm Normal file
View File

@@ -0,0 +1,278 @@
/* XPM */
static const char * send16noshadow_xpm[] = {
/* columns rows colors chars-per-pixel */
"16 16 256 2",
" c #ADF7AD",
". c #9CFF9C",
"X c None",
"o c #ADEFAD",
"O c #94FF94",
"+ c #D6CECE",
"@ c #8CFF8C",
"# c #CECECE",
"$ c #CECEC5",
"% c #84FF84",
"& c #CEC5C5",
"* c #73FF73",
"= c #C5C5C5",
"- c #6BFF6B",
"; c #73F773",
": c #C5BDBD",
"> c #6BF76B",
", c #BDBDBD",
"< c #63F763",
"1 c #B5B5B5",
"2 c #52F752",
"3 c #42FF42",
"4 c #3AFF3A",
"5 c #ADADAD",
"6 c #ADADA5",
"7 c #4AEF4A",
"8 c #29FF29",
"9 c #A5A5A5",
"0 c #42E642",
"q c #9CA59C",
"w c #3AE63A",
"e c #10FF10",
"r c #08FF08",
"t c #949C94",
"y c #00FF00",
"u c #00F700",
"i c #8C948C",
"p c #00EF00",
"a c #08E608",
"s c #10DE10",
"d c #00E600",
"f c #00DE00",
"g c #19C519",
"h c #00CE00",
"j c #00C500",
"k c #008C00",
"l c #008400",
"z c #669900",
"x c #999900",
"c c #CC9900",
"v c #FF9900",
"b c #00CC00",
"n c #33CC00",
"m c #66CC00",
"M c #99CC00",
"N c #CCCC00",
"B c #FFCC00",
"V c #66FF00",
"C c #99FF00",
"Z c #CCFF00",
"A c #000033",
"S c #330033",
"D c #660033",
"F c #990033",
"G c #CC0033",
"H c #FF0033",
"J c #003333",
"K c #333333",
"L c #663333",
"P c #993333",
"I c #CC3333",
"U c #FF3333",
"Y c #006633",
"T c #336633",
"R c #666633",
"E c #996633",
"W c #CC6633",
"Q c #FF6633",
"! c #009933",
"~ c #339933",
"^ c #669933",
"/ c #999933",
"( c #CC9933",
") c #FF9933",
"_ c #00CC33",
"` c #33CC33",
"' c #66CC33",
"] c #99CC33",
"[ c #CCCC33",
"{ c #FFCC33",
"} c #33FF33",
"| c #66FF33",
" . c #99FF33",
".. c #CCFF33",
"X. c #FFFF33",
"o. c #000066",
"O. c #330066",
"+. c #660066",
"@. c #990066",
"#. c #CC0066",
"$. c #FF0066",
"%. c #003366",
"&. c #333366",
"*. c #663366",
"=. c #993366",
"-. c #CC3366",
";. c #FF3366",
":. c #006666",
">. c #336666",
",. c #666666",
"<. c #996666",
"1. c #CC6666",
"2. c #009966",
"3. c #339966",
"4. c #669966",
"5. c #999966",
"6. c #CC9966",
"7. c #FF9966",
"8. c #00CC66",
"9. c #33CC66",
"0. c #99CC66",
"q. c #CCCC66",
"w. c #FFCC66",
"e. c #00FF66",
"r. c #33FF66",
"t. c #99FF66",
"y. c #CCFF66",
"u. c #FF00CC",
"i. c #CC00FF",
"p. c #009999",
"a. c #993399",
"s. c #990099",
"d. c #CC0099",
"f. c #000099",
"g. c #333399",
"h. c #660099",
"j. c #CC3399",
"k. c #FF0099",
"l. c #006699",
"z. c #336699",
"x. c #663399",
"c. c #996699",
"v. c #CC6699",
"b. c #FF3399",
"n. c #339999",
"m. c #669999",
"M. c #999999",
"N. c #CC9999",
"B. c #FF9999",
"V. c #00CC99",
"C. c #33CC99",
"Z. c #66CC66",
"A. c #99CC99",
"S. c #CCCC99",
"D. c #FFCC99",
"F. c #00FF99",
"G. c #33FF99",
"H. c #66CC99",
"J. c #99FF99",
"K. c #CCFF99",
"L. c #FFFF99",
"P. c #0000CC",
"I. c #330099",
"U. c #6600CC",
"Y. c #9900CC",
"T. c #CC00CC",
"R. c #003399",
"E. c #3333CC",
"W. c #6633CC",
"Q. c #9933CC",
"!. c #CC33CC",
"~. c #FF33CC",
"^. c #0066CC",
"/. c #3366CC",
"(. c #666699",
"). c #9966CC",
"_. c #CC66CC",
"`. c #FF6699",
"'. c #0099CC",
"]. c #3399CC",
"[. c #6699CC",
"{. c #9999CC",
"}. c #CC99CC",
"|. c #FF99CC",
" X c #00CCCC",
".X c #33CCCC",
"XX c #66CCCC",
"oX c #99CCCC",
"OX c #CCCCCC",
"+X c #FFCCCC",
"@X c #00FFCC",
"#X c #33FFCC",
"$X c #66FF99",
"%X c #99FFCC",
"&X c #CCFFCC",
"*X c #FFFFCC",
"=X c #3300CC",
"-X c #6600FF",
";X c #9900FF",
":X c #0033CC",
">X c #3333FF",
",X c #6633FF",
"<X c #9933FF",
"1X c #CC33FF",
"2X c #FF33FF",
"3X c #0066FF",
"4X c #3366FF",
"5X c #6666CC",
"6X c #9966FF",
"7X c #CC66FF",
"8X c #FF66CC",
"9X c #0099FF",
"0X c #3399FF",
"qX c #6699FF",
"wX c #9999FF",
"eX c #CC99FF",
"rX c #FF99FF",
"tX c #00CCFF",
"yX c #33CCFF",
"uX c #66CCFF",
"iX c #99CCFF",
"pX c #CCCCFF",
"aX c #FFCCFF",
"sX c #33FFFF",
"dX c #66FFCC",
"fX c #99FFFF",
"gX c #CCFFFF",
"hX c #FF6666",
"jX c #66FF66",
"kX c #FFFF66",
"lX c #6666FF",
"zX c #FF66FF",
"xX c #66FFFF",
"cX c #A50021",
"vX c #5F5F5F",
"bX c #777777",
"nX c #868686",
"mX c #969696",
"MX c #CBCBCB",
"NX c #B2B2B2",
"BX c #D7D7D7",
"VX c #DDDDDD",
"CX c #E3E3E3",
"ZX c #EAEAEA",
"AX c #F1F1F1",
"SX c #F8F8F8",
"DX c #FFFBF0",
"FX c #A0A0A4",
"GX c #808080",
"HX c #FF0000",
"JX c #00FF00",
"KX c #FFFF00",
"LX c #0000FF",
"PX c #FF00FF",
"IX c #00FFFF",
"UX c #FFFFFF",
/* pixels */
"X X X X X X X k k X X X X X X X ",
"X X X X X X X k j k X X X X X X ",
"X X X X X X X k o j k X X X X X ",
"X X X X X X X k * o j k X X X X ",
"l k k k k k k k * * . j k X X X ",
"l @ @ @ @ @ @ @ 4 e e % j k X X ",
"l O 3 8 e r r r r r r e ; j k X ",
"l @ e e r r r r r u p a f < j k ",
"l @ r u p a a a a a f f w j k X ",
"l O ; ; ; ; ; < a f b 0 j k X X ",
"l k k k k k k k s j 7 j k X X X ",
"X X X X X X X k g 7 j k X X X X ",
"X X X X X X X k 2 j k X X X X X ",
"X X X X X X X k j k X X X X X X ",
"X X X X X X X k k X X X X X X X ",
"X X X X X X X X X X X X X X X X "
};

282
xpm/send20.xpm Normal file
View File

@@ -0,0 +1,282 @@
/* XPM */
static const char * send20_xpm[] = {
/* columns rows colors chars-per-pixel */
"20 20 256 2",
" c #CEFFCE",
". c #BDFFBD",
"X c #C5F7C5",
"o c #B5FFB5",
"O c #ADFFAD",
"+ c #A5FFA5",
"@ c #9CFF9C",
"# c None",
"$ c #94FF94",
"% c #D6CECE",
"& c #8CFF8C",
"* c #CECEC5",
"= c #84FF84",
"- c #94EF94",
"; c #7BFF7B",
": c #CEC5C5",
"> c #73FF73",
", c #C5C5C5",
"< c #C5C5BD",
"1 c #6BFF6B",
"2 c #BDC5B5",
"3 c #63FF63",
"4 c #6BF76B",
"5 c #BDBDBD",
"6 c #BDBDB5",
"7 c #5AFF5A",
"8 c #63F763",
"9 c #B5BDB5",
"0 c #B5BDAD",
"q c #52FF52",
"w c #BDB5B5",
"e c #5AF75A",
"r c #B5B5B5",
"t c #B5B5AD",
"y c #52F752",
"u c #42FF42",
"i c #52EF52",
"p c #ADADAD",
"a c #ADADA5",
"s c #4AEF4A",
"d c #31FF31",
"f c #29FF29",
"g c #A5A5A5",
"h c #21FF21",
"j c #5AD65A",
"k c #42E642",
"l c #94AD94",
"z c #4ADE4A",
"x c #3AE63A",
"c c #5ACE5A",
"v c #10FF10",
"b c #9C9C9C",
"n c #31E631",
"m c #08FF08",
"M c #949C94",
"N c #84A584",
"B c #00FF00",
"V c #3AD63A",
"C c #52C552",
"Z c #00F700",
"A c #8C948C",
"S c #849484",
"D c #00EF00",
"F c #739C73",
"G c #08E608",
"H c #4AB54A",
"J c #31C531",
"K c #00E600",
"L c #739473",
"P c #00DE00",
"I c #63945A",
"U c #6B8C6B",
"Y c #00D600",
"T c #42A542",
"R c #638C63",
"E c #00CE00",
"W c #21B521",
"Q c #5A8C5A",
"! c #00C500",
"~ c #528C52",
"^ c #3A9C3A",
"/ c #4A8C4A",
"( c #00BD00",
") c #319431",
"_ c #219C21",
"` c #318C31",
"' c #3A843A",
"] c #219421",
"[ c #298C29",
"{ c #318431",
"} c #218C21",
"| c #218C19",
" . c #198C19",
".. c #218421",
"X. c #297B29",
"o. c #198419",
"O. c #217B21",
"+. c #108410",
"@. c #197B19",
"#. c #CC0066",
"$. c #FF0066",
"%. c #003366",
"&. c #333366",
"*. c #663366",
"=. c #993366",
"-. c #CC3366",
";. c #FF3366",
":. c #006666",
">. c #336666",
",. c #666666",
"<. c #996666",
"1. c #CC6666",
"2. c #009966",
"3. c #339966",
"4. c #669966",
"5. c #999966",
"6. c #CC9966",
"7. c #FF9966",
"8. c #00CC66",
"9. c #33CC66",
"0. c #99CC66",
"q. c #CCCC66",
"w. c #FFCC66",
"e. c #00FF66",
"r. c #33FF66",
"t. c #99FF66",
"y. c #CCFF66",
"u. c #FF00CC",
"i. c #CC00FF",
"p. c #009999",
"a. c #993399",
"s. c #990099",
"d. c #CC0099",
"f. c #000099",
"g. c #333399",
"h. c #660099",
"j. c #CC3399",
"k. c #FF0099",
"l. c #006699",
"z. c #336699",
"x. c #663399",
"c. c #996699",
"v. c #CC6699",
"b. c #FF3399",
"n. c #339999",
"m. c #669999",
"M. c #999999",
"N. c #CC9999",
"B. c #FF9999",
"V. c #00CC99",
"C. c #33CC99",
"Z. c #66CC66",
"A. c #99CC99",
"S. c #CCCC99",
"D. c #FFCC99",
"F. c #00FF99",
"G. c #33FF99",
"H. c #66CC99",
"J. c #99FF99",
"K. c #CCFF99",
"L. c #FFFF99",
"P. c #0000CC",
"I. c #330099",
"U. c #6600CC",
"Y. c #9900CC",
"T. c #CC00CC",
"R. c #003399",
"E. c #3333CC",
"W. c #6633CC",
"Q. c #9933CC",
"!. c #CC33CC",
"~. c #FF33CC",
"^. c #0066CC",
"/. c #3366CC",
"(. c #666699",
"). c #9966CC",
"_. c #CC66CC",
"`. c #FF6699",
"'. c #0099CC",
"]. c #3399CC",
"[. c #6699CC",
"{. c #9999CC",
"}. c #CC99CC",
"|. c #FF99CC",
" X c #00CCCC",
".X c #33CCCC",
"XX c #66CCCC",
"oX c #99CCCC",
"OX c #CCCCCC",
"+X c #FFCCCC",
"@X c #00FFCC",
"#X c #33FFCC",
"$X c #66FF99",
"%X c #99FFCC",
"&X c #CCFFCC",
"*X c #FFFFCC",
"=X c #3300CC",
"-X c #6600FF",
";X c #9900FF",
":X c #0033CC",
">X c #3333FF",
",X c #6633FF",
"<X c #9933FF",
"1X c #CC33FF",
"2X c #FF33FF",
"3X c #0066FF",
"4X c #3366FF",
"5X c #6666CC",
"6X c #9966FF",
"7X c #CC66FF",
"8X c #FF66CC",
"9X c #0099FF",
"0X c #3399FF",
"qX c #6699FF",
"wX c #9999FF",
"eX c #CC99FF",
"rX c #FF99FF",
"tX c #00CCFF",
"yX c #33CCFF",
"uX c #66CCFF",
"iX c #99CCFF",
"pX c #CCCCFF",
"aX c #FFCCFF",
"sX c #33FFFF",
"dX c #66FFCC",
"fX c #99FFFF",
"gX c #CCFFFF",
"hX c #FF6666",
"jX c #66FF66",
"kX c #FFFF66",
"lX c #6666FF",
"zX c #FF66FF",
"xX c #66FFFF",
"cX c #A50021",
"vX c #5F5F5F",
"bX c #777777",
"nX c #868686",
"mX c #969696",
"MX c #CBCBCB",
"NX c #B2B2B2",
"BX c #D7D7D7",
"VX c #DDDDDD",
"CX c #E3E3E3",
"ZX c #EAEAEA",
"AX c #F1F1F1",
"SX c #F8F8F8",
"DX c #FFFBF0",
"FX c #A0A0A4",
"GX c #808080",
"HX c #FF0000",
"JX c #00FF00",
"KX c #FFFF00",
"LX c #0000FF",
"PX c #FF00FF",
"IX c #00FFFF",
"UX c #FFFFFF",
/* pixels */
"# # # # # # # # # # # # # # # # # # # # ",
"# # # # # # # ` 0 # # # # # # # # # # # ",
"# # # # # # # ..` l # # # # # # # # # # ",
"# # # # # # # [ X ) N # # # # # # # # # ",
"# # # # # # # [ &X. ^ F # # # # # # # # ",
"# # # # # # # } o & o T I : # # # # # # ",
"` ` ` ` ` ` ` ` + 7 ; + H ~ < # # # # # ",
"` = = = = = = - @ d v h $ C ' 5 # # # # ",
"` = = 3 u h v v v m m m v ; c { 6 # # # ",
"` = f v v m m m m m m Z G G 4 j ..t # # ",
"` = v m m m Z Z D D G G G P n ; _ R 5 # ",
"` = m Z G G G G G G G P Y x 4 _ Q g # # ",
"` = $ $ $ $ $ & e P P E k 8 .U g # # # ",
"..[ ......[ [ ] e Y ! s i o.L p # # # # ",
"# # 5 6 6 6 9 ..i ( i z o.S t # # # # # ",
"# # # # # # # } i i V O.A r # # # # # # ",
"# # # # # # # } 7 J X.M 6 # # # # # # # ",
"# # # # # # # | W ' b < # # # # # # # # ",
"# # # # # # # @.~ g , # # # # # # # # # ",
"# # # # # # # 6 < , # # # # # # # # # # "
};