summaryrefslogtreecommitdiff
path: root/tnslc/compile/outbuf.tnsl
blob: 7394febf1ab4a46d4047d79b7d0e0b14a4013338 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
struct OutBuf {
	utils.Vector
		hsec,
		dsec,
		csec
}

/; method OutBuf
	/; init
		self.hsec.init(1)
		self.dsec.init(1)
		self.csec.init(1)
	;/

	/; write_to_file (~utils.File fout)
		fout`.open()
		fout`.write_cstr("bits 64\n\0")
		fout`.write_cstr(self.hsec.as_cstr())
		fout`.write_cstr("\nsection .data\n\0")
		fout`.write_cstr(self.dsec.as_cstr())
		fout`.write_cstr("\nsection .text\n\0")
		fout`.write_cstr(self.csec.as_cstr())
		fout`.close()
	;/

	/; end
		self.hsec.end()
		self.dsec.end()
		self.csec.end()
	;/
;/