Skip site navigation (1)Skip section navigation (2)
Date:      15 Apr 2002 15:33:08 -0700
From:      Max Okumoto <okumoto@ucsd.edu>
To:        freebsd-libh@FreeBSD.ORG
Subject:   cleanup of HSystem 2nd try (stage 4)
Message-ID:  <hfhemc6197.fsf@multivac.sdsc.edu>

next in thread | raw e-mail | index | archive | help

* (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 <iostream.h>
-
-#include <set>
+#include <iostream>
 #include <list>
+#include <set>
 
 //======================================================================
 
@@ -57,39 +56,15 @@
     typedef LanguageInterface::Object::MethodDescription	MethodDesc;
     typedef LanguageInterface::Object::CallbackDescription	CallBackDesc;
 
-  public:
     typedef list<const ClassDesc *>	Descriptions;
     typedef set<string>			Includes;
     typedef list<const char*>		CommandAccessToRegister;
     typedef list<pair<string,string> >	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<HSystem&>( *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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?hfhemc6197.fsf>