Made the DSL syntax less confusing: Input and output arrays are now ScalarField and VectorFields instead of scalars and vectors. C++ initializers are now also possible, removing the need to declare Fields as int or int3 which was very confusing, like "what, you assing an int value to a real, what the &^%@?"

This commit is contained in:
jpekkila
2019-08-08 21:07:36 +03:00
parent 5397495496
commit b53cabbc44
6 changed files with 54 additions and 45 deletions

View File

@@ -229,8 +229,11 @@ translate_latest_symbol(void)
// IN / OUT
else if (symbol->type != SYMBOLTYPE_FUNCTION_PARAMETER &&
(symbol->type_qualifier == IN || symbol->type_qualifier == OUT)) {
const char* inout_type_qualifier = "static __device__ const auto";
printf("%s %s%s", inout_type_qualifier, inout_name_prefix, symbol_table[handle].identifier);
printf("static __device__ const %s %s%s", symbol->type_specifier == SCALAR ? "int" : "int3",
inout_name_prefix, symbol_table[handle].identifier);
if (symbol->type_specifier == VECTOR)
printf(" = make_int3");
}
// OTHER
else {