}
if(banner) {
printf("DataWorks version %s %s %s\n", dataworks_get_version(), dataworks_get_compile_date(), dataworks_get_platform());
- printf("Using Yacc: %s\n", dataworks_get_yacc_version());
- printf(" Lex: %s\n", dataworks_get_lex_version());
+ char* comp = dataworks_get_compiler();
+ printf(" Using Yacc: %s\n", dataworks_get_yacc_version());
+ printf(" Lex: %s\n", dataworks_get_lex_version());
+ printf("Compiled using: %s\n", comp);
+ free(comp);
if(dataworks_get_endian() == 'L') {
printf("This system is little-endian.\n");
} else {
#include <stdbool.h>
#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
const char* dataworks_version = "0.1.1";
const char* dataworks_compile_date = __DATE__;
int yywrap() { return 1; }
+char* dataworks_get_compiler(void) {
+ char* ver = malloc(513);
+ memset(ver, 0, 513);
+#if defined(__WATCOMC__)
+ sprintf(ver, "Open Watcom %d.%d", __WATCOMC__ / 100, __WATCOMC__ % 100);
+#elif defined(__clang__)
+ sprintf(ver, "%s", __VERSION__);
+#elif defined(__PCC__)
+ sprintf(ver, "%s", __VERSION__);
+#elif defined(__VBCC__)
+ sprintf(ver, "VBCC");
+#elif defined(__GNUC__)
+ sprintf(ver, "GCC %s", __VERSION__);
+#else
+ sprintf(ver, "Unsupported compiler");
+#endif
+ return ver;
+}
+
int yyerror(const char* err) {
fprintf(stderr, "Parser error: %s\n", err);
return 0;
*/
const char* dataworks_get_lex_version(void);
+/**
+ * @~english
+ * @brief Get the compiler which was used to compile DataWorks
+ * @return Compiler which was used to compile DataWorks
+ *
+ */
+char* dataworks_get_compiler(void);
+
/**
* @~english
* @brief Get the compilation date of DataWorks