Left: | ||
Right: |
OLD | NEW |
---|---|
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 #define EXTERN | 5 #define EXTERN |
6 #include "go.h" | 6 #include "go.h" |
7 #include "y.tab.h" | 7 #include "y.tab.h" |
8 #include <ar.h> | 8 #include <ar.h> |
9 | 9 |
10 extern int yychar; | 10 extern int yychar; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
58 debug[c]++; | 58 debug[c]++; |
59 break; | 59 break; |
60 | 60 |
61 case 'o': | 61 case 'o': |
62 outfile = ARGF(); | 62 outfile = ARGF(); |
63 break; | 63 break; |
64 | 64 |
65 case 'I': | 65 case 'I': |
66 addidir(ARGF()); | 66 addidir(ARGF()); |
67 break; | 67 break; |
68 case 'V': | |
69 print("%cg verison %s\n", thechar, getgoversion()); | |
rsc
2010/02/06 00:23:13
version
| |
70 errorexit(); | |
68 } ARGEND | 71 } ARGEND |
69 | 72 |
70 if(argc < 1) | 73 if(argc < 1) |
71 goto usage; | 74 goto usage; |
72 | 75 |
73 // special flag to detect compilation of package runtime | 76 // special flag to detect compilation of package runtime |
74 compiling_runtime = debug['+']; | 77 compiling_runtime = debug['+']; |
75 | 78 |
76 pathname = mal(1000); | 79 pathname = mal(1000); |
77 if(getwd(pathname, 999) == 0) | 80 if(getwd(pathname, 999) == 0) |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
161 usage: | 164 usage: |
162 print("flags:\n"); | 165 print("flags:\n"); |
163 // -A is allow use of "any" type, for bootstrapping | 166 // -A is allow use of "any" type, for bootstrapping |
164 print(" -I DIR search for packages in DIR\n"); | 167 print(" -I DIR search for packages in DIR\n"); |
165 print(" -d print declarations\n"); | 168 print(" -d print declarations\n"); |
166 print(" -e no limit on number of errors printed\n"); | 169 print(" -e no limit on number of errors printed\n"); |
167 print(" -f print stack frame structure\n"); | 170 print(" -f print stack frame structure\n"); |
168 print(" -h panic on an error\n"); | 171 print(" -h panic on an error\n"); |
169 print(" -o file specify output file\n"); | 172 print(" -o file specify output file\n"); |
170 print(" -S print the assembly language\n"); | 173 print(" -S print the assembly language\n"); |
174 print(" -V print the version number of %cg\n", thechar); | |
rsc
2010/02/06 00:23:13
print the compiler version
| |
171 print(" -w print the parse tree after typing\n"); | 175 print(" -w print the parse tree after typing\n"); |
172 print(" -x print lex tokens\n"); | 176 print(" -x print lex tokens\n"); |
173 exit(0); | 177 exit(0); |
174 return 0; | 178 return 0; |
175 } | 179 } |
176 | 180 |
177 int | 181 int |
178 arsize(Biobuf *b, char *name) | 182 arsize(Biobuf *b, char *name) |
179 { | 183 { |
180 struct ar_hdr *a; | 184 struct ar_hdr *a; |
(...skipping 1425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1606 p = infile; | 1610 p = infile; |
1607 else | 1611 else |
1608 p = p+1; | 1612 p = p+1; |
1609 snprint(namebuf, sizeof(namebuf), "%s", p); | 1613 snprint(namebuf, sizeof(namebuf), "%s", p); |
1610 p = strrchr(namebuf, '.'); | 1614 p = strrchr(namebuf, '.'); |
1611 if(p != nil) | 1615 if(p != nil) |
1612 *p = 0; | 1616 *p = 0; |
1613 outfile = smprint("%s.%c", namebuf, thechar); | 1617 outfile = smprint("%s.%c", namebuf, thechar); |
1614 } | 1618 } |
1615 } | 1619 } |
OLD | NEW |