/[bison]/bison/src/files.c
ViewVC logotype

Diff of /bison/src/files.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.63 by akim, Sat Dec 29 14:27:45 2001 UTC revision 1.64 by ra, Sun Dec 30 14:50:15 2001 UTC
# Line 51  char *infile = NULL; Line 51  char *infile = NULL;
51  char *attrsfile = NULL;  char *attrsfile = NULL;
52    
53  static char *base_name = NULL;  static char *base_name = NULL;
54  static char *short_base_name = NULL;  char *short_base_name = NULL;
55    
56  /* C source file extension (the parser source).  */  /* C source file extension (the parser source).  */
57  const char *src_extension = NULL;  const char *src_extension = NULL;
58  /* Header file extension (if option ``-d'' is specified).  */  /* Header file extension (if option ``-d'' is specified).  */
59  const char *header_extension = NULL;  const char *header_extension = NULL;
60    
61    /* Should we insert '.tab' in yacc-compatible parsers?  */
62    int tab_extension = 0;
63    
64    
65  /*--------------------------.  /*--------------------------.
66  | Is SUFFIX ending STRING?  |  | Is SUFFIX ending STRING?  |
67  `--------------------------*/  `--------------------------*/
68    
69  static int  int
70  strsuffix (const char *string, const char *suffix)  strsuffix (const char *string, const char *suffix)
71  {  {
72    size_t string_len = strlen (string);    size_t string_len = strlen (string);
# Line 80  strsuffix (const char *string, const cha Line 83  strsuffix (const char *string, const cha
83  | STRING1, and STRING2.                                            |  | STRING1, and STRING2.                                            |
84  `-----------------------------------------------------------------*/  `-----------------------------------------------------------------*/
85    
86  static char *  char*
87  stringappend (const char *string1, const char *string2)  stringappend (const char *string1, const char *string2)
88  {  {
89    size_t len = strlen (string1) + strlen (string2);    size_t len = strlen (string1) + strlen (string2);
# Line 334  compute_base_names (void) Line 337  compute_base_names (void)
337          short_base_length -= 4;          short_base_length -= 4;
338        short_base_name = strndup (spec_outfile, short_base_length);        short_base_name = strndup (spec_outfile, short_base_length);
339    
340          /* FIXME: This is a quick and dirty way for me to find out if we
341             should .tab or not, using the computations above.  */
342          if (strcmp (base_name, short_base_name))
343            tab_extension = 1;
344    
345        return;        return;
346      }      }
347    
# Line 360  compute_base_names (void) Line 368  compute_base_names (void)
368        if (ext_index)        if (ext_index)
369          compute_exts_from_gf (infile + ext_index);          compute_exts_from_gf (infile + ext_index);
370    
371          /* It seems that when only a prefix is given, '.tab' should always be
372             used.  */
373          tab_extension = 1;
374    
375        return;        return;
376      }      }
377    
# Line 393  compute_base_names (void) Line 405  compute_base_names (void)
405                           strlen (short_base_name) + strlen (EXT_TAB) + 1);                           strlen (short_base_name) + strlen (EXT_TAB) + 1);
406      stpcpy (stpcpy (base_name, short_base_name), EXT_TAB);      stpcpy (stpcpy (base_name, short_base_name), EXT_TAB);
407    
408        /* By default, Bison should insert '.tab' were needed.  */
409        tab_extension = 1;
410    
411      return;      return;
412    }    }
413  }  }

Legend:
Removed from v.1.63  
changed lines
  Added in v.1.64

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26