LEFT | RIGHT |
1 // Copyright 2009 The Go Authors. All rights reserved. | 1 // Copyright 2009 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 #include <u.h> | 5 #include <u.h> |
6 #include <libc.h> | 6 #include <libc.h> |
7 #include "go.h" | 7 #include "go.h" |
8 #include "y.tab.h" | 8 #include "y.tab.h" |
9 #include <ar.h> | 9 #include <ar.h> |
10 | 10 |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 Biobuf *imp; | 448 Biobuf *imp; |
449 char *file, *p, *q; | 449 char *file, *p, *q; |
450 int32 c; | 450 int32 c; |
451 int len; | 451 int len; |
452 Strlit *path; | 452 Strlit *path; |
453 char *cleanbuf; | 453 char *cleanbuf; |
454 | 454 |
455 USED(line); | 455 USED(line); |
456 | 456 |
457 // TODO(rsc): don't bother reloading imports more than once? | 457 // TODO(rsc): don't bother reloading imports more than once? |
| 458 |
458 if(f->ctype != CTSTR) { | 459 if(f->ctype != CTSTR) { |
459 yyerror("import statement not a string"); | 460 yyerror("import statement not a string"); |
460 return; | 461 return; |
461 } | 462 } |
462 | 463 |
463 if(strlen(f->u.sval->s) != f->u.sval->len) { | 464 if(strlen(f->u.sval->s) != f->u.sval->len) { |
464 yyerror("import path contains NUL"); | 465 yyerror("import path contains NUL"); |
465 errorexit(); | 466 errorexit(); |
466 } | 467 } |
467 | 468 |
(...skipping 1489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1957 p = infile; | 1958 p = infile; |
1958 else | 1959 else |
1959 p = p+1; | 1960 p = p+1; |
1960 snprint(namebuf, sizeof(namebuf), "%s", p); | 1961 snprint(namebuf, sizeof(namebuf), "%s", p); |
1961 p = strrchr(namebuf, '.'); | 1962 p = strrchr(namebuf, '.'); |
1962 if(p != nil) | 1963 if(p != nil) |
1963 *p = 0; | 1964 *p = 0; |
1964 outfile = smprint("%s.%c", namebuf, thechar); | 1965 outfile = smprint("%s.%c", namebuf, thechar); |
1965 } | 1966 } |
1966 } | 1967 } |
LEFT | RIGHT |