/[gcl]/gcl/o/pathname.d
ViewVC logotype

Diff of /gcl/o/pathname.d

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

revision 1.9 by camm, Sat Feb 15 00:38:28 2003 UTC revision 1.10 by mjthomas, Thu Feb 20 04:49:07 2003 UTC
# Line 64  int end; Line 64  int end;
64          vs_push(copy_simple_string(token));          vs_push(copy_simple_string(token));
65  }  }
66    
67    /* The function below does not attempt to handle DOS pathnames
68       which use backslashes as directory separators.  It needs
69       TLC from someone who feels pedantic. MJT */
70    
71  /* !!!!! Bug Fix. NLG */  /* !!!!! Bug Fix. NLG */
72  static object  static object
73  parse_namestring(s, start, end, ep)  parse_namestring(s, start, end, ep)
# Line 76  int start, end, *ep; Line 80  int start, end, *ep;
80          object x;          object x;
81          vs_mark;          vs_mark;
82    
         vsp = vs_top + 1;  
         for (;--end >= start && isspace((int)s->st.st_self[end]););  
         for (i = j = start;  i <= end;  ) {  
 /*              if (isspace((int)s->st.st_self[i])) */  
 /*                      break; */  
83  #ifndef IS_DIR_SEPARATOR  #ifndef IS_DIR_SEPARATOR
84  #define IS_DIR_SEPARATOR(x) (x == '/')  #define IS_DIR_SEPARATOR(x) (x == '/')
85  #endif  #endif
86            vsp = vs_top + 1;
87            for (;--end >= start && isspace((int)s->st.st_self[end]););
88           /* fprintf ( stderr, "1 %s \n", s->st.st_self );*/
89            for (i = j = start;  i <= end;  ) {
90  #ifdef UNIX  #ifdef UNIX
91                  if (IS_DIR_SEPARATOR(s->st.st_self[i])) {                  if (IS_DIR_SEPARATOR(s->st.st_self[i])) {
92  #endif  #endif
   
93                          if (j == 0 && i == 0) {                          if (j == 0 && i == 0) {
94                                  i++;                                  i++;
95                                  vs_push(sKroot);                                  vs_push(sKroot);
# Line 102  int start, end, *ep; Line 104  int start, end, *ep;
104                                  continue;                                  continue;
105                          }                          }
106                          /* END OF BUG FIX */                          /* END OF BUG FIX */
 #endif  
 #ifdef UNIX  
107                          if (i-j == 1 && s->st.st_self[j] == '.') {                          if (i-j == 1 && s->st.st_self[j] == '.') {
108                                    /*fprintf ( stderr, "1 pushing sKcurrent\n" );*/
109                                  vs_push(sKcurrent);                                  vs_push(sKcurrent);
110                          } else if (i-j==2 && s->st.st_self[j]=='.' && s->st.st_self[j+1]=='.') {                          } else if (i-j==2 && s->st.st_self[j]=='.' && s->st.st_self[j+1]=='.') {
111                                    /*fprintf ( stderr, "2 pushing sKparent\n" );*/
112                                  vs_push(sKparent);                                  vs_push(sKparent);
113                          } else                          } else {
114                                    /*fprintf ( stderr, "3 pushing %d %d, %c\n", j, i-j, s->st.st_self[j] );*/
115                                  make_one(&s->st.st_self[j], i-j);                                  make_one(&s->st.st_self[j], i-j);
116                            }
117  #endif  #endif
118                          i++;                          i++;
119                          j = i;                          j = i;
120                  } else                  } else {
121                        /* DOS drive character ':' after one drive letter */
122                        if ( (s->st.st_self[i] == ':') && (i == start+1) ) {
123                            /*fprintf ( stderr, "4 pushing %d %d, %c\n", j, 2, s->st.st_self[j] );*/
124                            make_one(&s->st.st_self[j], 2);
125                          i++;                          i++;
126                            /* Skip any succeeding path separators */
127                            if ( ( i+1 <= end ) && ( s->st.st_self[i+1] == '/' ) ) {
128                                i++;
129                            }
130                            j = i;
131                        } else {
132                            i++;
133                        }
134                    }
135          }          }
 #ifdef UNIX  
 /*  
         if (i-j == 1 && s->st.st_self[j] == '.') {  
                 vs_push(sKcurrent);  
                 j = i;  
         } else if (i-j == 2 && s->st.st_self[j] == '.' && s->st.st_self[j+1] == '.') {  
                 vs_push(sKparent);  
                 j = i;  
         }  
 */  
 #endif  
