From 753d6ec5bf3456400726c1e8640bf770631b5817 Mon Sep 17 00:00:00 2001 From: nishi Date: Sat, 18 May 2024 12:58:28 +0000 Subject: [PATCH] will add windows support later git-svn-id: file:///raid/svn-main/nishi-dataworks/trunk@34 d4a5a174-5a4a-5b4b-b672-37683c10d7d5 --- Library/dw_util.h | 3 +++ Library/util.c | 23 +++++++++++++++++++++++ common.mk | 4 +++- 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/Library/dw_util.h b/Library/dw_util.h index b95fcd4..1c5c178 100644 --- a/Library/dw_util.h +++ b/Library/dw_util.h @@ -41,10 +41,13 @@ extern "C" { #endif #include +#include #include "dataworks.h" bool __dw_strcaseequ(const char* a, const char* b); +bool __dw_lockfile(FILE* fp); +bool __dw_unlockfile(FILE* fp); #define __dw_xstr(x) #x #define __dw_str(x) __dw_xstr(x) diff --git a/Library/util.c b/Library/util.c index dddb91c..9edf282 100644 --- a/Library/util.c +++ b/Library/util.c @@ -31,6 +31,11 @@ #include #include #include +#ifdef __MINGW32__ +#include +#else +#include +#endif bool __dw_strcaseequ(const char* a, const char* b) { if(strlen(a) != strlen(b)) return false; @@ -40,3 +45,21 @@ bool __dw_strcaseequ(const char* a, const char* b) { } return true; } + +bool __dw_lockfile(FILE* fp){ +#ifdef __MINGW32__ + OVERLAPPED overlap = {0}; + LockFileEx(fp, LOCKFILE_EXCLUSIVE_LOCK, 0, MAXDWORD, MAXDWORD, &overlap); +#else + lockf(fp, F_LOCK); +#endif + return false; +} + +bool __dw_unlockfile(FILE* fp){ +#ifdef __MINGW32__ +#else + lockf(fp, F_ULOCK); +#endif + return false; +} diff --git a/common.mk b/common.mk index 6a475a6..ef4cde3 100644 --- a/common.mk +++ b/common.mk @@ -36,15 +36,17 @@ clean: $(MAKE) -C ./Client clean $(COMPILE_FLAGS) $(MAKE) -C ./Document clean $(COMPILE_FLAGS) -archive-prepare: no-doc +archive-prepare: all rm -f *.zip *.tar.gz rm -rf dataworks-dist mkdir -p dataworks-dist mkdir -p dataworks-dist/Client mkdir -p dataworks-dist/Library + mkdir -p dataworks-dist/Document cp Library/*$(LIB_SUFFIX) dataworks-dist/Library/ cp Library/*.h dataworks-dist/Library/ cp Client/dataworks$(EXEC_SUFFIX) dataworks-dist/Client/ + cp -rf Document/doc/html dataworks-dist/Document/html archive-cleanup: rm -rf dataworks-dist -- 2.43.0