comparison lib-src/ootags.c @ 438:84b14dcb0985 r21-2-27

Import from CVS: tag r21-2-27
author cvs
date Mon, 13 Aug 2007 11:32:25 +0200
parents 3ecd8885ac67
children abe6d1db359e
comparison
equal deleted inserted replaced
437:e2a4e8b94b82 438:84b14dcb0985
102 #endif /* HAVE_UNISTD_H */ 102 #endif /* HAVE_UNISTD_H */
103 103
104 #include <stdio.h> 104 #include <stdio.h>
105 #include <ctype.h> 105 #include <ctype.h>
106 #include <errno.h> 106 #include <errno.h>
107 #ifndef errno
108 extern int errno;
109 #endif
110 #include <sys/types.h> 107 #include <sys/types.h>
111 #include <sys/stat.h> 108 #include <sys/stat.h>
112 109
113 #if !defined (S_ISREG) && defined (S_IFREG) 110 #if !defined (S_ISREG) && defined (S_IFREG)
114 # define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) 111 # define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
174 /*#endif*/ 171 /*#endif*/
175 172
176 #ifdef OO_BROWSER 173 #ifdef OO_BROWSER
177 #define set_construct(construct) \ 174 #define set_construct(construct) \
178 if (!oo_browser_construct) oo_browser_construct = construct 175 if (!oo_browser_construct) oo_browser_construct = construct
179 void oo_browser_clear_all_globals(); 176 void oo_browser_clear_all_globals(void);
180 void oo_browser_clear_some_globals(); 177 void oo_browser_clear_some_globals(void);
181 void oo_browser_check_and_clear_structtype(); 178 void oo_browser_check_and_clear_structtype(void);
182 #endif 179 #endif
183 180
184 /* 181 /*
185 * xnew, xrnew -- allocate, reallocate storage 182 * xnew, xrnew -- allocate, reallocate storage
186 * 183 *
198 # define xrnew(op,n,Type) ((Type *) xrealloc ((op), (n) * sizeof (Type))) 195 # define xrnew(op,n,Type) ((Type *) xrealloc ((op), (n) * sizeof (Type)))
199 #endif 196 #endif
200 197
201 typedef int bool; 198 typedef int bool;
202 199
203 typedef void Lang_function (); 200 typedef void Lang_function (FILE *);
204 201
205 typedef struct 202 typedef struct
206 { 203 {
207 char *name; 204 char *name;
208 Lang_function *function; 205 Lang_function *function;
858 } 855 }
859 #endif /* VMS */ 856 #endif /* VMS */
860 857
861 858
862 int 859 int
863 main (argc, argv) 860 main (int argc, char *argv[])
864 int argc;
865 char *argv[];
866 { 861 {
867 int i; 862 int i;
868 unsigned int nincluded_files; 863 unsigned int nincluded_files;
869 char **included_files; 864 char **included_files;
870 char *this_file; 865 char *this_file;
1652 /* Prefix character to use in OO-Browser listings for the current tag. */ 1647 /* Prefix character to use in OO-Browser listings for the current tag. */
1653 static char oo_browser_prefix; 1648 static char oo_browser_prefix;
1654 #endif 1649 #endif
1655 1650
1656 void 1651 void
1657 put_entries (np) 1652 put_entries (node *np)
1658 register node *np;
1659 { 1653 {
1660 register char *sp; 1654 register char *sp;
1661 1655
1662 if (np == NULL) 1656 if (np == NULL)
1663 return; 1657 return;
1887 #define MIN_HASH_VALUE 13 1881 #define MIN_HASH_VALUE 13
1888 #define MAX_HASH_VALUE 129 1882 #define MAX_HASH_VALUE 129
1889 /* maximum key range = 117, duplicates = 0 */ 1883 /* maximum key range = 117, duplicates = 0 */
1890 1884
1891 static unsigned int 1885 static unsigned int
1892 hash (str, len) 1886 hash (char *str, unsigned int len)
1893 register char *str;
1894 register int unsigned len;
1895 { 1887 {
1896 static unsigned char asso_values[] = 1888 static unsigned char asso_values[] =
1897 { 1889 {
1898 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 1890 130, 130, 130, 130, 130, 130, 130, 130, 130, 130,
1899 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 1891 130, 130, 130, 130, 130, 130, 130, 130, 130, 130,
1907 130, 130, 130, 130, 130, 130, 130, 47, 55, 8, 1899 130, 130, 130, 130, 130, 130, 130, 47, 55, 8,
1908 15, 33, 61, 38, 130, 60, 130, 130, 2, 9, 1900 15, 33, 61, 38, 130, 60, 130, 130, 2, 9,
1909 10, 62, 59, 130, 28, 27, 50, 19, 3, 130, 1901 10, 62, 59, 130, 28, 27, 50, 19, 3, 130,
1910 130, 130, 130, 130, 130, 130, 130, 130, 1902 130, 130, 130, 130, 130, 130, 130, 130,
1911 }; 1903 };
1912 return len + asso_values[str[2]] + asso_values[str[0]]; 1904 return len +
1913 } 1905 asso_values[(unsigned char) str[2]] +
1914 1906 asso_values[(unsigned char) str[0]];
1915 struct C_stab_entry * 1907 }
1916 in_word_set (str, len) 1908
1917 register char *str; 1909 static struct C_stab_entry *
1918 register unsigned int len; 1910 in_word_set (char *str, unsigned int len)
1919 { 1911 {
1920 static struct C_stab_entry wordlist[] = 1912 static struct C_stab_entry wordlist[] =
1921 { 1913 {
1922 {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, 1914 {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",},
1923 {"",}, {"",}, {"",}, {"",}, 1915 {"",}, {"",}, {"",}, {"",},
2075 char *structtag = "<uninited>"; 2067 char *structtag = "<uninited>";
2076 enum sym_type structtype; 2068 enum sym_type structtype;
2077 2069
2078 #ifdef OO_BROWSER 2070 #ifdef OO_BROWSER
2079 void 2071 void
2080 oo_browser_check_and_clear_structtype() 2072 oo_browser_check_and_clear_structtype(void)
2081 { 2073 {
2082 /* Allow for multiple enum_label tags. */ 2074 /* Allow for multiple enum_label tags. */
2083 if (structtype != st_C_enum) 2075 if (structtype != st_C_enum)
2084 structtype = st_none; 2076 structtype = st_none;
2085 } 2077 }
2154 */ 2146 */
2155 int methodlen; 2147 int methodlen;
2156 2148
2157 #ifdef OO_BROWSER 2149 #ifdef OO_BROWSER
2158 void 2150 void
2159 oo_browser_clear_all_globals() 2151 oo_browser_clear_all_globals(void)
2160 { 2152 {
2161 /* Initialize globals so there is no carry over between files. */ 2153 /* Initialize globals so there is no carry over between files. */
2162 oo_browser_construct = C_NULL; 2154 oo_browser_construct = C_NULL;
2163 fvdef = fvnone; typdef = tnone; structdef = snone; 2155 fvdef = fvnone; typdef = tnone; structdef = snone;
2164 definedef = dnone; objdef = onone; 2156 definedef = dnone; objdef = onone;
2165 structtype = st_none; 2157 structtype = st_none;
2166 next_token_is_func = yacc_rules = FALSE; 2158 next_token_is_func = yacc_rules = FALSE;
2167 } 2159 }
2168 2160
2169 void 2161 void
2170 oo_browser_clear_some_globals() 2162 oo_browser_clear_some_globals(void)
2171 { 2163 {
2172 oo_browser_construct = C_NULL; 2164 oo_browser_construct = C_NULL;
2173 structtype = st_none; 2165 structtype = st_none;
2174 } 2166 }
2175 #endif 2167 #endif
3636 * Bob Weiner, Motorola Inc., 4/3/94 3628 * Bob Weiner, Motorola Inc., 4/3/94
3637 * Unix and microcontroller assembly tag handling 3629 * Unix and microcontroller assembly tag handling
3638 * look for '^[a-zA-Z_.$][a-zA_Z0-9_.$]*[: ^I^J]' 3630 * look for '^[a-zA-Z_.$][a-zA_Z0-9_.$]*[: ^I^J]'
3639 */ 3631 */
3640 void 3632 void
3641 Asm_labels (inf) 3633 Asm_labels (FILE *inf)
3642 FILE *inf;
3643 { 3634 {
3644 register char *cp; 3635 register char *cp;
3645 3636
3646 LOOP_ON_INPUT_LINES (inf, lb, cp) 3637 LOOP_ON_INPUT_LINES (inf, lb, cp)
3647 { 3638 {