diff options
-rw-r--r-- | TAO/TAO_IDL/be/be_interface.cpp | 27 | ||||
-rw-r--r-- | apps/gperf/src/Key_List.cpp | 12 | ||||
-rw-r--r-- | apps/gperf/src/Options.cpp | 21 |
3 files changed, 40 insertions, 20 deletions
diff --git a/TAO/TAO_IDL/be/be_interface.cpp b/TAO/TAO_IDL/be/be_interface.cpp index eb6689ff2e2..38a10493a8b 100644 --- a/TAO/TAO_IDL/be/be_interface.cpp +++ b/TAO/TAO_IDL/be/be_interface.cpp @@ -1059,8 +1059,8 @@ be_interface::gen_optable_entries (be_interface *derived) case TAO_CodeGen::TAO_LINEAR_SEARCH: case TAO_CodeGen::TAO_BINARY_SEARCH: - // For this also, we call GPERF only. case TAO_CodeGen::TAO_PERFECT_HASH: + // We call GPERF for all these three strategies. // Init the outstream. ss = cg->gperf_input_stream (); @@ -1401,7 +1401,7 @@ be_interface::gen_binary_search_class_definition (void) << be_nl << "public:" << be_nl - << " const TAO_operation_db_entry * lookup (const char *str, unsigned int len);" + << " const TAO_operation_db_entry * lookup (const char *str);" << be_nl << "};" << "\n"; @@ -1425,7 +1425,7 @@ be_interface::gen_linear_search_class_definition (void) << be_nl << "public:" << be_nl - << " const TAO_operation_db_entry * lookup (const char *str, unsigned int len);" + << " const TAO_operation_db_entry * lookup (const char *str);" << be_nl << "};" << "\n"; @@ -1528,6 +1528,27 @@ be_interface::gen_gperf_lookup_methods (void) this->flatname ()); break; + // Linear search methods from GPERF. Everything and the -z flag. + case TAO_CodeGen::TAO_LINEAR_SEARCH: + process_options.command_line ("%s" + " " + "-b" + " " + "-m -M -J -c -C" + " " + "-D -E -T -f 0" + " " + "-a -o -t -p -K" + " " + "opname_ -L C++" + " " + "-Z TAO_%s_Linear_Search_OpTable" + " " + "-N lookup", + idl_global->gperf_path (), + this->flatname ()); + break; + default: ACE_ERROR_RETURN ((LM_ERROR, "tao_idl:ERROR:%N:%l:Unknown Operation Lookup Strategy\n"), diff --git a/apps/gperf/src/Key_List.cpp b/apps/gperf/src/Key_List.cpp index 06d0aaec03b..edae165fb38 100644 --- a/apps/gperf/src/Key_List.cpp +++ b/apps/gperf/src/Key_List.cpp @@ -883,7 +883,7 @@ Key_List::output_binary_search_function (void) // Class definition if -M is *not* enabled. if ((option[CPLUSPLUS]) && (!option[SKIPCLASS])) printf ("class %s {\npublic:\n" - " static %s%s%s (const char *str, unsigned int len);\n};\n\n", + " static %s%s%s (const char *str);\n};\n\n", option.class_name (), option[CONSTANT] ? "const " : "", return_type, @@ -898,8 +898,8 @@ Key_List::output_binary_search_function (void) printf ("%s::", option.class_name ()); printf (option[ANSI] - ? "%s (const char *str, unsigned int len)\n{\n" - : "%s (str, len)\n char *str;\n unsigned int len;\n{\n", + ? "%s (const char *str)\n{\n" + : "%s (str)\n char *str;\n{\n", option.function_name ()); // Use the switch in place of lookup table. @@ -977,7 +977,7 @@ Key_List::output_linear_search_function (void) // Class definition if -M is *not* enabled. if ((option[CPLUSPLUS]) && (!option[SKIPCLASS])) printf ("class %s {\npublic:\n" - " static %s%s%s (const char *str, unsigned int len);\n};\n\n", + " static %s%s%s (const char *str);\n};\n\n", option.class_name (), option[CONSTANT] ? "const " : "", return_type, @@ -992,8 +992,8 @@ Key_List::output_linear_search_function (void) printf ("%s::", option.class_name ()); printf (option[ANSI] - ? "%s (const char *str, unsigned int len)\n{\n" - : "%s (str, len)\n char *str;\n unsigned int len;\n{\n", + ? "%s (const char *str)\n{\n" + : "%s (str)\n char *str;\n{\n", option.function_name ()); // Use the switch in place of lookup table. diff --git a/apps/gperf/src/Options.cpp b/apps/gperf/src/Options.cpp index 5a34c7f8158..21a51b5bacd 100644 --- a/apps/gperf/src/Options.cpp +++ b/apps/gperf/src/Options.cpp @@ -78,9 +78,9 @@ void Options::usage (void) { ACE_ERROR ((LM_ERROR, - "Usage: %n [-aBcCdDef[num]gGhH<hashname>i<init>IjJ" + "Usage: %n [-abBcCdDef[num]gGhH<hashname>i<init>IjJ" "k<keys>K<keyname>lL<language>mMnN<function name>o" - "Oprs<size>S<switches>tTvVZ<class name>z].\n" + "Oprs<size>S<switches>tTvVZ<class name>].\n" "(type %n -h for help)\n")); } @@ -223,7 +223,7 @@ Options::parse_args (int argc, char *argv[]) if (ACE_LOG_MSG->open (argv[0]) == -1) return -1; - ACE_Get_Opt getopt (argc, argv, "aBcCdDe:Ef:gGhH:i:IJj:k:K:lL:mMnN:oOprs:S:tTvVZ:z"); + ACE_Get_Opt getopt (argc, argv, "abBcCdDe:Ef:gGhH:i:IJj:k:K:lL:mMnN:oOprs:S:tTvVZ:"); int option_char; argc_ = argc; @@ -239,6 +239,12 @@ Options::parse_args (int argc, char *argv[]) ACE_SET_BITS (option_word_, ANSI); break; } + // Generate code for Linear Search. + case 'b': + { + ACE_SET_BITS (option_word_, LINEARSEARCH); + break; + } // Generate code for Binary Search. case 'B': { @@ -392,8 +398,7 @@ Options::parse_args (int argc, char *argv[]) "-v\tPrints out the current version number and exits with a value of 0\n" "-V\tExits silently with a value of 0.\n" "-Z\tAllow user to specify name of generated C++ class. Default\n" - "\tname is `Perfect_Hash.'\n" - "-z\tGenerates the code for linear search.\n", + "\tname is `Perfect_Hash.'\n", DEFAULT_JUMP_VALUE, MAX_KEY_POS - 1); Options::usage (); @@ -631,12 +636,6 @@ Options::parse_args (int argc, char *argv[]) class_name_ = getopt.optarg; break; } - // Generate code for Linear Search. - case 'z': - { - ACE_SET_BITS (option_word_, LINEARSEARCH); - break; - } default: ACE_ERROR_RETURN ((LM_ERROR, "%r", |