From: Foster B. <fos...@us...> - 2005-03-30 22:34:45
|
Update of /cvsroot/adobe-source/sandbox/adobe-source/adobe/test/eve_smoke In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5601/adobe/test/eve_smoke Added Files: Jamfile default.eve eve_smoke.mcp main.cpp Log Message: Added eve_smoke, Jamfile edits --- NEW FILE: default.eve --- dialog() { row() { button (name: "Hello"); } column() { button (name: "world!"); } } --- NEW FILE: main.cpp --- /* Copyright 2005 Ralph Thomas and Adobe Systems Incorporated Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt or a copy at http://opensource.adobe.com/licenses.html) */ /*************************************************************************************************/ #include <iostream> #include <sstream> #include <fstream> #include <string> #include <adobe/name.hpp> #include <adobe/value.hpp> #include <adobe/dictionary.hpp> #include <adobe/array.hpp> #include <adobe/eve.hpp> #include <adobe/eve_evaluate.hpp> #include <adobe/eve_parser.hpp> #include <boost/filesystem/path.hpp> /*************************************************************************************************/ // // position_t assemble( ... ) // /// This function dumps the output of the eve parser to std::cout. It probably /// should create all of the widgets demanded by the Eve file, but we're not /// doing that for now. /// /// \param parent the parent node. A position_t is an any. /// \param parse_location the file name and line number for this data. /// \param name the name of the thing to make. /// \param parameters the parameters for the thing to make. /// \param brief Nearby comments? /// \param detailed Nearby comments /// /// \return an any containing the created widget. // adobe::eve::position_t assemble( const adobe::eve::position_t& /*parent*/, const adobe::line_position_t& /*parse_location*/, adobe::name_t name, const adobe::array_t& parameters, const std::string& /*brief*/, const std::string& /*detailed*/ ) { std::cout << "Create: " << name.get() << std::endl; adobe::dictionary_t dict(adobe::eve::evaluate_arguments()( parameters )); adobe::dictionary_t::const_iterator first(dict.begin()); adobe::dictionary_t::const_iterator last(dict.end()); for (; first != last; ++first) std::cout << "\t" << first->first << " = \"" << first->second << "\"" << std::endl; return adobe::eve::position_t(); } /*************************************************************************************************/ // // void testParse( std::string fileName ) // /// Try to parse the given filename and see what the parser throws up. /// /// \param fileName the name of the file to parse. // void testParse( boost::filesystem::path& fileName ) { // // Open our input stream. // std::ifstream stream( fileName.native_file_string().c_str() ); if (!stream.is_open()) { std::stringstream err; err << "Could not open file: " << fileName.native_file_string(); throw std::runtime_error(err.str()); } // // Call the Eve parser. // adobe::eve::parse( stream, adobe::line_position_t( fileName.native_file_string().c_str() ), adobe::eve::position_t(), &assemble ); } /*************************************************************************************************/ // // int main() // /// Main driver, choose which file to parse and call testParse. /// /// \param argc the count of arguments. /// \param argv the vector containing the arguments. /// /// \return always zero. // int main( int argc, char* argv[] ) { bool success(true); // // Try to open the filename given on the command line, otherwise // try to open "default.eve". // try { boost::filesystem::path file_path("default.eve"); if( argc > 1 ) file_path = boost::filesystem::path(argv[1], boost::filesystem::native); // // Call our testParse function with the selected filename. // testParse( file_path ); } catch( const std::exception& error ) { // // Oops, something didn't work out. // std::cerr << "Exception: " << error.what() << std::endl; } catch( ... ) { std::cerr << "Unknown exception" << std::endl; } return success ? 0 : 1; } --- NEW FILE: Jamfile --- import testing ; project adobe/eve_smoke : requirements <link>static ; exe "eve_smoke" : main.cpp /adobe//asl_lib_dev /boost/filesystem//boost_filesystem ; --- NEW FILE: eve_smoke.mcp --- (This appears to be a binary file; contents omitted.) |