output.cc (258139) | output.cc (260386) |
---|---|
1/* Output routines. 2 Copyright (C) 1989-1998, 2000, 2002-2004, 2006-2007 Free Software Foundation, Inc. 3 Written by Douglas C. Schmidt <schmidt@ics.uci.edu> 4 and Bruno Haible <bruno@clisp.org>. 5 6 This file is part of GNU GPERF. 7 8 GNU GPERF is free software; you can redistribute it and/or modify --- 758 unchanged lines hidden (view full) --- 767 printf ("static "); 768 printf ("unsigned int\n"); 769 if (option[CPLUSPLUS]) 770 printf ("%s::", option.get_class_name ()); 771 printf ("%s ", option.get_hash_name ()); 772 printf (option[KRC] ? 773 "(str, len)\n" 774 " register char *str;\n" | 1/* Output routines. 2 Copyright (C) 1989-1998, 2000, 2002-2004, 2006-2007 Free Software Foundation, Inc. 3 Written by Douglas C. Schmidt <schmidt@ics.uci.edu> 4 and Bruno Haible <bruno@clisp.org>. 5 6 This file is part of GNU GPERF. 7 8 GNU GPERF is free software; you can redistribute it and/or modify --- 758 unchanged lines hidden (view full) --- 767 printf ("static "); 768 printf ("unsigned int\n"); 769 if (option[CPLUSPLUS]) 770 printf ("%s::", option.get_class_name ()); 771 printf ("%s ", option.get_hash_name ()); 772 printf (option[KRC] ? 773 "(str, len)\n" 774 " register char *str;\n" |
775 " register %s len;\n" : | 775 " register unsigned int len;\n" : |
776 option[C] ? 777 "(str, len)\n" 778 " register const char *str;\n" | 776 option[C] ? 777 "(str, len)\n" 778 " register const char *str;\n" |
779 " register %s len;\n" : | 779 " register unsigned int len;\n" : |
780 option[ANSIC] | option[CPLUSPLUS] ? | 780 option[ANSIC] | option[CPLUSPLUS] ? |
781 "(register const char *str, register %s len)\n" : 782 "%s", option.get_size_type()); | 781 "(register const char *str, register unsigned int len)\n" : 782 ""); |
783 784 /* Note that when the hash function is called, it has already been verified 785 that min_key_len <= len <= max_key_len. */ 786 787 /* Output the function's body. */ 788 printf ("{\n"); 789 790 /* First the asso_values array. */ --- 79 unchanged lines hidden (view full) --- 870 } 871 else 872 { 873 /* We've got to use the correct, but brute force, technique. */ 874 printf (" register int hval = %s;\n\n" 875 " switch (%s)\n" 876 " {\n" 877 " default:\n", | 783 784 /* Note that when the hash function is called, it has already been verified 785 that min_key_len <= len <= max_key_len. */ 786 787 /* Output the function's body. */ 788 printf ("{\n"); 789 790 /* First the asso_values array. */ --- 79 unchanged lines hidden (view full) --- 870 } 871 else 872 { 873 /* We've got to use the correct, but brute force, technique. */ 874 printf (" register int hval = %s;\n\n" 875 " switch (%s)\n" 876 " {\n" 877 " default:\n", |
878 option[NOLENGTH] ? "0" : "(int)len", | 878 option[NOLENGTH] ? "0" : "len", |
879 option[NOLENGTH] ? "len" : "hval"); 880 881 while (key_pos != Positions::LASTCHAR && key_pos >= _max_key_len) 882 if ((key_pos = iter.next ()) == PositionIterator::EOS) 883 break; 884 885 if (key_pos != PositionIterator::EOS && key_pos != Positions::LASTCHAR) 886 { --- 1008 unchanged lines hidden (view full) --- 1895 printf ("%s%s\n", 1896 const_for_struct, _return_type); 1897 if (option[CPLUSPLUS]) 1898 printf ("%s::", option.get_class_name ()); 1899 printf ("%s ", option.get_function_name ()); 1900 printf (option[KRC] ? 1901 "(str, len)\n" 1902 " register char *str;\n" | 879 option[NOLENGTH] ? "len" : "hval"); 880 881 while (key_pos != Positions::LASTCHAR && key_pos >= _max_key_len) 882 if ((key_pos = iter.next ()) == PositionIterator::EOS) 883 break; 884 885 if (key_pos != PositionIterator::EOS && key_pos != Positions::LASTCHAR) 886 { --- 1008 unchanged lines hidden (view full) --- 1895 printf ("%s%s\n", 1896 const_for_struct, _return_type); 1897 if (option[CPLUSPLUS]) 1898 printf ("%s::", option.get_class_name ()); 1899 printf ("%s ", option.get_function_name ()); 1900 printf (option[KRC] ? 1901 "(str, len)\n" 1902 " register char *str;\n" |
1903 " register %s len;\n" : | 1903 " register unsigned int len;\n" : |
1904 option[C] ? 1905 "(str, len)\n" 1906 " register const char *str;\n" | 1904 option[C] ? 1905 "(str, len)\n" 1906 " register const char *str;\n" |
1907 " register %s len;\n" : | 1907 " register unsigned int len;\n" : |
1908 option[ANSIC] | option[CPLUSPLUS] ? | 1908 option[ANSIC] | option[CPLUSPLUS] ? |
1909 "(register const char *str, register %s len)\n" : 1910 "%s", option.get_size_type()); | 1909 "(register const char *str, register unsigned int len)\n" : 1910 ""); |
1911 1912 /* Output the function's body. */ 1913 printf ("{\n"); 1914 1915 if (option[ENUM] && !option[GLOBAL]) 1916 { 1917 Output_Enum style (" "); 1918 output_constants (style); --- 150 unchanged lines hidden (view full) --- 2069 output_upperlower_strcmp (); 2070 } 2071 } 2072 2073 if (option[CPLUSPLUS]) 2074 printf ("class %s\n" 2075 "{\n" 2076 "private:\n" | 1911 1912 /* Output the function's body. */ 1913 printf ("{\n"); 1914 1915 if (option[ENUM] && !option[GLOBAL]) 1916 { 1917 Output_Enum style (" "); 1918 output_constants (style); --- 150 unchanged lines hidden (view full) --- 2069 output_upperlower_strcmp (); 2070 } 2071 } 2072 2073 if (option[CPLUSPLUS]) 2074 printf ("class %s\n" 2075 "{\n" 2076 "private:\n" |
2077 " static inline unsigned int %s (const char *str, %s len);\n" | 2077 " static inline unsigned int %s (const char *str, unsigned int len);\n" |
2078 "public:\n" | 2078 "public:\n" |
2079 " static %s%s%s (const char *str, %s len);\n" | 2079 " static %s%s%s (const char *str, unsigned int len);\n" |
2080 "};\n" 2081 "\n", | 2080 "};\n" 2081 "\n", |
2082 option.get_class_name (), option.get_hash_name (), option.get_size_type(), 2083 const_for_struct, _return_type, option.get_function_name (), 2084 option.get_size_type()); | 2082 option.get_class_name (), option.get_hash_name (), 2083 const_for_struct, _return_type, option.get_function_name ()); |
2085 2086 output_hash_function (); 2087 2088 if (option[SHAREDLIB] && (option[GLOBAL] || option[TYPE])) 2089 output_lookup_pools (); 2090 if (option[GLOBAL]) 2091 output_lookup_tables (); 2092 2093 output_lookup_function (); 2094 2095 if (_verbatim_code < _verbatim_code_end) 2096 { 2097 output_line_directive (_verbatim_code_lineno); 2098 fwrite (_verbatim_code, 1, _verbatim_code_end - _verbatim_code, stdout); 2099 } 2100 2101 fflush (stdout); 2102} | 2084 2085 output_hash_function (); 2086 2087 if (option[SHAREDLIB] && (option[GLOBAL] || option[TYPE])) 2088 output_lookup_pools (); 2089 if (option[GLOBAL]) 2090 output_lookup_tables (); 2091 2092 output_lookup_function (); 2093 2094 if (_verbatim_code < _verbatim_code_end) 2095 { 2096 output_line_directive (_verbatim_code_lineno); 2097 fwrite (_verbatim_code, 1, _verbatim_code_end - _verbatim_code, stdout); 2098 } 2099 2100 fflush (stdout); 2101} |