diff options
author | Gav Wood <i@gavwood.com> | 2015-01-09 15:05:52 +0800 |
---|---|---|
committer | Gav Wood <i@gavwood.com> | 2015-01-09 15:05:52 +0800 |
commit | 6de29142ef6b8839207b01f636c8a05285ab2151 (patch) | |
tree | eec426e162f13a52bc165e097417907111cf478d /CommandLineInterface.cpp | |
parent | d7873d9cd0745fcc3642c217f37d95303613a35a (diff) | |
download | dexon-solidity-6de29142ef6b8839207b01f636c8a05285ab2151.tar dexon-solidity-6de29142ef6b8839207b01f636c8a05285ab2151.tar.gz dexon-solidity-6de29142ef6b8839207b01f636c8a05285ab2151.tar.bz2 dexon-solidity-6de29142ef6b8839207b01f636c8a05285ab2151.tar.lz dexon-solidity-6de29142ef6b8839207b01f636c8a05285ab2151.tar.xz dexon-solidity-6de29142ef6b8839207b01f636c8a05285ab2151.tar.zst dexon-solidity-6de29142ef6b8839207b01f636c8a05285ab2151.zip |
Rename "JSON Documentation" -> Metadata.
solc integration for Solidity-format ABI.
Diffstat (limited to 'CommandLineInterface.cpp')
-rw-r--r-- | CommandLineInterface.cpp | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/CommandLineInterface.cpp b/CommandLineInterface.cpp index 2a79521e..46a293a7 100644 --- a/CommandLineInterface.cpp +++ b/CommandLineInterface.cpp @@ -16,6 +16,7 @@ */ /** * @author Lefteris <lefteris@ethdev.com> + * @author Gav Wood <g@ethdev.com> * @date 2014 * Solidity command line interface. */ @@ -51,6 +52,7 @@ namespace solidity // LTODO: Maybe some argument class pairing names with // extensions and other attributes would be a better choice here? static string const g_argAbiStr = "abi"; +static string const g_argSolAbiStr = "sol-abi"; static string const g_argAsmStr = "asm"; static string const g_argAstStr = "ast"; static string const g_argBinaryStr = "binary"; @@ -60,7 +62,7 @@ static string const g_argNatspecUserStr = "natspec-user"; static void version() { - cout << "solc, the solidity complier commandline interface " << dev::Version << endl + cout << "solc, the solidity compiler commandline interface " << dev::Version << endl << " by Christian <c@ethdev.com> and Lefteris <lefteris@ethdev.com>, (c) 2014." << endl << "Build: " << DEV_QUOTED(ETH_BUILD_PLATFORM) << "/" << DEV_QUOTED(ETH_BUILD_TYPE) << endl; exit(0); @@ -73,9 +75,11 @@ static inline bool argToStdout(po::variables_map const& _args, string const& _na static bool needStdout(po::variables_map const& _args) { - return argToStdout(_args, g_argAbiStr) || argToStdout(_args, g_argNatspecUserStr) || - argToStdout(_args, g_argNatspecDevStr) || argToStdout(_args, g_argAsmStr) || - argToStdout(_args, g_argOpcodesStr) || argToStdout(_args, g_argBinaryStr); + return + argToStdout(_args, g_argAbiStr) || argToStdout(_args, g_argSolAbiStr) || + argToStdout(_args, g_argNatspecUserStr) || + argToStdout(_args, g_argNatspecDevStr) || argToStdout(_args, g_argAsmStr) || + argToStdout(_args, g_argOpcodesStr) || argToStdout(_args, g_argBinaryStr); } static inline bool outputToFile(OutputType type) @@ -146,8 +150,7 @@ void CommandLineInterface::handleBytecode(string const& _contract) handleBinary(_contract); } -void CommandLineInterface::handleJson(DocumentationType _type, - string const& _contract) +void CommandLineInterface::handleMeta(DocumentationType _type, string const& _contract) { std::string argName; std::string suffix; @@ -159,8 +162,13 @@ void CommandLineInterface::handleJson(DocumentationType _type, suffix = ".abi"; title = "Contract ABI"; break; + case DocumentationType::ABI_SOLIDITY_INTERFACE: + argName = g_argSolAbiStr; + suffix = ".sol"; + title = "Contract Solidity ABI"; + break; case DocumentationType::NATSPEC_USER: - argName = "g_argNatspecUserStr"; + argName = g_argNatspecUserStr; suffix = ".docuser"; title = "User Documentation"; break; @@ -180,13 +188,13 @@ void CommandLineInterface::handleJson(DocumentationType _type, if (outputToStdout(choice)) { cout << title << endl; - cout << m_compiler.getJsonDocumentation(_contract, _type); + cout << m_compiler.getMetadata(_contract, _type); } if (outputToFile(choice)) { ofstream outFile(_contract + suffix); - outFile << m_compiler.getJsonDocumentation(_contract, _type); + outFile << m_compiler.getMetadata(_contract, _type); outFile.close(); } } @@ -214,7 +222,9 @@ bool CommandLineInterface::parseArguments(int argc, char** argv) (g_argBinaryStr.c_str(), po::value<OutputType>(), "Request to output the contract in binary (hexadecimal). " OUTPUT_TYPE_STR) (g_argAbiStr.c_str(), po::value<OutputType>(), - "Request to output the contract's ABI interface. " OUTPUT_TYPE_STR) + "Request to output the contract's JSON ABI interface. " OUTPUT_TYPE_STR) + (g_argSolAbiStr.c_str(), po::value<OutputType>(), + "Request to output the contract's Solidity ABI interface. " OUTPUT_TYPE_STR) (g_argNatspecUserStr.c_str(), po::value<OutputType>(), "Request to output the contract's Natspec user documentation. " OUTPUT_TYPE_STR) (g_argNatspecDevStr.c_str(), po::value<OutputType>(), @@ -384,9 +394,10 @@ void CommandLineInterface::actOnInput() } handleBytecode(contract); - handleJson(DocumentationType::ABI_INTERFACE, contract); - handleJson(DocumentationType::NATSPEC_DEV, contract); - handleJson(DocumentationType::NATSPEC_USER, contract); + handleMeta(DocumentationType::ABI_INTERFACE, contract); + handleMeta(DocumentationType::ABI_SOLIDITY_INTERFACE, contract); + handleMeta(DocumentationType::NATSPEC_DEV, contract); + handleMeta(DocumentationType::NATSPEC_USER, contract); } // end of contracts iteration } |