From owner-freebsd-libh Mon Apr 15 15:33:15 2002 Delivered-To: freebsd-libh@freebsd.org Received: from postal.sdsc.edu (postal.sdsc.edu [132.249.20.114]) by hub.freebsd.org (Postfix) with ESMTP id 2017637B416 for ; Mon, 15 Apr 2002 15:33:09 -0700 (PDT) Received: from multivac.sdsc.edu (multivac.sdsc.edu [132.249.20.57]) by postal.sdsc.edu (8.11.6/8.11.6/server/36) with ESMTP id g3FMX8713196; Mon, 15 Apr 2002 15:33:08 -0700 (PDT) Received: by multivac (8.11.6+Sun/1.11-SolarisClient) id g3FMX8028517; Mon, 15 Apr 2002 15:33:08 -0700 (PDT) To: freebsd-libh@FreeBSD.ORG Subject: cleanup of HSystem 2nd try (stage 4) From: Max Okumoto Date: 15 Apr 2002 15:33:08 -0700 Message-ID: Lines: 180 X-Mailer: Gnus v5.5/XEmacs 20.4 - "Emerald" Sender: owner-freebsd-libh@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG * (include/HSystem.hh) Added new function gen_file(). Make gen_header() gen_classes_interfaces(), gen_register_command_access(), gen_footer() and other types to private. * (lib/tcl/tcl_interface_gen.cc) Use new gen_file(). Index: include/HSystem.hh =================================================================== RCS file: /home/libh/cvs/libh/include/HSystem.hh,v retrieving revision 1.9 diff -u -r1.9 HSystem.hh --- include/HSystem.hh 2002/04/15 21:47:31 1.9 +++ include/HSystem.hh 2002/04/15 22:27:03 @@ -39,10 +39,9 @@ #include "LanguageInterface.hh" -#include - -#include +#include #include +#include //====================================================================== @@ -57,39 +56,15 @@ typedef LanguageInterface::Object::MethodDescription MethodDesc; typedef LanguageInterface::Object::CallbackDescription CallBackDesc; - public: typedef list Descriptions; typedef set Includes; typedef list CommandAccessToRegister; typedef list > StaticMethods; - - /** - * Constructor. - */ - HSystem(const string& aName) - : name(aName) {} - /** - * Copy constructor. XXX This is broken! None of the other state is - * copied! - */ - HSystem(const HSystem& aHSystem) - : name(aHSystem.name) {} - - /** - * Adds the class description and include file to the system definition. - * - * @param class_desc - * @param include_file - * - * @see find_classes_descriptions.pl - */ - void - add_class(const ClassDesc *class_desc, const string& include_file) - { - descriptions.push_back(class_desc); - includes.insert(include_file); - } + Descriptions descriptions; + Includes includes; + CommandAccessToRegister commandAccessToRegister; + StaticMethods staticMethods; /** * Output header and includes. The output text contains a @@ -109,14 +84,34 @@ */ void gen_footer(ostream& out); - Descriptions descriptions; - Includes includes; - CommandAccessToRegister commandAccessToRegister; - StaticMethods staticMethods; + void gen_class_header(ostream& out, const ClassDesc *cd); + void gen_callback_interfaces(ostream& out, const ClassDesc *cd); + void gen_dynamic_methods_interfaces(ostream& out, const ClassDesc *cd); + void gen_static_method_interfaces(ostream& out, const ClassDesc *cd); + string gen_result_to_obj(MethodDesc::Value t); + string gen_method_argument(MethodDesc::Value t, int argno, int method_argno, bool last_arg_in_set_method); + public: + /** Mame of subsystem. + * @note This should be made private But this would require modifications + * out side of HSystem.hh. + */ string name; /** + * Constructor. + */ + HSystem(const string& aName) + : name(aName) {} + + /** + * Copy constructor. XXX This is broken! None of the other state is + * copied! + */ + HSystem(const HSystem& aHSystem) + : name(aHSystem.name) {} + + /** * LessThan operator. * * @param rhs Right hand side of the less than operator. @@ -130,13 +125,27 @@ */ bool operator==(const HSystem& rhs) const { return name == rhs.name; } - private: - void gen_class_header(ostream& out, const ClassDesc *cd); - void gen_callback_interfaces(ostream& out, const ClassDesc *cd); - void gen_dynamic_methods_interfaces(ostream& out, const ClassDesc *cd); - void gen_static_method_interfaces(ostream& out, const ClassDesc *cd); - string gen_result_to_obj(MethodDesc::Value t); - string gen_method_argument(MethodDesc::Value t, int argno, int method_argno, bool last_arg_in_set_method); + /** + * Adds the class description and include file to the system definition. + * + * @param cd + * @param include_file + * + * @see find_classes_descriptions.pl + */ + void + add_class(const ClassDesc *cd, const string& include_file) + { + descriptions.push_back(cd); + includes.insert(include_file); + } + + /** + * Generate libh subsystem tcl interface text. + * + * @param out stream to send text. + */ + void gen_file(ostream &out); }; // class HSystem Index: lib/tcl/tcl_interface_gen.cc =================================================================== RCS file: /home/libh/cvs/libh/lib/tcl/tcl_interface_gen.cc,v retrieving revision 1.9 diff -u -r1.9 tcl_interface_gen.cc --- lib/tcl/tcl_interface_gen.cc 2002/04/15 16:26:47 1.9 +++ lib/tcl/tcl_interface_gen.cc 2002/04/15 22:27:05 @@ -62,10 +62,7 @@ throw runtime_error( string( "Unable to create " ) + argv[2] + ": " + ::strerror( errno ) ); HSystem& s = const_cast( *system ); - s.gen_header( out ); - s.gen_classes_interfaces( out ); - s.gen_register_command_access( out ); - s.gen_footer( out ); + s.gen_file( out ); } catch ( exception& err ) { cerr << "Error: " << err.what() << endl; @@ -75,6 +72,15 @@ return 0; } /* main */ + +void +HSystem::gen_file(ostream& out) +{ + gen_header(out); + gen_classes_interfaces(out); + gen_register_command_access(out); + gen_footer(out); +} void HSystem::gen_header( ostream& out ) { To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-libh" in the body of the message