Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(421)

Delta Between Two Patch Sets: src/cmd/dist/goc2c.c

Issue 5608059: code review 5608059: build: dist-based build for Plan 9 (Closed)
Left Patch Set: Created 13 years, 2 months ago
Right Patch Set: diff -r cb5c48bccd5a https://code.google.com/p/go/ Created 12 years, 11 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « src/cmd/dist/buildruntime.c ('k') | src/cmd/dist/plan9.c » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
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 "a.h" 5 #include "a.h"
6 6
7 /* 7 /*
8 * Translate a .goc file into a .c file. A .goc file is a combination 8 * Translate a .goc file into a .c file. A .goc file is a combination
9 * of a limited form of Go with C. 9 * of a limited form of Go with C.
10 */ 10 */
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 {"byte", 1}, 104 {"byte", 1},
105 {"int8", 1}, 105 {"int8", 1},
106 {"uint8", 1}, 106 {"uint8", 1},
107 {"int16", 2}, 107 {"int16", 2},
108 {"uint16", 2}, 108 {"uint16", 2},
109 {"int32", 4}, 109 {"int32", 4},
110 {"uint32", 4}, 110 {"uint32", 4},
111 {"int64", 8}, 111 {"int64", 8},
112 {"uint64", 8}, 112 {"uint64", 8},
113 113
114 » {nil}, 114 » {nil, 0},
115 }; 115 };
116 116
117 /* Fixed structure alignment (non-gcc only) */ 117 /* Fixed structure alignment (non-gcc only) */
118 int structround = 4; 118 int structround = 4;
119 119
120 /* Unexpected EOF. */ 120 /* Unexpected EOF. */
121 static void 121 static void
122 bad_eof(void) 122 bad_eof(void)
123 { 123 {
124 fatal("%s:%ud: unexpected EOF\n", file, lineno); 124 fatal("%s:%ud: unexpected EOF\n", file, lineno);
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 write_params(params, &first); 563 write_params(params, &first);
564 bwritef(output, ")\n{\n"); 564 bwritef(output, ")\n{\n");
565 for (p = rets; p != nil; p = p->next) 565 for (p = rets; p != nil; p = p->next)
566 bwritef(output, " %s %s;\n", p->type, p->name); 566 bwritef(output, " %s %s;\n", p->type, p->name);
567 } 567 }
568 568
569 /* Write out a gcc function trailer. */ 569 /* Write out a gcc function trailer. */
570 static void 570 static void
571 write_gcc_func_trailer(char *package, char *name, struct params *rets) 571 write_gcc_func_trailer(char *package, char *name, struct params *rets)
572 { 572 {
573 » if (rets == nil) 573 » if (rets == nil) {
574 » » ; 574 » » // nothing to do
575 » }
575 else if (rets->next == nil) 576 else if (rets->next == nil)
576 bwritef(output, "return %s;\n", rets->name); 577 bwritef(output, "return %s;\n", rets->name);
577 else { 578 else {
578 struct params *p; 579 struct params *p;
579 580
580 bwritef(output, " {\n struct %s_%s_ret __ret;\n", package, n ame); 581 bwritef(output, " {\n struct %s_%s_ret __ret;\n", package, n ame);
581 for (p = rets; p != nil; p = p->next) 582 for (p = rets; p != nil; p = p->next)
582 bwritef(output, " __ret.%s = %s;\n", p->name, p->name ); 583 bwritef(output, " __ret.%s = %s;\n", p->name, p->name );
583 bwritef(output, " return __ret;\n }\n"); 584 bwritef(output, " return __ret;\n }\n");
584 } 585 }
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 } 727 }
727 728
728 bprintf(&out, "// auto generated by go tool dist\n// goos=%s goarch=%s\n \n", goos, goarch); 729 bprintf(&out, "// auto generated by go tool dist\n// goos=%s goarch=%s\n \n", goos, goarch);
729 input = bstr(&in); 730 input = bstr(&in);
730 output = &out; 731 output = &out;
731 732
732 process_file(); 733 process_file();
733 ········ 734 ········
734 writefile(&out, c, 0); 735 writefile(&out, c, 0);
735 } 736 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b