[MITA] compile time errors
Answer
9/4/18 1:03 PM
every button_two.pressed {
	var i_arr : array<uint16> = [ 0,0,0];
	var f_arr : array<double> = [ 0,0,0];
	println(`${i_arr[0]}, ${i_arr[1]}, ${i_arr[2]}`);
	println(`${f_arr[0]}, ${f_arr[1]}, ${f_arr[2]}`);
}

I intend to print the contents of an array using that code. What is transpiles to  is:

Retcode_T HandleEveryButton_twoPressed1(void* userParameter1, uint32_t userParameter2)
{	
	BCDS_UNUSED(userParameter1);
	BCDS_UNUSED(userParameter2);

	Retcode_T exception = NO_EXCEPTION;
	
	// buffer for i_arr
	uint16_t data_i_arr_1[3] = {0, 0, 0};
	// var i_arr: array<uint16_t>
	array_uint16_t i_arr = {
		.data = data_i_arr_1,
		.length = 3
	};
	
	// buffer for f_arr
	double data_f_arr_2[3] = {0, 0, 0};
	// var f_arr: array<double>
	array_double f_arr = {
		.data = data_f_arr_2,
		.length = 3
	};
		
	printf("%" PRIu16 ", %" PRIu16 ", %" PRIu16 "\n", i_arr.data[0];, i_arr.data[1];, i_arr.data[2];);
	printf("%.6g, %.6g, %.6g\n", f_arr.data[0];, f_arr.data[1];, f_arr.data[2];);

	return NO_EXCEPTION;
}

Note the extraneous ';' characters in the printf statements which cause syntax errors during the build. How can I circumvent this other than fixing the C-Code direct?

Regards

  Holger

 

0 (0 Votes)
RE: [MITA] compile time errors
Answer
9/5/18 2:14 PM as a reply to Holger Smolinski.
Hello Holger,

I was able to reproduce this error. Unfortunately, there is no other approach to solve it available, except fixing the generating C code.

Nevertheless, I forward this issue to the Mita developer team.

Kind regards,
Franjo
0 (0 Votes)