LEFT | RIGHT |
(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 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
702 Buf in, out; | 702 Buf in, out; |
703 ········ | 703 ········ |
704 binit(&in); | 704 binit(&in); |
705 binit(&out); | 705 binit(&out); |
706 ········ | 706 ········ |
707 file = goc; | 707 file = goc; |
708 readfile(&in, goc); | 708 readfile(&in, goc); |
709 | 709 |
710 // TODO: set gcc=1 when using gcc | 710 // TODO: set gcc=1 when using gcc |
711 | 711 |
712 » if(!gcc && streq(goarch, "amd64")) { | 712 » if(!gcc) { |
713 » » type_table[Uintptr].size = 8; | 713 » » if(streq(goarch, "amd64")) { |
714 » » type_table[String].size = 16; | 714 » » » type_table[Uintptr].size = 8; |
715 » » type_table[Slice].size = 8+4+4; | 715 » » » type_table[String].size = 16; |
716 » » type_table[Eface].size = 8+8; | 716 » » » type_table[Slice].size = 8+4+4; |
717 » » structround = 8; | 717 » » » type_table[Eface].size = 8+8; |
718 » } | 718 » » » structround = 8; |
719 | 719 » » } else { |
720 » bprintf(&out, "// auto generated by go tool dist\n\n"); | 720 » » » type_table[Uintptr].size = 4; |
| 721 » » » type_table[String].size = 8; |
| 722 » » » type_table[Slice].size = 16; |
| 723 » » » type_table[Eface].size = 4+4; |
| 724 » » » structround = 4; |
| 725 » » } |
| 726 » } |
| 727 |
| 728 » bprintf(&out, "// auto generated by go tool dist\n// goos=%s goarch=%s\n
\n", goos, goarch); |
721 input = bstr(&in); | 729 input = bstr(&in); |
722 output = &out; | 730 output = &out; |
723 | 731 |
724 process_file(); | 732 process_file(); |
725 ········ | 733 ········ |
726 writefile(&out, c); | 734 writefile(&out, c); |
727 } | 735 } |
LEFT | RIGHT |