136          *ep = i;          *ep = i;
137          vs_push(Cnil);          vs_push(Cnil);
138          while (vs_top > vsp)          while (vs_top > vsp)
139                  stack_cons();                  stack_cons();
140          if (i == j) {          if (i == j) {
141                  /*  no file and no type  */                  /*  no file and no type  */
142                    /*fprintf ( stderr, "a2 pushing 2 Cnils\n" );*/
143                  vs_push(Cnil);                  vs_push(Cnil);
144                  vs_push(Cnil);                  vs_push(Cnil);
145                  goto L;                  goto L;
# Line 140  int start, end, *ep; Line 147  int start, end, *ep;
147          for (k = j, d = -1;  k < i;  k++)          for (k = j, d = -1;  k < i;  k++)
148                  if (s->st.st_self[k] == '.')                  if (s->st.st_self[k] == '.')
149                          d = k;                          d = k;
150            /*fprintf ( stderr, "9 d %d i %d j %d start %d end %d %c %c \n", d, i, j, start, end, s->st.st_self[i], s->st.st_self[j]  );*/
151          if (d == -1) {          if (d == -1) {
152                  /*  no file type  */                  /*  no file type  */
153  #ifdef UNIX  #ifdef UNIX
# Line 148  int start, end, *ep; Line 156  int start, end, *ep;
156                          vs_push(sKwild);                          vs_push(sKwild);
157                  else                  else
158                          make_one(&s->st.st_self[j], i-j);                          make_one(&s->st.st_self[j], i-j);
159                    
160                  vs_push(Cnil);                  vs_push(Cnil);
161                    /*fprintf ( stderr, "10 i %d j %d start %d end %d %c %c \n", i, j, start, end, s->st.st_self[i], s->st.st_self[j]  );*/
162          } else if (d == j) {          } else if (d == j) {
163                  /*  no file name  */                  /*  no file name  */
164                  vs_push(Cnil);                  vs_push(Cnil);
# Line 158  int start, end, *ep; Line 168  int start, end, *ep;
168                          vs_push(sKwild);                          vs_push(sKwild);
169                  else                  else
170                          make_one(&s->st.st_self[d+1], i-d-1);                          make_one(&s->st.st_self[d+1], i-d-1);
171                    /*fprintf ( stderr, "11 i %d j %d start %d end %d %c %c \n", i, j, start, end, s->st.st_self[i], s->st.st_self[j]  );*/
172          } else {          } else {
173                  /*  file name and file type  */                  /*  file name and file type  */
174  #ifdef UNIX  #ifdef UNIX
175                  if (d-j == 1 && s->st.st_self[j] == '*')                  if (d-j == 1 && s->st.st_self[j] == '*')
176  #endif  #endif
177                          vs_push(sKwild);                          vs_push(sKwild);
178                  else                  else {
179                            /*fprintf ( stderr, "a1 pushing %d %d, %c\n", j, d-j, s->st.st_self[j] );*/
180                          make_one(&s->st.st_self[j], d-j);                          make_one(&s->st.st_self[j], d-j);
181                         }
182  #ifdef UNIX  #ifdef UNIX
183                  if (i-d-1 == 1 && s->st.st_self[d+1] == '*')                  if (i-d-1 == 1 && s->st.st_self[d+1] == '*')
184  #endif  #endif
185                          vs_push(sKwild);                          vs_push(sKwild);
186                  else                  else
187    #ifdef __MINGW32__
188                            /* I don't understand this */
189                            make_one(&s->st.st_self[d+1], i-d-1);
190                            /*vs_push(Cnil);*/
191    #else
192                          make_one(&s->st.st_self[d+1], i-d-1);                          make_one(&s->st.st_self[d+1], i-d-1);
193    #endif
194                    /*fprintf ( stderr, "12 i %d j %d start %d end %d %c %c \n", i, j, start, end, s->st.st_self[j], s->st.st_self[d]  );*/
195          }          }
196  L:  L:
197          x          /*fprintf ( stderr, "13 i %d j %d start %d end %d %c %c \n", i, j, start, end, s->st.st_self[i], s->st.st_self[j]  );*/
198          = make_pathname(Cnil, Cnil,          x = make_pathname ( Cnil, Cnil, vs_top[-3], vs_top[-2], vs_top[-1], Cnil );
                         vs_top[-3], vs_top[-2], vs_top[-1], Cnil);  
199          vs_reset;          vs_reset;
200          return(x);          return(x);
   
         *ep = i;  
         vs_reset;  
         return(OBJNULL);  
201  }  }
202    
203  object  object
# Line 567  from ~S to ~S.", Line 582  from ~S to ~S.",
582          defaults          defaults
583                         &aux x)                         &aux x)
584  @  @
585          if (defaults == Cnil) {          if ( defaults == Cnil ) {
586                  defaults                  defaults = symbol_value ( Vdefault_pathname_defaults );
587                  = symbol_value(Vdefault_pathname_defaults);                  defaults = coerce_to_pathname ( defaults );
588                  defaults = coerce_to_pathname(defaults);                  defaults = make_pathname ( defaults->pn.pn_host,
589                  defaults                                   Cnil, Cnil, Cnil, Cnil, Cnil);
590                  = make_pathname(defaults->pn.pn_host,          } else {
                                 Cnil, Cnil, Cnil, Cnil, Cnil);  
         } else  
591                  defaults = coerce_to_pathname(defaults);                  defaults = coerce_to_pathname(defaults);
592            }
593          x = make_pathname(host, device, directory, name, type, version);          x = make_pathname(host, device, directory, name, type, version);
594          x = merge_pathnames(x, defaults, Cnil);          x = merge_pathnames(x, defaults, Cnil);
595          if ( host_supplied_p) x->pn.pn_host = host;          if ( host_supplied_p) x->pn.pn_host = host;

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10

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