From 27268627f5df5ad75243da072e60217182d7c629 Mon Sep 17 00:00:00 2001 From: nishi Date: Mon, 3 Jun 2024 15:19:20 +0000 Subject: [PATCH] add a function to get lex ver git-svn-id: file:///raid/svn-main/nishi-dataworks/trunk@138 d4a5a174-5a4a-5b4b-b672-37683c10d7d5 --- Client/main.c | 1 + Grammar/dw.l | 10 ++++++++++ Grammar/dw.y | 2 ++ Library/dataworks.c | 2 ++ Library/dataworks.h | 8 ++++++++ common.mk | 1 + 6 files changed, 24 insertions(+) diff --git a/Client/main.c b/Client/main.c index 17f5967..7d73307 100644 --- a/Client/main.c +++ b/Client/main.c @@ -125,6 +125,7 @@ int main(int argc, char** argv) { 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()); if(dataworks_get_endian() == 'L') { printf("This system is little-endian.\n"); } else { diff --git a/Grammar/dw.l b/Grammar/dw.l index 8f369e2..99c5217 100644 --- a/Grammar/dw.l +++ b/Grammar/dw.l @@ -55,3 +55,13 @@ extern YYSTYPE yylval; [ \t\v]* { return (SPACE); } + +%% + +#if defined(FLEX_SCANNER) +#define XSTR(x) #x +#define STR(x) XSTR(x) +const char* lexver = "Flex " STR(YY_FLEX_MAJOR_VERSION) "." STR(YY_FLEX_MINOR_VERSION) "." STR(YY_FLEX_SUBMINOR_VERSION); +#else +const char* lexver = "Unknown"; +#endif diff --git a/Grammar/dw.y b/Grammar/dw.y index 6bf4052..fe279a9 100644 --- a/Grammar/dw.y +++ b/Grammar/dw.y @@ -76,4 +76,6 @@ const char* yaccver = "GNU Bison " YYBISON_VERSION; #define XSTR(x) #x #define STR(x) XSTR(x) const char* yaccver = "Berkeley Yacc " STR(YYMAJOR) "." STR(YYMINOR); +#else +const char* yaccver = "Unknown"; #endif diff --git a/Library/dataworks.c b/Library/dataworks.c index ef2afed..4058122 100644 --- a/Library/dataworks.c +++ b/Library/dataworks.c @@ -54,9 +54,11 @@ const char* dataworks_platform = "Unknown/" PLATFORM_M " (" PLATFORM_P ")"; extern const char* yaccver; +extern const char* lexver; const char* dataworks_get_version(void) { return dataworks_version; } const char* dataworks_get_yacc_version(void) { return yaccver; } +const char* dataworks_get_lex_version(void) { return lexver; } const char* dataworks_get_compile_date(void) { return dataworks_compile_date; } const char* dataworks_get_platform(void) { return dataworks_platform; } char dataworks_get_endian(void) { diff --git a/Library/dataworks.h b/Library/dataworks.h index f76073e..673e595 100644 --- a/Library/dataworks.h +++ b/Library/dataworks.h @@ -58,6 +58,14 @@ const char* dataworks_get_version(void); */ const char* dataworks_get_yacc_version(void); +/** + * @~english + * @brief Get the version of Lex used by DataWorks + * @return Lex version of DataWorks + * + */ +const char* dataworks_get_lex_version(void); + /** * @~english * @brief Get the compilation date of DataWorks diff --git a/common.mk b/common.mk index 2c27310..fd0c45c 100644 --- a/common.mk +++ b/common.mk @@ -81,6 +81,7 @@ prepare-dosbox: no-doc echo "c:" >> dosbox.conf echo "copy Client\*$(EXEC_SUFFIX) dw$(EXEC_SUFFIX)" >> dosbox.conf echo "dw /NC /f op.txt /create db.dwf" >> dosbox.conf + echo "dw /NC /f op.txt db.dwf" >> dosbox.conf echo "pause" >> dosbox.conf echo "del db.dwf" >> dosbox.conf echo "del dw.exe" >> dosbox.conf -- 2.43.0