all: dataworks$(EXEC_SUFFIX)
-dataworks$(EXEC_SUFFIX): $(OBJS)
- $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) ../Library/$(STATICLIB_PREFIX)dataworks$(STATICLIB_SUFFIX)
+dataworks$(EXEC_SUFFIX): $(OBJS) ../Library/*.o
+ $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) ../Library/*.o
.c.o:
$(CC) -I../Library $(CFLAGS) -c -o $@ $<
clean:
- rm -f *.o dataworks *.exe
+ rm -f *.o dataworks *.exe *.dos *.dos4g
all: $(LIB_PREFIX)dataworks$(LIB_SUFFIX) $(STATICLIB_PREFIX)dataworks$(STATICLIB_SUFFIX)
$(LIB_PREFIX)dataworks$(LIB_SUFFIX): $(OBJS)
- $(CC) -shared $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
+ $(SHCC) -shared $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
$(STATICLIB_PREFIX)dataworks$(STATICLIB_SUFFIX): $(OBJS)
$(AR) rcs $@ $(OBJS)
const char sig[3] = {0x7f, 'D', 'W'};
+#ifdef M_I86
+#define BUFSIZE 128
+#else
+#endif
+
int dataworks_database_create(const char* fname) {
FILE* f = fopen(fname, "wb");
if(f == NULL) {
return 1;
}
+#ifdef BUFSIZE
+ uint8_t nul[BUFSIZE];
+#else
uint8_t nul[4096];
+#endif
int i;
fwrite(sig, 1, 3, f);
nul[0] = 0;
fwrite(nul, 1, 2, f);
uint64_t t = time(NULL);
__dw_big_endian(t, uint64_t, fwrite(__converted_ptr, 1, 8, f));
- for(i = 0; i < 4096; i++) nul[i] = 0;
+ for(i = 0; i < 16; i++) nul[i] = 0;
for(i = 0; i < 256; i++) {
fwrite(nul, 1, 1, f);
fwrite(nul, 1, 8, f);
fwrite(nul, 1, 1, f);
+ int j;
+#ifdef BUFSIZE
+ for(j = 0; j < 256 / BUFSIZE; j++){
+ fwrite(nul, 1, BUFSIZE, f);
+ }
+ for(j = 0; j < 4096 / BUFSIZE; j++){
+ fwrite(nul, 1, BUFSIZE, f);
+ }
+#else
fwrite(nul, 1, 256, f);
fwrite(nul, 1, 4096, f);
+#endif
}
fclose(f);
return 0;
const char* dataworks_platform = "NetBSD/"
#elif defined(__linux__)
const char* dataworks_platform = "Linux/"
+#elif defined(__WATCOMC__)
+const char* dataworks_platform = "WatcomC/"
#else
const char* dataworks_platform = "Unknown/"
#endif
bool __dw_lockfile(FILE* fp) {
off_t off = ftell(fp);
fseek(fp, 0, SEEK_SET);
-#ifdef __MINGW32__
+#if defined(DOS)
+
+#elif defined(__MINGW32__)
OVERLAPPED overlap = {0};
LockFileEx(fp, LOCKFILE_EXCLUSIVE_LOCK, 0, MAXDWORD, MAXDWORD, &overlap);
#else
bool __dw_unlockfile(FILE* fp) {
off_t off = ftell(fp);
fseek(fp, 0, SEEK_SET);
-#ifdef __MINGW32__
+#if defined(DOS)
+
+#elif defined(__MINGW32__)
OVERLAPPED overlap = {0};
UnlockFileEx(fp, 0, MAXDWORD, MAXDWORD, &overlap);
#else
--- /dev/null
+CC = WATCOM=$$WATCOM INCLUDE=$$WATCOM/h PATH=$$PATH:$$WATCOM/binl64 owcc
+SHCC = /bin/true
+AR = /bin/true
+RANLIB = /bin/true
+LIB_PREFIX =
+LIB_SUFFIX = .dll
+EXEC_SUFFIX = .$(WATCOM_PLATFORM)
+STATICLIB_PREFIX =
+STATICLIB_SUFFIX = .a
+PLATFORM_M = $(WATCOM_PLATFORM)
+PLATFORM_P = $(WATCOM_PLATFORM)
+CFLAGS += -DDOS -b $(WATCOM_PLATFORM)
+LDFLAGS += -b $(WATCOM_PLATFORM)
+LINK_LIB = `find Library -name "*.o"`
CC = i686-w64-mingw32-gcc
+SHCC = i686-w64-mingw32-gcc
AR = i686-w64-mingw32-ar
RANLIB = i686-w64-mingw32-ranlib
LIB_PREFIX =
CC = x86_64-w64-mingw32-gcc
+SHCC = x86_64-w64-mingw32-gcc
AR = x86_64-w64-mingw32-ar
RANLIB = x86_64-w64-mingw32-ranlib
LIB_PREFIX =
# $Id$
CC = cc
+SHCC = cc
AR = ar
RANLIB = ranlib
CFLAGS = -std=c99 -D_DEFAULT_SOURCE
STATICLIB_SUFFIX = .a
EXEC_SUFFIX =
PLATFORM_M = `uname -m`
-PLATFORM_P = `uname -p`
+PLATFORM_P = `uname -p | sed -E "s/[ \\(\\)]/-/g"`
+LINK_LIB = ../Library/$(STATICLIB_PREFIX)dataworks$(STATICLIB_SUFFIX)
# $Id$
-COMPILE_FLAGS = CC="$(CC)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" LIBS="$(LIBS)" LIB_PREFIX="$(LIB_PREFIX)" LIB_SUFFIX="$(LIB_SUFFIX)" EXEC_SUFFIX="$(EXEC_SUFFIX)" PLATFORM_M="$(PLATFORM_M)" PLATFORM_P="$(PLATFORM_P)" STATICLIB_PREFIX="$(STATICLIB_PREFIX)" STATICLIB_SUFFIX="$(STATICLIB_SUFFIX)" AR="$(AR)" RANLIB="$(RANLIB)"
+COMPILE_FLAGS = CC="$(CC)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" LIBS="$(LIBS)" LIB_PREFIX="$(LIB_PREFIX)" LIB_SUFFIX="$(LIB_SUFFIX)" EXEC_SUFFIX="$(EXEC_SUFFIX)" PLATFORM_M="$(PLATFORM_M)" PLATFORM_P="$(PLATFORM_P)" STATICLIB_PREFIX="$(STATICLIB_PREFIX)" STATICLIB_SUFFIX="$(STATICLIB_SUFFIX)" AR="$(AR)" RANLIB="$(RANLIB)" SHCC="$(SHCC)" LINK_LIN="$(LINK_LIB)"
.PHONY: all no-doc replace format clean ./Library ./Client ./Document archive archive-prepare archive-cleanup archive-targz archive-zip