summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog-98b2
-rw-r--r--ace/ACE.cpp1
-rwxr-xr-xbin/Hash_Map_Manager.perl93
-rwxr-xr-xbin/Hash_Map_Manager_Helper27
4 files changed, 122 insertions, 1 deletions
diff --git a/ChangeLog-98b b/ChangeLog-98b
index 1dc595ae799..4237236a690 100644
--- a/ChangeLog-98b
+++ b/ChangeLog-98b
@@ -1,4 +1,4 @@
-Thu Dec 24 03:14:25 1998 Irfan Pyarali <irfan@cs.wustl.edu>
+Fri Dec 25 01:55:32 1998 Irfan Pyarali <irfan@cs.wustl.edu>
* ace/Hash_Map_Manager: There are two problems with the current
implementation of Hash_Map_Manager:
diff --git a/ace/ACE.cpp b/ace/ACE.cpp
index 2a8bcd4b47e..217908be4e0 100644
--- a/ace/ACE.cpp
+++ b/ace/ACE.cpp
@@ -3093,6 +3093,7 @@ ACE::strend (const char *s)
return s;
}
+
#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) && (defined (__unix) || defined (__Lynx__) || defined (_AIX))
template class ACE_Auto_Array_Ptr<struct ifreq>;
template class ACE_Auto_Basic_Array_Ptr<struct ifreq>;
diff --git a/bin/Hash_Map_Manager.perl b/bin/Hash_Map_Manager.perl
new file mode 100755
index 00000000000..f3b1b7164fa
--- /dev/null
+++ b/bin/Hash_Map_Manager.perl
@@ -0,0 +1,93 @@
+#
+# $Id$
+#
+
+#
+# This script helps in fixing the template instantiations changes
+# required by the new design of ACE_Hash_Map_Manager. Note that this
+# script is not a 100% fool proof: (a) It uses commas to delimit the
+# types in ACE_Hash_Map_Manager<X, Y, Z>. If X, Y, or Z are
+# complicated types containing commas (e.g., T<a, b>), this script
+# will not work. (b) The second problem is for g++ users (version
+# lower than 2.8). g++ is broken such that if you explicitly
+# instantiate templates, it will ignore template specialization.
+# Therefore if you are using the template instantiation provided in
+# ACE for ACE_Hash and ACE_Equal_To, don't instantiate those
+# templates.
+#
+# This script is used by Hash_Map_Manager_Helper.csh.
+#
+
+$template_instantiation = "template class";
+$end_of_template_instantiation = ";";
+
+$pragma_instantiation = "#pragma instantiate";
+$end_of_pragma_instantiation = "";
+
+while ($line = <>)
+{
+ find_match ("ACE_Hash_Map_Entry");
+ if ($match)
+ {
+ $template_parameters =~ /(.*),\s*(.*)/;
+ $X = $1;
+ $Y = $2;
+
+ print "$instantiation ACE_Hash_Map_Entry<$template_parameters>$end_of_instantiation\n";
+ print "$instantiation ACE_Hash<$X>$end_of_instantiation\n";
+ print "$instantiation ACE_Equal_To<$X>$end_of_instantiation\n";
+ next;
+ }
+
+ add_ex ("ACE_Hash_Map_Manager", 1);
+ add_ex ("ACE_Hash_Map_Iterator", 1);
+ add_ex ("ACE_Hash_Map_Reverse_Iterator", 1);
+ add_ex ("ACE_Hash_Map_Iterator_Base", 0);
+
+ print $line;
+}
+
+sub find_match
+{
+ $key = $_[0].'\s*<\s*(.*)>\s*';
+ if ($line =~ /$template_instantiation $key$end_of_template_instantiation$/)
+ {
+ $match = 1;
+ $template_parameters = $1;
+ $instantiation = $template_instantiation;
+ $end_of_instantiation = $end_of_template_instantiation;
+ }
+ elsif ($line =~ /$pragma_instantiation $key$end_of_pragma_instantiation$/)
+ {
+ $match = 1;
+ $template_parameters = $1;
+ $instantiation = $pragma_instantiation;
+ $end_of_instantiation = $end_of_pragma_instantiation;
+ }
+ else
+ {
+ $match = 0;
+ }
+}
+
+sub add_ex
+{
+ $add_original_line = $_[1];
+ find_match ($_[0]);
+ if ($match)
+ {
+ $template_parameters =~ /(.*),\s*(.*),\s*(.*)/;
+ $X = $1;
+ $Y = $2;
+ $Z = $3;
+
+ if ($add_original_line)
+ {
+ print "$instantiation $_[0]<$template_parameters>$end_of_instantiation\n";
+ }
+
+ print "$instantiation $_[0]_Ex<$X, $Y, ACE_Hash<$X>, ACE_Equal_To<$X>, $Z>$end_of_instantiation\n";
+ next;
+ }
+}
+
diff --git a/bin/Hash_Map_Manager_Helper b/bin/Hash_Map_Manager_Helper
new file mode 100755
index 00000000000..3d98475c043
--- /dev/null
+++ b/bin/Hash_Map_Manager_Helper
@@ -0,0 +1,27 @@
+#! /bin/csh -f
+
+#
+# $Id$
+#
+
+#
+# This script helps in fixing the template instantiations changes
+# required by the new design of ACE_Hash_Map_Manager. Note that this
+# script is not a 100% fool proof: (a) It uses commas to delimit the
+# types in ACE_Hash_Map_Manager<X, Y, Z>. If X, Y, or Z are
+# complicated types containing commas (e.g., T<a, b>), this script
+# will not work. (b) The second problem is for g++ users (version
+# lower than 2.8). g++ is broken such that if you explicitly
+# instantiate templates, it will ignore template specialization.
+# Therefore if you are using the template instantiation provided in
+# ACE for ACE_Hash and ACE_Equal_To, don't instantiate those
+# templates.
+#
+# This script uses Hash_Map_Manager.perl.
+#
+
+foreach file ( `find . -type f \( -name "*.i" -o -name "*.h" -o -name "*.cpp" \) -print | xargs grep -l "template class ACE_Hash_Map_Entry"` )
+ echo Fixing template instantiations in $file
+ perl $ACE_ROOT/bin/Hash_Map_Manager.perl $file > $file.new
+ mv $file.new $file
+end