comparison lib-src/etags.c @ 12344:7e7941d8cceb

* etags.c (find_entries): rewind before rereading the input file.
author Francesco Potortì <pot@gnu.org>
date Wed, 21 Jun 1995 12:15:15 +0000
parents 4fa8c6b3f192
children ccfd646cfad9
comparison
equal deleted inserted replaced
12343:91d4c394cb61 12344:7e7941d8cceb
107 107
108 #define iswhite(arg) (_wht[arg]) /* T if char is white */ 108 #define iswhite(arg) (_wht[arg]) /* T if char is white */
109 #define begtoken(arg) (_btk[arg]) /* T if char can start token */ 109 #define begtoken(arg) (_btk[arg]) /* T if char can start token */
110 #define intoken(arg) (_itk[arg]) /* T if char can be in token */ 110 #define intoken(arg) (_itk[arg]) /* T if char can be in token */
111 #define endtoken(arg) (_etk[arg]) /* T if char ends tokens */ 111 #define endtoken(arg) (_etk[arg]) /* T if char ends tokens */
112
113 #ifdef DOS_NT
114 # define absolutefn(fn) (fn[0] == '/' || (isalpha (fn[0]) && fn[1] == ':'))
115 #else
116 # define absolutefn(fn) (fn[0] == '/')
117 #endif
118
112 119
113 /* 120 /*
114 * xnew -- allocate storage 121 * xnew -- allocate storage
115 * 122 *
116 * SYNOPSIS: Type *xnew (int n, Type); 123 * SYNOPSIS: Type *xnew (int n, Type);
390 397
391 /* .cs or .hs: a C* file */ 398 /* .cs or .hs: a C* file */
392 { "cs", Cstar_entries }, 399 { "cs", Cstar_entries },
393 { "hs", Cstar_entries }, 400 { "hs", Cstar_entries },
394 401
395 /* .f and .for are FORTRAN. */ 402 /* .F, .f and .for are FORTRAN. */
396 { "F", Fortran_functions }, 403 { "F", Fortran_functions },
397 { "f", Fortran_functions }, 404 { "f", Fortran_functions },
398 { "for", Fortran_functions }, 405 { "for", Fortran_functions },
399 406
400 /* .pl implies prolog source code */ 407 /* .pl implies prolog source code */
1031 1038
1032 if (!CTAGS) 1039 if (!CTAGS)
1033 { 1040 {
1034 char *filename; 1041 char *filename;
1035 1042
1036 #ifdef DOS_NT 1043 if (absolutefn (file))
1037 if (file[0] == '/' || (isalpha (file[0]) && file[1] == ':'))
1038 #else
1039 if (file[0] == '/')
1040 #endif
1041 { 1044 {
1042 /* file is an absolute filename. Canonicalise it. */ 1045 /* file is an absolute filename. Canonicalise it. */
1043 filename = absolute_filename (file, cwd); 1046 filename = absolute_filename (file, cwd);
1044 } 1047 }
1045 else 1048 else
1129 old_last_node = last_node; 1132 old_last_node = last_node;
1130 Fortran_functions (inf); 1133 Fortran_functions (inf);
1131 1134
1132 /* No Fortran entries found. Try C. */ 1135 /* No Fortran entries found. Try C. */
1133 if (old_last_node == last_node) 1136 if (old_last_node == last_node)
1134 default_C_entries (inf); 1137 {
1138 rewind (inf);
1139 default_C_entries (inf);
1140 }
1135 fclose (inf); 1141 fclose (inf);
1136 } 1142 }
1137 1143
1138 /* Record a tag. */ 1144 /* Record a tag. */
1139 void 1145 void
3749 absolute_filename (file, cwd) 3755 absolute_filename (file, cwd)
3750 char *file, *cwd; 3756 char *file, *cwd;
3751 { 3757 {
3752 char *slashp, *cp, *res; 3758 char *slashp, *cp, *res;
3753 3759
3754 #ifdef DOS_NT 3760 if (absolutefn (file))
3755 if (file[0] == '/' || (isalpha (file[0]) && file[1] == ':'))
3756 #else
3757 if (file[0] == '/')
3758 #endif
3759 res = concat (file, "", ""); 3761 res = concat (file, "", "");
3760 else 3762 else
3761 res = concat (cwd, file, ""); 3763 res = concat (cwd, file, "");
3762 3764
3763 /* Delete the "/dirname/.." and "/." substrings. */ 3765 /* Delete the "/dirname/.." and "/." substrings. */