Property definitions

nitc $ CCompilationUnit :: defaultinit
# Accumulates all C code for a compilation unit
class CCompilationUnit
	## header
	# comments and native interface imports
	var header_c_base = new Template

	# custom C header code or generated for other languages
	var header_custom = new Template

	# types of extern classes and friendly types
	var header_c_types = new Template

	# implementation declaration for extern methods
	var header_decl = new Template

	## body
	# comments, imports, etc
	var body_decl = new Template

	# custom code and generated for ffi
	var body_custom = new Template

	# implementation body of extern methods
	var body_impl = new Template

	# files to compile TODO check is appropriate
	var files = new Array[String]

	# Add a `static` `c_function` to be strictly local to this unit
	fun add_local_function(c_function: CFunction)
	do
		body_decl.add "static {c_function.signature};\n"
		body_impl.add "\n"
		body_impl.add c_function.to_writer
	end

	# Add a public `c_function` accessible from outside this compilation unit
	fun add_exported_function(c_function: CFunction)
	do
		body_decl.add "{c_function.signature};\n"
		body_impl.add "\n"
		body_impl.add c_function.to_writer
	end

	# Write the core of the header to `stream`
	fun compile_header_core(stream: Writer)
	do
		header_c_base.write_to stream
		header_custom.write_to stream
		header_c_types.write_to stream
		header_decl.write_to stream
	end

	# Write the core of the body to `stream`
	fun compile_body_core(stream: Writer)
	do
		body_decl.write_to stream
		body_custom.write_to stream
		body_impl.write_to stream
	end
end
src/c_tools.nit:22,1--82,3