diff --git a/modules/ripple_data/format/ripple_FieldNames.cpp b/modules/ripple_data/protocol/ripple_FieldNames.cpp similarity index 96% rename from modules/ripple_data/format/ripple_FieldNames.cpp rename to modules/ripple_data/protocol/ripple_FieldNames.cpp index 17d947d4bf..86f3c9697f 100644 --- a/modules/ripple_data/format/ripple_FieldNames.cpp +++ b/modules/ripple_data/protocol/ripple_FieldNames.cpp @@ -14,7 +14,7 @@ SField sfIndex(STI_HASH256, 258, "index"); #define FIELD(name, type, index) SField sf##name(FIELD_CODE(STI_##type, index), STI_##type, index, #name); #define TYPE(name, type, index) -#include "../format/ripple_SerializeDeclarations.h" +#include "../protocol/ripple_SerializeDeclarations.h" #undef FIELD #undef TYPE @@ -65,7 +65,7 @@ SField::ref SField::getField(int code) #define FIELD(name, type, index) #define TYPE(name, type, index) case STI_##type: -#include "../format/ripple_SerializeDeclarations.h" +#include "../protocol/ripple_SerializeDeclarations.h" #undef FIELD #undef TYPE diff --git a/modules/ripple_data/format/ripple_FieldNames.h b/modules/ripple_data/protocol/ripple_FieldNames.h similarity index 97% rename from modules/ripple_data/format/ripple_FieldNames.h rename to modules/ripple_data/protocol/ripple_FieldNames.h index 7b7fccb6b6..1aa40879eb 100644 --- a/modules/ripple_data/format/ripple_FieldNames.h +++ b/modules/ripple_data/protocol/ripple_FieldNames.h @@ -13,7 +13,7 @@ enum SerializedTypeID #define TYPE(name, field, value) STI_##field = value, #define FIELD(name, field, value) -#include "../format/ripple_SerializeDeclarations.h" +#include "../protocol/ripple_SerializeDeclarations.h" #undef TYPE #undef FIELD @@ -124,7 +124,7 @@ extern SField sfInvalid, sfGeneric, sfLedgerEntry, sfTransaction, sfValidation; #define FIELD(name, type, index) extern SField sf##name; #define TYPE(name, type, index) -#include "../format/ripple_SerializeDeclarations.h" +#include "../protocol/ripple_SerializeDeclarations.h" #undef FIELD #undef TYPE diff --git a/modules/ripple_data/format/ripple_LedgerFormat.cpp b/modules/ripple_data/protocol/ripple_LedgerFormat.cpp similarity index 100% rename from modules/ripple_data/format/ripple_LedgerFormat.cpp rename to modules/ripple_data/protocol/ripple_LedgerFormat.cpp diff --git a/modules/ripple_data/format/ripple_LedgerFormat.h b/modules/ripple_data/protocol/ripple_LedgerFormat.h similarity index 100% rename from modules/ripple_data/format/ripple_LedgerFormat.h rename to modules/ripple_data/protocol/ripple_LedgerFormat.h diff --git a/modules/ripple_data/format/ripple_RippleAddress.cpp b/modules/ripple_data/protocol/ripple_RippleAddress.cpp similarity index 100% rename from modules/ripple_data/format/ripple_RippleAddress.cpp rename to modules/ripple_data/protocol/ripple_RippleAddress.cpp diff --git a/modules/ripple_data/format/ripple_RippleAddress.h b/modules/ripple_data/protocol/ripple_RippleAddress.h similarity index 100% rename from modules/ripple_data/format/ripple_RippleAddress.h rename to modules/ripple_data/protocol/ripple_RippleAddress.h diff --git a/modules/ripple_data/protocol/ripple_RippleSystem.h b/modules/ripple_data/protocol/ripple_RippleSystem.h new file mode 100644 index 0000000000..f0a5c016e6 --- /dev/null +++ b/modules/ripple_data/protocol/ripple_RippleSystem.h @@ -0,0 +1,41 @@ +#ifndef RIPPLE_RIPPLESYSTEM_H +#define RIPPLE_RIPPLESYSTEM_H + +/** Protocol specific constant globals. +*/ +// VFALCO: NOTE, use these from now on instead of the macros!! +class RippleSystem +{ +public: + static inline char const* getSystemName () + { + return "ripple"; + } + + static char const* getCurrencyCode () + { + return "XRP"; + } + + static char const* getCurrencyCodeRipple () + { + return "XRR"; + } + + static int getCurrencyPrecision () + { + return 6; + } +}; + +// VFALCO: TODO, I would love to replace these macros with the language +// constructs above. The problem is the way they are used at +// the point of call, i.e. "User-agent:" SYSTEM_NAME +// It will be necessary to rewrite some of them to use string streams. +// +#define SYSTEM_NAME "ripple" +#define SYSTEM_CURRENCY_CODE "XRP" +#define SYSTEM_CURRENCY_PRECISION 6 +#define SYSTEM_CURRENCY_CODE_RIPPLE "XRR" + +#endif diff --git a/src/cpp/ripple/Amount.cpp b/modules/ripple_data/protocol/ripple_STAmount.cpp similarity index 99% rename from src/cpp/ripple/Amount.cpp rename to modules/ripple_data/protocol/ripple_STAmount.cpp index b9ffdc20fd..0e65d4d096 100644 --- a/src/cpp/ripple/Amount.cpp +++ b/modules/ripple_data/protocol/ripple_STAmount.cpp @@ -1,13 +1,3 @@ -#include -#include -#include -#include - -#include -#include -#include -#include -#include SETUP_LOG (STAmount) diff --git a/src/cpp/ripple/AmountRound.cpp b/modules/ripple_data/protocol/ripple_STAmountRound.cpp similarity index 99% rename from src/cpp/ripple/AmountRound.cpp rename to modules/ripple_data/protocol/ripple_STAmountRound.cpp index 8aa3ff5b30..42e430f9bb 100644 --- a/src/cpp/ripple/AmountRound.cpp +++ b/modules/ripple_data/protocol/ripple_STAmountRound.cpp @@ -1,6 +1,4 @@ -#include - // CAUTION: This is early code and is *NOT* ready for real use yet. static void canonicalizeRound(bool isNative, uint64& value, int& offset, bool roundUp) diff --git a/modules/ripple_data/format/ripple_SerializeDeclarations.h b/modules/ripple_data/protocol/ripple_SerializeDeclarations.h similarity index 100% rename from modules/ripple_data/format/ripple_SerializeDeclarations.h rename to modules/ripple_data/protocol/ripple_SerializeDeclarations.h diff --git a/modules/ripple_data/format/ripple_SerializedObject.cpp b/modules/ripple_data/protocol/ripple_SerializedObject.cpp similarity index 100% rename from modules/ripple_data/format/ripple_SerializedObject.cpp rename to modules/ripple_data/protocol/ripple_SerializedObject.cpp diff --git a/modules/ripple_data/format/ripple_SerializedObject.h b/modules/ripple_data/protocol/ripple_SerializedObject.h similarity index 100% rename from modules/ripple_data/format/ripple_SerializedObject.h rename to modules/ripple_data/protocol/ripple_SerializedObject.h diff --git a/modules/ripple_data/format/ripple_SerializedTypes.cpp b/modules/ripple_data/protocol/ripple_SerializedTypes.cpp similarity index 100% rename from modules/ripple_data/format/ripple_SerializedTypes.cpp rename to modules/ripple_data/protocol/ripple_SerializedTypes.cpp diff --git a/modules/ripple_data/format/ripple_SerializedTypes.h b/modules/ripple_data/protocol/ripple_SerializedTypes.h similarity index 100% rename from modules/ripple_data/format/ripple_SerializedTypes.h rename to modules/ripple_data/protocol/ripple_SerializedTypes.h diff --git a/modules/ripple_data/format/ripple_Serializer.cpp b/modules/ripple_data/protocol/ripple_Serializer.cpp similarity index 100% rename from modules/ripple_data/format/ripple_Serializer.cpp rename to modules/ripple_data/protocol/ripple_Serializer.cpp diff --git a/modules/ripple_data/format/ripple_Serializer.h b/modules/ripple_data/protocol/ripple_Serializer.h similarity index 100% rename from modules/ripple_data/format/ripple_Serializer.h rename to modules/ripple_data/protocol/ripple_Serializer.h diff --git a/modules/ripple_data/format/ripple_TER.cpp b/modules/ripple_data/protocol/ripple_TER.cpp similarity index 100% rename from modules/ripple_data/format/ripple_TER.cpp rename to modules/ripple_data/protocol/ripple_TER.cpp diff --git a/modules/ripple_data/format/ripple_TER.h b/modules/ripple_data/protocol/ripple_TER.h similarity index 100% rename from modules/ripple_data/format/ripple_TER.h rename to modules/ripple_data/protocol/ripple_TER.h diff --git a/modules/ripple_data/format/ripple_TransactionFormat.cpp b/modules/ripple_data/protocol/ripple_TransactionFormat.cpp similarity index 100% rename from modules/ripple_data/format/ripple_TransactionFormat.cpp rename to modules/ripple_data/protocol/ripple_TransactionFormat.cpp diff --git a/modules/ripple_data/format/ripple_TransactionFormat.h b/modules/ripple_data/protocol/ripple_TransactionFormat.h similarity index 100% rename from modules/ripple_data/format/ripple_TransactionFormat.h rename to modules/ripple_data/protocol/ripple_TransactionFormat.h diff --git a/modules/ripple_data/ripple_data.cpp b/modules/ripple_data/ripple_data.cpp index 29bfa685e6..9029fe0f17 100644 --- a/modules/ripple_data/ripple_data.cpp +++ b/modules/ripple_data/ripple_data.cpp @@ -22,20 +22,26 @@ @ingroup ripple_data */ +#include + #include #include +#include +#include #include #include #include +#include +#include #include +#include #include +#include +#include +#include #include #include -#include -#include -#include -#include #include #include @@ -44,7 +50,6 @@ #include #include #include -#include // VFALCO: TODO, fix these warnings! #ifdef _MSC_VER @@ -55,6 +60,10 @@ #include "ripple_data.h" +#ifdef min +#undef min +#endif + #include "crypto/ripple_Base58.h" // for RippleAddress #include "crypto/ripple_CKey.h" // needs RippleAddress VFALCO: TODO, remove this dependency cycle #include "crypto/ripple_RFC1751.h" @@ -67,14 +76,22 @@ #include "crypto/ripple_Base58Data.cpp" #include "crypto/ripple_RFC1751.cpp" -#include "format/ripple_FieldNames.cpp" -#include "format/ripple_LedgerFormat.cpp" -#include "format/ripple_RippleAddress.cpp" -#include "format/ripple_SerializedTypes.cpp" -#include "format/ripple_Serializer.cpp" -#include "format/ripple_SerializedObject.cpp" -#include "format/ripple_TER.cpp" -#include "format/ripple_TransactionFormat.cpp" +#include "protocol/ripple_FieldNames.cpp" +#include "protocol/ripple_LedgerFormat.cpp" +#include "protocol/ripple_RippleAddress.cpp" +#include "protocol/ripple_SerializedTypes.cpp" +#include "protocol/ripple_Serializer.cpp" +#include "protocol/ripple_SerializedObject.cpp" +#include "protocol/ripple_TER.cpp" +#include "protocol/ripple_TransactionFormat.cpp" + +// These are for STAmount +static const uint64 tenTo14 = 100000000000000ull; +static const uint64 tenTo14m1 = tenTo14 - 1; +static const uint64 tenTo17 = tenTo14 * 1000; +static const uint64 tenTo17m1 = tenTo17 - 1; +#include "protocol/ripple_STAmount.cpp" +#include "protocol/ripple_STAmountRound.cpp" // VFALCO: TODO Fix this for SConstruct #ifdef _MSC_VER diff --git a/modules/ripple_data/ripple_data.h b/modules/ripple_data/ripple_data.h index 879f66c8c5..4ba8e04a67 100644 --- a/modules/ripple_data/ripple_data.h +++ b/modules/ripple_data/ripple_data.h @@ -58,14 +58,15 @@ #include "crypto/ripple_Base58.h" // VFALCO: TODO, Can be moved to .cpp if we clean up setAlphabet stuff #include "crypto/ripple_Base58Data.h" -#include "format/ripple_FieldNames.h" -#include "format/ripple_RippleAddress.h" -#include "format/ripple_Serializer.h" // needs CKey -#include "format/ripple_TER.h" -#include "format/ripple_SerializedTypes.h" // needs Serializer, TER -#include "format/ripple_SerializedObject.h" -#include "format/ripple_LedgerFormat.h" // needs SOTemplate from SerializedObject -#include "format/ripple_TransactionFormat.h" +#include "protocol/ripple_FieldNames.h" +#include "protocol/ripple_RippleAddress.h" +#include "protocol/ripple_RippleSystem.h" +#include "protocol/ripple_Serializer.h" // needs CKey +#include "protocol/ripple_TER.h" +#include "protocol/ripple_SerializedTypes.h" // needs Serializer, TER +#include "protocol/ripple_SerializedObject.h" +#include "protocol/ripple_LedgerFormat.h" // needs SOTemplate from SerializedObject +#include "protocol/ripple_TransactionFormat.h" // VFALCO: TODO, resolve the location of this file #include "ripple.pb.h" diff --git a/modules/ripple_main/ripple_main.cpp b/modules/ripple_main/ripple_main.cpp index f3035c3196..d3ffa81b7a 100644 --- a/modules/ripple_main/ripple_main.cpp +++ b/modules/ripple_main/ripple_main.cpp @@ -61,6 +61,14 @@ //------------------------------------------------------------------------------ +// VFALCO: TODO, prepare a unity header for LevelDB +#ifdef USE_LEVELDB +#include "leveldb/cache.h" +#include "leveldb/filter_policy.h" +#endif + +//------------------------------------------------------------------------------ + // VFALCO: TODO, fix these warnings! #ifdef _MSC_VER //#pragma warning (push) // Causes spurious C4503 "decorated name exceeds maximum length" @@ -210,8 +218,6 @@ static DH* handleTmpDh(SSL* ssl, int is_export, int iKeyLength) #include "src/cpp/ripple/AccountItems.cpp" // no log #include "src/cpp/ripple/AccountSetTransactor.cpp" #include "src/cpp/ripple/AccountState.cpp" // no log -#include "src/cpp/ripple/Amount.cpp" -#include "src/cpp/ripple/AmountRound.cpp" #include "src/cpp/ripple/Application.cpp" #include "src/cpp/ripple/CallRPC.cpp" #include "src/cpp/ripple/CanonicalTXSet.cpp" diff --git a/newcoin.vcxproj b/newcoin.vcxproj index cae5429281..593b9ddc87 100644 --- a/newcoin.vcxproj +++ b/newcoin.vcxproj @@ -279,49 +279,57 @@ true true - + true true true true - + true true true true - + true true true true - + true true true true - + true true true true - + true true true true - + + true + true + + + true + true + + true true true true - + true true true @@ -708,18 +716,6 @@ true true - - true - true - true - true - - - true - true - true - true - true true @@ -1295,15 +1291,16 @@ - - - - - - - - - + + + + + + + + + + diff --git a/newcoin.vcxproj.filters b/newcoin.vcxproj.filters index 7ddf1696f4..c6d11f9358 100644 --- a/newcoin.vcxproj.filters +++ b/newcoin.vcxproj.filters @@ -127,9 +127,6 @@ {6a33d317-620f-4cf0-88a9-2d943b4c00a1} - - {2f3572a9-2882-4656-ab93-82b7761c9e3d} - {c441b367-d096-401f-a3f0-5ac24290d7b7} @@ -139,6 +136,9 @@ {6097a179-ddad-4c69-9a34-2e3fc2c9fa1d} + + {2f3572a9-2882-4656-ab93-82b7761c9e3d} + @@ -465,12 +465,6 @@ 1. Modules\ripple_main\_unfactored\contracts - - 1. Modules\ripple_main\_unfactored\types - - - 1. Modules\ripple_main\_unfactored\types - 1. Modules\ripple_main\_unfactored\types @@ -744,30 +738,6 @@ 1. Modules\ripple_data\crypto - - 1. Modules\ripple_data\format - - - 1. Modules\ripple_data\format - - - 1. Modules\ripple_data\format - - - 1. Modules\ripple_data\format - - - 1. Modules\ripple_data\format - - - 1. Modules\ripple_data\format - - - 1. Modules\ripple_data\format - - - 1. Modules\ripple_data\format - 1. Modules\ripple_main\_unfactored\ledger @@ -813,6 +783,36 @@ 1. Modules\ripple_main\_unfactored\rpc + + 1. Modules\ripple_data\protocol + + + 1. Modules\ripple_data\protocol + + + 1. Modules\ripple_data\protocol + + + 1. Modules\ripple_data\protocol + + + 1. Modules\ripple_data\protocol + + + 1. Modules\ripple_data\protocol + + + 1. Modules\ripple_data\protocol + + + 1. Modules\ripple_data\protocol + + + 1. Modules\ripple_data\protocol + + + 1. Modules\ripple_data\protocol + @@ -1430,33 +1430,6 @@ 1. Modules\ripple_main\refactored - - 1. Modules\ripple_data\format - - - 1. Modules\ripple_data\format - - - 1. Modules\ripple_data\format - - - 1. Modules\ripple_data\format - - - 1. Modules\ripple_data\format - - - 1. Modules\ripple_data\format - - - 1. Modules\ripple_data\format - - - 1. Modules\ripple_data\format - - - 1. Modules\ripple_data\format - 1. Modules\ripple_main\_unfactored\ledger @@ -1505,6 +1478,36 @@ 1. Modules\ripple_main\_unfactored\rpc + + 1. Modules\ripple_data\protocol + + + 1. Modules\ripple_data\protocol + + + 1. Modules\ripple_data\protocol + + + 1. Modules\ripple_data\protocol + + + 1. Modules\ripple_data\protocol + + + 1. Modules\ripple_data\protocol + + + 1. Modules\ripple_data\protocol + + + 1. Modules\ripple_data\protocol + + + 1. Modules\ripple_data\protocol + + + 1. Modules\ripple_data\protocol + diff --git a/src/cpp/ripple/Application.cpp b/src/cpp/ripple/Application.cpp index cb2a2e0d37..56877484d1 100644 --- a/src/cpp/ripple/Application.cpp +++ b/src/cpp/ripple/Application.cpp @@ -1,4 +1,5 @@ +/* #include "Application.h" #include "leveldb/cache.h" @@ -15,6 +16,13 @@ #include #include #include +*/ + +// VFALCO: TODO Replace these with beast "unsigned long long" generators +#define SYSTEM_CURRENCY_GIFT 1000ull +#define SYSTEM_CURRENCY_USERS 100000000ull +#define SYSTEM_CURRENCY_PARTS 1000000ull // 10^SYSTEM_CURRENCY_PRECISION +#define SYSTEM_CURRENCY_START (SYSTEM_CURRENCY_GIFT*SYSTEM_CURRENCY_USERS*SYSTEM_CURRENCY_PARTS) SETUP_LOG (Application) diff --git a/src/cpp/ripple/ripple_Config.h b/src/cpp/ripple/ripple_Config.h index 641e03d626..11577e0780 100644 --- a/src/cpp/ripple/ripple_Config.h +++ b/src/cpp/ripple/ripple_Config.h @@ -4,19 +4,6 @@ // VFALCO: NOTE, Set this to 1 to enable code which is unnecessary #define ENABLE_INSECURE 0 -// VFALCO: TODO, replace all these macros with language constructs - -#define SYSTEM_NAME "ripple" -#define SYSTEM_CURRENCY_CODE "XRP" -#define SYSTEM_CURRENCY_PRECISION 6 -#define SYSTEM_CURRENCY_CODE_RIPPLE "XRR" - -// VFALCO: TODO Replace these with beast "unsigned long long" generators -#define SYSTEM_CURRENCY_GIFT 1000ull -#define SYSTEM_CURRENCY_USERS 100000000ull -#define SYSTEM_CURRENCY_PARTS 1000000ull // 10^SYSTEM_CURRENCY_PRECISION -#define SYSTEM_CURRENCY_START (SYSTEM_CURRENCY_GIFT*SYSTEM_CURRENCY_USERS*SYSTEM_CURRENCY_PARTS) - #define CONFIG_FILE_NAME SYSTEM_NAME "d.cfg" // rippled.cfg #define DEFAULT_VALIDATORS_SITE ""