include "shell.s7i";
include "osfiles.s7i";
include "propertyfile.s7i";
const type: ccConfigType is new struct
var boolean: WITH_STRI_CAPACITY is FALSE;
var boolean: WITH_RTL_ARRAY_CAPACITY is FALSE;
var boolean: ALLOW_STRITYPE_SLICES is FALSE;
var boolean: ALLOW_BSTRITYPE_SLICES is FALSE;
var boolean: RSHIFT_DOES_SIGN_EXTEND is FALSE;
var boolean: TWOS_COMPLEMENT_INTTYPE is FALSE;
var boolean: LITTLE_ENDIAN_INTTYPE is FALSE;
var boolean: FLOAT_COMPARISON_OKAY is FALSE;
var boolean: POW_FUNCTION_OKAY is FALSE;
var boolean: FMOD_FUNCTION_OKAY is FALSE;
var boolean: SQRT_FUNCTION_OKAY is FALSE;
var boolean: EXP_FUNCTION_OKAY is FALSE;
var boolean: LOG_FUNCTION_OKAY is FALSE;
var boolean: LOG10_FUNCTION_OKAY is FALSE;
var boolean: LOG1P_FUNCTION_OKAY is FALSE;
var boolean: LOG2_FUNCTION_OKAY is FALSE;
var boolean: LDEXP_FUNCTION_OKAY is FALSE;
var boolean: FREXP_FUNCTION_OKAY is FALSE;
var boolean: HAS_SIGSETJMP is FALSE;
var boolean: CHECK_INT_DIV_BY_ZERO is FALSE;
var boolean: CHECK_INT_DIV_ZERO_BY_ZERO is FALSE;
var boolean: CHECK_INT_REM_BY_ZERO is FALSE;
var boolean: CHECK_INT_REM_ZERO_BY_ZERO is FALSE;
var boolean: FLOAT_ZERO_DIV_ERROR is FALSE;
var boolean: CHECK_FLOAT_DIV_BY_ZERO is FALSE;
var boolean: HAS_EXP2 is FALSE;
var boolean: HAS_EXP10 is FALSE;
var boolean: HAS_EXPM1 is FALSE;
var boolean: HAS_CBRT is FALSE;
var boolean: LIMITED_CSTRI_LITERAL_LEN is FALSE;
var boolean: SWITCH_WORKS_FOR_INT64TYPE is FALSE;
var boolean: STMT_BLOCK_IN_PARENTHESES_OK is FALSE;
var boolean: CC_SOURCE_UTF8 is FALSE;
var boolean: USE_WMAIN is FALSE;
var boolean: USE_WINMAIN is FALSE;
var boolean: USE_START_MAIN is FALSE;
var boolean: USE_DO_EXIT is FALSE;
var boolean: FLOATTYPE_DOUBLE is FALSE;
var integer: INTTYPE_SIZE is 0;
var integer: FLOATTYPE_SIZE is 0;
var integer: POINTER_SIZE is 0;
var integer: GENERIC_SIZE is 0;
var integer: INT_SIZE is 0;
var integer: INT_MIN is 0;
var integer: INT_MAX is 0;
var integer: LONG_SIZE is 0;
var integer: FLOATTYPE_MANTISSA_BITS is 0;
var integer: FLOATTYPE_EXPONENT_OFFSET is 0;
var integer: INT_RANGE_IN_FLOATTYPE_MAX is 0;
var integer: MINIMUM_TRUNC_ARGUMENT is 0;
var integer: MAXIMUM_TRUNC_ARGUMENT is 0;
var integer: PIXEL_ALPHA_MASK is 0;
var integer: PIXEL_RED_MASK is 0;
var integer: PIXEL_GREEN_MASK is 0;
var integer: PIXEL_BLUE_MASK is 0;
var string: RGB_TO_PIXEL_FLAG_NAME is "";
var integer: POINT_LIST_INT_SIZE is 0;
var boolean: POINT_LIST_ABSOLUTE is FALSE;
var integer: RAND_MULTIPLIER is 0;
var integer: RAND_INCREMENT is 0;
var string: BOOLTYPE is "";
var string: INT32TYPE is "";
var string: UINT32TYPE is "";
var string: INT64TYPE is "";
var string: UINT64TYPE is "";
var string: INT128TYPE is "";
var string: UINT128TYPE is "";
var string: INT32TYPE_LITERAL_SUFFIX is "";
var string: INT64TYPE_LITERAL_SUFFIX is "";
var string: MACRO_DEFS is "";
var string: OVERFLOW_SIGNAL is "";
var string: BUILTIN_ADD_OVERFLOW is "";
var string: BUILTIN_SUB_OVERFLOW is "";
var string: BUILTIN_MULT_OVERFLOW is "";
var integer: INT_DIV_OVERFLOW is 0;
var integer: INT_REM_OVERFLOW is 0;
var string: OBJECT_FILE_EXTENSION is "";
var string: LIBRARY_FILE_EXTENSION is "";
var string: EXECUTABLE_FILE_EXTENSION is "";
var string: LINKED_PROGRAM_EXTENSION is "";
var string: CC_ENVIRONMENT_INI is "";
var string: C_COMPILER is "";
var string: CPLUSPLUS_COMPILER is "";
var boolean: CALL_C_COMPILER_FROM_SHELL is FALSE;
var string: C_COMPILER_VERSION is "";
var array string: CC_OPT_DEBUG_INFO is 0 times "";
var string: CC_OPT_LINK_TIME_OPTIMIZATION is "";
var string: CC_OPT_NO_WARNINGS is "";
var array string: CC_OPT_OPTIMIZE_1 is 0 times "";
var array string: CC_OPT_OPTIMIZE_2 is 0 times "";
var array string: CC_OPT_OPTIMIZE_3 is 0 times "";
var string: CC_OPT_TRAP_OVERFLOW is "";
var string: CC_OPT_VERSION_INFO is "";
var array string: CC_FLAGS is 0 times "";
var integer: CC_ERROR_FILEDES is 0;
var integer: CC_VERSION_INFO_FILEDES is 0;
var string: LINKER_OPT_DEBUG_INFO is "";
var boolean: LINKER_OPT_LTO_MANDATORY is FALSE;
var string: LINKER_OPT_NO_DEBUG_INFO is "";
var string: LINKER_OPT_OUTPUT_FILE is "";
var string: LINKER_OPT_SPECIAL_LIB is "";
var string: LINKER_OPT_STACK_SIZE is "";
var array string: LINKER_FLAGS is 0 times "";
var integer: DEFAULT_STACK_SIZE is 0;
var array string: SYSTEM_LIBS is 0 times "";
var array string: SYSTEM_BIGINT_LIBS is 0 times "";
var array string: SYSTEM_CONSOLE_LIBS is 0 times "";
var array string: SYSTEM_DATABASE_LIBS is 0 times "";
var array string: SYSTEM_DRAW_LIBS is 0 times "";
var array string: SYSTEM_MATH_LIBS is 0 times "";
var string: SEED7_LIB is "";
var string: DRAW_LIB is "";
var string: CONSOLE_LIB is "";
var string: DATABASE_LIB is "";
var string: COMP_DATA_LIB is "";
var string: COMPILER_LIB is "";
var string: SPECIAL_LIB is "";
var string: S7_LIB_DIR is "";
var integer: VERSION_REVISION_LEVEL is 0;
var string: REDIRECT_FILEDES_1 is "";
var string: REDIRECT_FILEDES_2 is "";
var string: NULL_DEVICE is "";
var string: INTTYPE_LITERAL_SUFFIX is "";
end struct;
const func string: configValue (in string: name) is action "CMD_CONFIG_VALUE";
const func ccConfigType: getBuiltInConfig is func
result
var ccConfigType: conf is ccConfigType.value;
begin
conf.WITH_STRI_CAPACITY := boolean(configValue("WITH_STRI_CAPACITY"));
conf.WITH_RTL_ARRAY_CAPACITY := boolean(configValue("WITH_RTL_ARRAY_CAPACITY"));
conf.ALLOW_STRITYPE_SLICES := boolean(configValue("ALLOW_STRITYPE_SLICES"));
conf.ALLOW_BSTRITYPE_SLICES := boolean(configValue("ALLOW_BSTRITYPE_SLICES"));
conf.RSHIFT_DOES_SIGN_EXTEND := boolean(configValue("RSHIFT_DOES_SIGN_EXTEND"));
conf.TWOS_COMPLEMENT_INTTYPE := boolean(configValue("TWOS_COMPLEMENT_INTTYPE"));
conf.LITTLE_ENDIAN_INTTYPE := boolean(configValue("LITTLE_ENDIAN_INTTYPE"));
conf.FLOAT_COMPARISON_OKAY := boolean(configValue("FLOAT_COMPARISON_OKAY"));
conf.POW_FUNCTION_OKAY := boolean(configValue("POW_FUNCTION_OKAY"));
conf.FMOD_FUNCTION_OKAY := boolean(configValue("FMOD_FUNCTION_OKAY"));
conf.SQRT_FUNCTION_OKAY := boolean(configValue("SQRT_FUNCTION_OKAY"));
conf.EXP_FUNCTION_OKAY := boolean(configValue("EXP_FUNCTION_OKAY"));
conf.LOG_FUNCTION_OKAY := boolean(configValue("LOG_FUNCTION_OKAY"));
conf.LOG10_FUNCTION_OKAY := boolean(configValue("LOG10_FUNCTION_OKAY"));
conf.LOG1P_FUNCTION_OKAY := boolean(configValue("LOG1P_FUNCTION_OKAY"));
conf.LOG2_FUNCTION_OKAY := boolean(configValue("LOG2_FUNCTION_OKAY"));
conf.LDEXP_FUNCTION_OKAY := boolean(configValue("LDEXP_FUNCTION_OKAY"));
conf.FREXP_FUNCTION_OKAY := boolean(configValue("FREXP_FUNCTION_OKAY"));
conf.HAS_SIGSETJMP := boolean(configValue("HAS_SIGSETJMP"));
conf.CHECK_INT_DIV_BY_ZERO := boolean(configValue("CHECK_INT_DIV_BY_ZERO"));
conf.CHECK_INT_DIV_ZERO_BY_ZERO := boolean(configValue("CHECK_INT_DIV_ZERO_BY_ZERO"));
conf.CHECK_INT_REM_BY_ZERO := boolean(configValue("CHECK_INT_REM_BY_ZERO"));
conf.CHECK_INT_REM_ZERO_BY_ZERO := boolean(configValue("CHECK_INT_REM_ZERO_BY_ZERO"));
conf.FLOAT_ZERO_DIV_ERROR := boolean(configValue("FLOAT_ZERO_DIV_ERROR"));
conf.CHECK_FLOAT_DIV_BY_ZERO := boolean(configValue("CHECK_FLOAT_DIV_BY_ZERO"));
conf.HAS_EXP2 := boolean(configValue("HAS_EXP2"));
conf.HAS_EXP10 := boolean(configValue("HAS_EXP10"));
conf.HAS_EXPM1 := boolean(configValue("HAS_EXPM1"));
conf.HAS_CBRT := boolean(configValue("HAS_CBRT"));
conf.LIMITED_CSTRI_LITERAL_LEN := boolean(configValue("LIMITED_CSTRI_LITERAL_LEN"));
conf.SWITCH_WORKS_FOR_INT64TYPE := boolean(configValue("SWITCH_WORKS_FOR_INT64TYPE"));
conf.STMT_BLOCK_IN_PARENTHESES_OK := boolean(configValue("STMT_BLOCK_IN_PARENTHESES_OK"));
conf.CC_SOURCE_UTF8 := boolean(configValue("CC_SOURCE_UTF8"));
conf.USE_WMAIN := boolean(configValue("USE_WMAIN"));
conf.USE_WINMAIN := boolean(configValue("USE_WINMAIN"));
conf.USE_START_MAIN := boolean(configValue("USE_START_MAIN"));
conf.USE_DO_EXIT := boolean(configValue("USE_DO_EXIT"));
conf.FLOATTYPE_DOUBLE := boolean(configValue("FLOATTYPE_DOUBLE"));
conf.INTTYPE_SIZE := integer(configValue("INTTYPE_SIZE"));
conf.FLOATTYPE_SIZE := integer(configValue("FLOATTYPE_SIZE"));
conf.POINTER_SIZE := integer(configValue("POINTER_SIZE"));
conf.GENERIC_SIZE := max({conf.INTTYPE_SIZE, conf.FLOATTYPE_SIZE, conf.POINTER_SIZE});
conf.INT_SIZE := integer(configValue("INT_SIZE"));
conf.LONG_SIZE := integer(configValue("LONG_SIZE"));
conf.FLOATTYPE_MANTISSA_BITS := integer(configValue("FLOATTYPE_MANTISSA_BITS"));
conf.FLOATTYPE_EXPONENT_OFFSET := integer(configValue("FLOATTYPE_EXPONENT_OFFSET"));
conf.INT_RANGE_IN_FLOATTYPE_MAX := integer(configValue("INT_RANGE_IN_FLOATTYPE_MAX"));
conf.MINIMUM_TRUNC_ARGUMENT := integer(configValue("MINIMUM_TRUNC_ARGUMENT"));
conf.MAXIMUM_TRUNC_ARGUMENT := integer(configValue("MAXIMUM_TRUNC_ARGUMENT"));
conf.PIXEL_ALPHA_MASK := integer(configValue("PIXEL_ALPHA_MASK"), 16);
conf.PIXEL_RED_MASK := integer(configValue("PIXEL_RED_MASK"), 16);
conf.PIXEL_GREEN_MASK := integer(configValue("PIXEL_GREEN_MASK"), 16);
conf.PIXEL_BLUE_MASK := integer(configValue("PIXEL_BLUE_MASK"), 16);
conf.RGB_TO_PIXEL_FLAG_NAME := configValue("RGB_TO_PIXEL_FLAG_NAME");
conf.POINT_LIST_INT_SIZE := integer(configValue("POINT_LIST_INT_SIZE"));
conf.POINT_LIST_ABSOLUTE := boolean(configValue("POINT_LIST_ABSOLUTE"));
conf.RAND_MULTIPLIER := integer(configValue("RAND_MULTIPLIER"));
conf.RAND_INCREMENT := integer(configValue("RAND_INCREMENT"));
conf.BOOLTYPE := configValue("BOOLTYPE");
conf.INT32TYPE := configValue("INT32TYPE");
conf.UINT32TYPE := configValue("UINT32TYPE");
conf.INT64TYPE := configValue("INT64TYPE");
conf.UINT64TYPE := configValue("UINT64TYPE");
conf.INT128TYPE := configValue("INT128TYPE");
conf.UINT128TYPE := configValue("UINT128TYPE");
conf.INT32TYPE_LITERAL_SUFFIX := configValue("INT32TYPE_LITERAL_SUFFIX");
conf.INT64TYPE_LITERAL_SUFFIX := configValue("INT64TYPE_LITERAL_SUFFIX");
conf.MACRO_DEFS := configValue("MACRO_DEFS");
conf.OVERFLOW_SIGNAL := configValue("OVERFLOW_SIGNAL");
conf.BUILTIN_ADD_OVERFLOW := configValue("BUILTIN_ADD_OVERFLOW");
conf.BUILTIN_SUB_OVERFLOW := configValue("BUILTIN_SUB_OVERFLOW");
conf.BUILTIN_MULT_OVERFLOW := configValue("BUILTIN_MULT_OVERFLOW");
conf.INT_DIV_OVERFLOW := integer(configValue("INT_DIV_OVERFLOW"));
conf.INT_REM_OVERFLOW := integer(configValue("INT_REM_OVERFLOW"));
conf.OBJECT_FILE_EXTENSION := configValue("OBJECT_FILE_EXTENSION");
conf.LIBRARY_FILE_EXTENSION := configValue("LIBRARY_FILE_EXTENSION");
conf.EXECUTABLE_FILE_EXTENSION := configValue("EXECUTABLE_FILE_EXTENSION");
conf.LINKED_PROGRAM_EXTENSION := configValue("LINKED_PROGRAM_EXTENSION");
conf.CC_ENVIRONMENT_INI := configValue("CC_ENVIRONMENT_INI");
conf.C_COMPILER := configValue("C_COMPILER");
conf.CPLUSPLUS_COMPILER := configValue("CPLUSPLUS_COMPILER");
conf.CALL_C_COMPILER_FROM_SHELL := boolean(configValue("CALL_C_COMPILER_FROM_SHELL"));
conf.C_COMPILER_VERSION := configValue("C_COMPILER_VERSION");
conf.CC_OPT_DEBUG_INFO := noEmptyStrings(split(configValue("CC_OPT_DEBUG_INFO"), ' '));
conf.CC_OPT_LINK_TIME_OPTIMIZATION := configValue("CC_OPT_LINK_TIME_OPTIMIZATION");
conf.CC_OPT_NO_WARNINGS := configValue("CC_OPT_NO_WARNINGS");
conf.CC_OPT_OPTIMIZE_1 := noEmptyStrings(split(configValue("CC_OPT_OPTIMIZE_1"), ' '));
conf.CC_OPT_OPTIMIZE_2 := noEmptyStrings(split(configValue("CC_OPT_OPTIMIZE_2"), ' '));
conf.CC_OPT_OPTIMIZE_3 := noEmptyStrings(split(configValue("CC_OPT_OPTIMIZE_3"), ' '));
conf.CC_OPT_TRAP_OVERFLOW := configValue("CC_OPT_TRAP_OVERFLOW");
conf.CC_OPT_VERSION_INFO := configValue("CC_OPT_VERSION_INFO");
conf.CC_FLAGS := noEmptyStrings(split(configValue("CC_FLAGS"), ' '));
conf.CC_ERROR_FILEDES := integer(configValue("CC_ERROR_FILEDES"));
conf.CC_VERSION_INFO_FILEDES := integer(configValue("CC_VERSION_INFO_FILEDES"));
conf.LINKER_OPT_DEBUG_INFO := configValue("LINKER_OPT_DEBUG_INFO");
conf.LINKER_OPT_LTO_MANDATORY := boolean(configValue("LINKER_OPT_LTO_MANDATORY"));
conf.LINKER_OPT_NO_DEBUG_INFO := configValue("LINKER_OPT_NO_DEBUG_INFO");
conf.LINKER_OPT_OUTPUT_FILE := configValue("LINKER_OPT_OUTPUT_FILE");
conf.LINKER_OPT_SPECIAL_LIB := configValue("LINKER_OPT_SPECIAL_LIB");
conf.LINKER_OPT_STACK_SIZE := configValue("LINKER_OPT_STACK_SIZE");
conf.LINKER_FLAGS := noEmptyStrings(split(configValue("LINKER_FLAGS"), ' '));
conf.DEFAULT_STACK_SIZE := integer(configValue("DEFAULT_STACK_SIZE"));
conf.SYSTEM_LIBS := noEmptyStrings(split(configValue("SYSTEM_LIBS"), ' '));
conf.SYSTEM_BIGINT_LIBS := noEmptyStrings(split(configValue("SYSTEM_BIGINT_LIBS"), '\n'));
conf.SYSTEM_CONSOLE_LIBS := noEmptyStrings(split(configValue("SYSTEM_CONSOLE_LIBS"), '\n'));
conf.SYSTEM_DATABASE_LIBS := noEmptyStrings(split(configValue("SYSTEM_DATABASE_LIBS"), '\n'));
conf.SYSTEM_DRAW_LIBS := noEmptyStrings(split(configValue("SYSTEM_DRAW_LIBS"), '\n'));
conf.SYSTEM_MATH_LIBS := noEmptyStrings(split(configValue("SYSTEM_MATH_LIBS"), ' '));
conf.SEED7_LIB := configValue("SEED7_LIB");
conf.DRAW_LIB := configValue("DRAW_LIB");
conf.CONSOLE_LIB := configValue("CONSOLE_LIB");
conf.DATABASE_LIB := configValue("DATABASE_LIB");
conf.COMP_DATA_LIB := configValue("COMP_DATA_LIB");
conf.COMPILER_LIB := configValue("COMPILER_LIB");
conf.SPECIAL_LIB := configValue("SPECIAL_LIB");
conf.S7_LIB_DIR := configValue("S7_LIB_DIR");
conf.VERSION_REVISION_LEVEL := integer(configValue("VERSION_REVISION_LEVEL"));
conf.REDIRECT_FILEDES_1 := configValue("REDIRECT_FILEDES_1");
conf.REDIRECT_FILEDES_2 := configValue("REDIRECT_FILEDES_2");
conf.NULL_DEVICE := configValue("NULL_DEVICE");
if conf.INTTYPE_SIZE = 32 then
conf.INTTYPE_LITERAL_SUFFIX := conf.INT32TYPE_LITERAL_SUFFIX;
else
conf.INTTYPE_LITERAL_SUFFIX := conf.INT64TYPE_LITERAL_SUFFIX;
end if;
if conf.INT_SIZE = 16 then
if conf.TWOS_COMPLEMENT_INTTYPE then
conf.INT_MIN := -32768;
else
conf.INT_MIN := -32767;
end if;
conf.INT_MAX := 32767;
elsif conf.INT_SIZE = 32 then
if conf.TWOS_COMPLEMENT_INTTYPE then
conf.INT_MIN := -2147483648;
else
conf.INT_MIN := -2147483647;
end if;
conf.INT_MAX := 2147483647;
elsif conf.INT_SIZE = 64 then
if conf.TWOS_COMPLEMENT_INTTYPE then
conf.INT_MIN := -9223372036854775807 - 1;
else
conf.INT_MIN := -9223372036854775807;
end if;
conf.INT_MAX := 9223372036854775807;
end if;
end func;
var ccConfigType: ccConf is getBuiltInConfig;
const proc: assignConfigValue (inout ccConfigType: conf, in string: name, in string: value) is func
begin
case name of
when {"WITH_STRI_CAPACITY"}: conf.WITH_STRI_CAPACITY := boolean(value);
when {"WITH_RTL_ARRAY_CAPACITY"}: conf.WITH_RTL_ARRAY_CAPACITY := boolean(value);
when {"ALLOW_STRITYPE_SLICES"}: conf.ALLOW_STRITYPE_SLICES := boolean(value);
when {"ALLOW_BSTRITYPE_SLICES"}: conf.ALLOW_BSTRITYPE_SLICES := boolean(value);
when {"RSHIFT_DOES_SIGN_EXTEND"}: conf.RSHIFT_DOES_SIGN_EXTEND := boolean(value);
when {"TWOS_COMPLEMENT_INTTYPE"}: conf.TWOS_COMPLEMENT_INTTYPE := boolean(value);
when {"LITTLE_ENDIAN_INTTYPE"}: conf.LITTLE_ENDIAN_INTTYPE := boolean(value);
when {"FLOAT_COMPARISON_OKAY"}: conf.FLOAT_COMPARISON_OKAY := boolean(value);
when {"POW_FUNCTION_OKAY"}: conf.POW_FUNCTION_OKAY := boolean(value);
when {"FMOD_FUNCTION_OKAY"}: conf.FMOD_FUNCTION_OKAY := boolean(value);
when {"SQRT_FUNCTION_OKAY"}: conf.SQRT_FUNCTION_OKAY := boolean(value);
when {"EXP_FUNCTION_OKAY"}: conf.EXP_FUNCTION_OKAY := boolean(value);
when {"LOG_FUNCTION_OKAY"}: conf.LOG_FUNCTION_OKAY := boolean(value);
when {"LOG10_FUNCTION_OKAY"}: conf.LOG10_FUNCTION_OKAY := boolean(value);
when {"LOG1P_FUNCTION_OKAY"}: conf.LOG1P_FUNCTION_OKAY := boolean(value);
when {"LOG2_FUNCTION_OKAY"}: conf.LOG2_FUNCTION_OKAY := boolean(value);
when {"LDEXP_FUNCTION_OKAY"}: conf.LDEXP_FUNCTION_OKAY := boolean(value);
when {"FREXP_FUNCTION_OKAY"}: conf.FREXP_FUNCTION_OKAY := boolean(value);
when {"HAS_SIGSETJMP"}: conf.HAS_SIGSETJMP := boolean(value);
when {"CHECK_INT_DIV_BY_ZERO"}: conf.CHECK_INT_DIV_BY_ZERO := boolean(value);
when {"CHECK_INT_DIV_ZERO_BY_ZERO"}: conf.CHECK_INT_DIV_ZERO_BY_ZERO := boolean(value);
when {"CHECK_INT_REM_BY_ZERO"}: conf.CHECK_INT_REM_BY_ZERO := boolean(value);
when {"CHECK_INT_REM_ZERO_BY_ZERO"}: conf.CHECK_INT_REM_ZERO_BY_ZERO := boolean(value);
when {"FLOAT_ZERO_DIV_ERROR"}: conf.FLOAT_ZERO_DIV_ERROR := boolean(value);
when {"CHECK_FLOAT_DIV_BY_ZERO"}: conf.CHECK_FLOAT_DIV_BY_ZERO := boolean(value);
when {"HAS_EXP2"}: conf.HAS_EXP2 := boolean(value);
when {"HAS_EXP10"}: conf.HAS_EXP10 := boolean(value);
when {"HAS_EXPM1"}: conf.HAS_EXPM1 := boolean(value);
when {"HAS_CBRT"}: conf.HAS_CBRT := boolean(value);
when {"LIMITED_CSTRI_LITERAL_LEN"}: conf.LIMITED_CSTRI_LITERAL_LEN := boolean(value);
when {"SWITCH_WORKS_FOR_INT64TYPE"}: conf.SWITCH_WORKS_FOR_INT64TYPE := boolean(value);
when {"STMT_BLOCK_IN_PARENTHESES_OK"}: conf.STMT_BLOCK_IN_PARENTHESES_OK := boolean(value);
when {"CC_SOURCE_UTF8"}: conf.CC_SOURCE_UTF8 := boolean(value);
when {"USE_WMAIN"}: conf.USE_WMAIN := boolean(value);
when {"USE_WINMAIN"}: conf.USE_WINMAIN := boolean(value);
when {"USE_START_MAIN"}: conf.USE_START_MAIN := boolean(value);
when {"USE_DO_EXIT"}: conf.USE_DO_EXIT := boolean(value);
when {"FLOATTYPE_DOUBLE"}: conf.FLOATTYPE_DOUBLE := boolean(value);
when {"INTTYPE_SIZE"}: conf.INTTYPE_SIZE := integer(value);
when {"FLOATTYPE_SIZE"}: conf.FLOATTYPE_SIZE := integer(value);
when {"POINTER_SIZE"}: conf.POINTER_SIZE := integer(value);
when {"GENERIC_SIZE"}: conf.GENERIC_SIZE := integer(value);
when {"INT_SIZE"}: conf.INT_SIZE := integer(value);
when {"LONG_SIZE"}: conf.LONG_SIZE := integer(value);
when {"FLOATTYPE_MANTISSA_BITS"}: conf.FLOATTYPE_MANTISSA_BITS := integer(value);
when {"FLOATTYPE_EXPONENT_OFFSET"}: conf.FLOATTYPE_EXPONENT_OFFSET := integer(value);
when {"INT_RANGE_IN_FLOATTYPE_MAX"}: conf.INT_RANGE_IN_FLOATTYPE_MAX := integer(value);
when {"MINIMUM_TRUNC_ARGUMENT"}: conf.MINIMUM_TRUNC_ARGUMENT := integer(value);
when {"MAXIMUM_TRUNC_ARGUMENT"}: conf.MAXIMUM_TRUNC_ARGUMENT := integer(value);
when {"PIXEL_ALPHA_MASK"}: conf.PIXEL_ALPHA_MASK := integer(value, 16);
when {"PIXEL_RED_MASK"}: conf.PIXEL_RED_MASK := integer(value, 16);
when {"PIXEL_GREEN_MASK"}: conf.PIXEL_GREEN_MASK := integer(value, 16);
when {"PIXEL_BLUE_MASK"}: conf.PIXEL_BLUE_MASK := integer(value, 16);
when {"RGB_TO_PIXEL_FLAG_NAME"}: conf.RGB_TO_PIXEL_FLAG_NAME := value;
when {"POINT_LIST_INT_SIZE"}: conf.POINT_LIST_INT_SIZE := integer(value);
when {"POINT_LIST_ABSOLUTE"}: conf.POINT_LIST_ABSOLUTE := boolean(value);
when {"RAND_MULTIPLIER"}: conf.RAND_MULTIPLIER := integer(value);
when {"RAND_INCREMENT"}: conf.RAND_INCREMENT := integer(value);
when {"BOOLTYPE"}: conf.BOOLTYPE := value;
when {"INT32TYPE"}: conf.INT32TYPE := value;
when {"UINT32TYPE"}: conf.UINT32TYPE := value;
when {"INT64TYPE"}: conf.INT64TYPE := value;
when {"UINT64TYPE"}: conf.UINT64TYPE := value;
when {"INT128TYPE"}: conf.INT128TYPE := value;
when {"UINT128TYPE"}: conf.UINT128TYPE := value;
when {"INT32TYPE_LITERAL_SUFFIX"}: conf.INT32TYPE_LITERAL_SUFFIX := value;
when {"INT64TYPE_LITERAL_SUFFIX"}: conf.INT64TYPE_LITERAL_SUFFIX := value;
when {"MACRO_DEFS"}: conf.MACRO_DEFS := value;
when {"OVERFLOW_SIGNAL"}: conf.OVERFLOW_SIGNAL := value;
when {"BUILTIN_ADD_OVERFLOW"}: conf.BUILTIN_ADD_OVERFLOW := value;
when {"BUILTIN_SUB_OVERFLOW"}: conf.BUILTIN_SUB_OVERFLOW := value;
when {"BUILTIN_MULT_OVERFLOW"}: conf.BUILTIN_MULT_OVERFLOW := value;
when {"INT_DIV_OVERFLOW"}: conf.INT_DIV_OVERFLOW := integer(value);
when {"INT_REM_OVERFLOW"}: conf.INT_REM_OVERFLOW := integer(value);
when {"OBJECT_FILE_EXTENSION"}: conf.OBJECT_FILE_EXTENSION := value;
when {"LIBRARY_FILE_EXTENSION"}: conf.LIBRARY_FILE_EXTENSION := value;
when {"EXECUTABLE_FILE_EXTENSION"}: conf.EXECUTABLE_FILE_EXTENSION := value;
when {"LINKED_PROGRAM_EXTENSION"}: conf.LINKED_PROGRAM_EXTENSION := value;
when {"CC_ENVIRONMENT_INI"}: conf.CC_ENVIRONMENT_INI := value;
when {"C_COMPILER"}: conf.C_COMPILER := value;
when {"CPLUSPLUS_COMPILER"}: conf.CPLUSPLUS_COMPILER := value;
when {"CALL_C_COMPILER_FROM_SHELL"}: conf.CALL_C_COMPILER_FROM_SHELL := boolean(value);
when {"C_COMPILER_VERSION"}: conf.C_COMPILER_VERSION := value;
when {"CC_OPT_DEBUG_INFO"}: conf.CC_OPT_DEBUG_INFO := noEmptyStrings(split(value, ' '));
when {"CC_OPT_LINK_TIME_OPTIMIZATION"}: conf.CC_OPT_LINK_TIME_OPTIMIZATION := value;
when {"CC_OPT_NO_WARNINGS"}: conf.CC_OPT_NO_WARNINGS := value;
when {"CC_OPT_OPTIMIZE_1"}: conf.CC_OPT_OPTIMIZE_1 := noEmptyStrings(split(value, ' '));
when {"CC_OPT_OPTIMIZE_2"}: conf.CC_OPT_OPTIMIZE_2 := noEmptyStrings(split(value, ' '));
when {"CC_OPT_OPTIMIZE_3"}: conf.CC_OPT_OPTIMIZE_3 := noEmptyStrings(split(value, ' '));
when {"CC_OPT_TRAP_OVERFLOW"}: conf.CC_OPT_TRAP_OVERFLOW := value;
when {"CC_OPT_VERSION_INFO"}: conf.CC_OPT_VERSION_INFO := value;
when {"CC_FLAGS"}: conf.CC_FLAGS := noEmptyStrings(split(value, ' '));
when {"CC_ERROR_FILEDES"}: conf.CC_ERROR_FILEDES := integer(value);
when {"CC_VERSION_INFO_FILEDES"}: conf.CC_VERSION_INFO_FILEDES := integer(value);
when {"LINKER_OPT_DEBUG_INFO"}: conf.LINKER_OPT_DEBUG_INFO := value;
when {"LINKER_OPT_LTO_MANDATORY"}: conf.LINKER_OPT_LTO_MANDATORY := boolean(value);
when {"LINKER_OPT_NO_DEBUG_INFO"}: conf.LINKER_OPT_NO_DEBUG_INFO := value;
when {"LINKER_OPT_OUTPUT_FILE"}: conf.LINKER_OPT_OUTPUT_FILE := value;
when {"LINKER_OPT_SPECIAL_LIB"}: conf.LINKER_OPT_SPECIAL_LIB := value;
when {"LINKER_OPT_STACK_SIZE"}: conf.LINKER_OPT_STACK_SIZE := value;
when {"LINKER_FLAGS"}: conf.LINKER_FLAGS := noEmptyStrings(split(value, ' '));
when {"DEFAULT_STACK_SIZE"}: conf.DEFAULT_STACK_SIZE := integer(value);
when {"SYSTEM_LIBS"}: conf.SYSTEM_LIBS := noEmptyStrings(split(value, ' '));
when {"SYSTEM_BIGINT_LIBS"}: conf.SYSTEM_BIGINT_LIBS := noEmptyStrings(split(value, '\n'));
when {"SYSTEM_CONSOLE_LIBS"}: conf.SYSTEM_CONSOLE_LIBS := noEmptyStrings(split(value, '\n'));
when {"SYSTEM_DATABASE_LIBS"}: conf.SYSTEM_DATABASE_LIBS := noEmptyStrings(split(value, '\n'));
when {"SYSTEM_DRAW_LIBS"}: conf.SYSTEM_DRAW_LIBS := noEmptyStrings(split(value, '\n'));
when {"SYSTEM_MATH_LIBS"}: conf.SYSTEM_MATH_LIBS := noEmptyStrings(split(value, ' '));
when {"SEED7_LIB"}: conf.SEED7_LIB := value;
when {"DRAW_LIB"}: conf.DRAW_LIB := value;
when {"CONSOLE_LIB"}: conf.CONSOLE_LIB := value;
when {"DATABASE_LIB"}: conf.DATABASE_LIB := value;
when {"COMP_DATA_LIB"}: conf.COMP_DATA_LIB := value;
when {"COMPILER_LIB"}: conf.COMPILER_LIB := value;
when {"SPECIAL_LIB"}: conf.SPECIAL_LIB := value;
when {"S7_LIB_DIR"}: conf.S7_LIB_DIR := value;
when {"VERSION_REVISION_LEVEL"}: conf.VERSION_REVISION_LEVEL := integer(value);
when {"REDIRECT_FILEDES_1"}: conf.REDIRECT_FILEDES_1 := value;
when {"REDIRECT_FILEDES_2"}: conf.REDIRECT_FILEDES_2 := value;
when {"NULL_DEVICE"}: conf.NULL_DEVICE := value;
when {"INTTYPE_LITERAL_SUFFIX"}: conf.INTTYPE_LITERAL_SUFFIX := value;
when {"INT_MIN"}: conf.INT_MIN := integer(value);
when {"INT_MAX"}: conf.INT_MAX := integer(value);
otherwise:
raise RANGE_ERROR;
end case
end func;
const func ccConfigType: readConfig (in string: configFileName) is func
result
var ccConfigType: conf is ccConfigType.value;
local
var propertyDataType: propertyData is propertyDataType.value;
var string: name is "";
var string: value is "";
begin
propertyData := readPropertyFile(configFileName);
for value key name range propertyData do
assignConfigValue(conf, name, value);
end for;
end func;
const func string: determineCCVersion is func
result
var string: c_compiler_version is "";
local
var array string: redirection is 0 times "";
var string: ccVersionFile is "cc_version";
var file: aFile is STD_NULL;
begin
ccVersionFile &:= "_" <& rand(0, 999999990) lpad0 9;
case ccConf.CC_VERSION_INFO_FILEDES of
when {1}:
redirection &:= ccConf.REDIRECT_FILEDES_1 & ccVersionFile;
redirection &:= ccConf.REDIRECT_FILEDES_2 & ccConf.NULL_DEVICE;
when {2}:
redirection &:= ccConf.REDIRECT_FILEDES_1 & ccConf.NULL_DEVICE;
redirection &:= ccConf.REDIRECT_FILEDES_2 & ccVersionFile;
end case;
shellCmd(ccConf.C_COMPILER, ccConf.CC_OPT_VERSION_INFO <&
" " <& join(redirection, " "));
aFile := open(ccVersionFile, "r");
if aFile <> STD_NULL then
c_compiler_version := getln(aFile);
close(aFile);
end if;
if fileType(ccVersionFile) = FILE_REGULAR then
removeFile(ccVersionFile);
end if;
end func;
const func boolean: ccVersionIsOkay is
return determineCCVersion = ccConf.C_COMPILER_VERSION;