From 5304e657fdcb476350897f44d7f9ccfa9f556fdb Mon Sep 17 00:00:00 2001 From: Jiri Malak Date: Tue, 9 Jul 2024 18:45:59 +0200 Subject: [PATCH] time.t: resolve issue with internal and standard C time.h files and remove all hacks - fix issue by renaming header file and symbols which consolidate with standard C time.h - rename also date.h for consistency - remove all hacks from make files and from sys.c now can share new dtime.h with standard C time.h without any collision that any order of internal and standard C header path is possible --- filelist | 4 ++-- hdr/{date.h => ddate.h} | 2 +- hdr/dirmatch.h | 4 ++-- hdr/{time.h => dtime.h} | 2 +- hdr/fat.h | 4 ++-- hdr/fcb.h | 4 ++-- hdr/sft.h | 4 ++-- kernel/dosfns.c | 4 ++-- kernel/fatfs.c | 6 +++--- kernel/globals.h | 4 ++-- kernel/init-mod.h | 4 ++-- kernel/inthndlr.c | 4 ++-- kernel/makefile | 2 +- kernel/proto.h | 8 ++++---- kernel/systime.c | 4 ++-- mkfiles/gcc.mak | 2 +- mkfiles/owlinux.mak | 2 +- mkfiles/owwin.mak | 2 +- sys/sys.c | 4 ++-- 19 files changed, 35 insertions(+), 35 deletions(-) rename hdr/{date.h => ddate.h} (99%) rename hdr/{time.h => dtime.h} (99%) diff --git a/filelist b/filelist index 33bd657..e7c9a74 100644 --- a/filelist +++ b/filelist @@ -34,10 +34,11 @@ */*/hdr/buffer.h */*/hdr/cds.h */*/hdr/clock.h -*/*/hdr/date.h */*/hdr/dcb.h +*/*/hdr/ddate.h */*/hdr/device.h */*/hdr/dirmatch.h +*/*/hdr/dtime.h */*/hdr/error.h */*/hdr/exe.h */*/hdr/fat.h @@ -56,7 +57,6 @@ */*/hdr/sft.h */*/hdr/stacks.inc */*/hdr/tail.h -*/*/hdr/time.h */*/hdr/version.h */*/hdr/xstructs.h */*/kernel/nls/001-437.hc diff --git a/hdr/date.h b/hdr/ddate.h similarity index 99% rename from hdr/date.h rename to hdr/ddate.h index 5df3fae..12a8e61 100644 --- a/hdr/date.h +++ b/hdr/ddate.h @@ -51,7 +51,7 @@ static BYTE *date_hRcsId = #define EPOCH_DAY 1 /* 1 for January 1 */ #define EPOCH_YEAR 1980 /* for Tues 1-1-80 epoch */ -typedef UWORD date; +typedef UWORD ddate; #endif diff --git a/hdr/dirmatch.h b/hdr/dirmatch.h index f4a953f..e6da7ea 100644 --- a/hdr/dirmatch.h +++ b/hdr/dirmatch.h @@ -47,8 +47,8 @@ typedef struct { UWORD reserved2; UBYTE dm_attr_fnd; /* found file attribute */ - time dm_time; /* file time */ - date dm_date; /* file date */ + dtime dm_time; /* file time */ + ddate dm_date; /* file date */ ULONG dm_size; /* file size */ BYTE dm_name[FNAME_SIZE + FEXT_SIZE + 2]; /* file name */ } dmatch; diff --git a/hdr/time.h b/hdr/dtime.h similarity index 99% rename from hdr/time.h rename to hdr/dtime.h index e2aaf2e..ea1549e 100644 --- a/hdr/time.h +++ b/hdr/dtime.h @@ -39,7 +39,7 @@ static BYTE *time_hRcsId = #endif #endif -typedef UWORD time; +typedef UWORD dtime; struct dostime { diff --git a/hdr/fat.h b/hdr/fat.h index b55db0f..e2dd16d 100644 --- a/hdr/fat.h +++ b/hdr/fat.h @@ -105,8 +105,8 @@ struct dirent { UWORD dir_crdate; /* Creation date */ UWORD dir_accdate; /* Last access date */ UWORD dir_start_high; /* High word of the cluster */ - time dir_time; /* Time file created/updated */ - date dir_date; /* Date file created/updated */ + dtime dir_time; /* Time file created/updated */ + ddate dir_date; /* Date file created/updated */ UWORD dir_start; /* Starting cluster */ /* 1st available = 2 */ ULONG dir_size; /* File size in bytes */ diff --git a/hdr/fcb.h b/hdr/fcb.h index 6935666..be3d1b8 100644 --- a/hdr/fcb.h +++ b/hdr/fcb.h @@ -86,8 +86,8 @@ typedef struct { UWORD fcb_recsiz; /* Logical record size in bytes, */ /* default = 128 */ ULONG fcb_fsize; /* File size in bytes */ - date fcb_date; /* Date file created */ - time fcb_time; /* Time of last write */ + ddate fcb_date; /* Date file created */ + dtime fcb_time; /* Time of last write */ /* the following are reserved by system */ BYTE fcb_sftno; /* Device ID */ BYTE fcb_attrib_hi; /* share info, dev attrib word hi */ diff --git a/hdr/sft.h b/hdr/sft.h index 75e8e06..106b30e 100644 --- a/hdr/sft.h +++ b/hdr/sft.h @@ -61,8 +61,8 @@ typedef struct { #else CLUSTER sft_stclust; /* 0b - Starting cluster */ #endif - time sft_time; /* 0d - File time */ - date sft_date; /* 0f - File date */ + dtime sft_time; /* 0d - File time */ + ddate sft_date; /* 0f - File date */ ULONG sft_size; /* 11 - File size */ ULONG sft_posit; /* 15 - Current file position */ UWORD sft_relclust; /* 19 - File relative cluster (low part) */ diff --git a/kernel/dosfns.c b/kernel/dosfns.c index 7ecd121..3d902ee 100644 --- a/kernel/dosfns.c +++ b/kernel/dosfns.c @@ -1130,7 +1130,7 @@ COUNT DosFindNext(void) return pop_dmp(rc, dmp); } -COUNT DosGetFtime(COUNT hndl, date * dp, time * tp) +COUNT DosGetFtime(COUNT hndl, ddate * dp, dtime * tp) { sft FAR *s; /*sfttbl FAR *sp;*/ @@ -1144,7 +1144,7 @@ COUNT DosGetFtime(COUNT hndl, date * dp, time * tp) return SUCCESS; } -COUNT DosSetFtimeSft(int sft_idx, date dp, time tp) +COUNT DosSetFtimeSft(int sft_idx, ddate dp, dtime tp) { /* Get the SFT block that contains the SFT */ sft FAR *s = idx_to_sft(sft_idx); diff --git a/kernel/fatfs.c b/kernel/fatfs.c index 9b143b6..a3e53de 100644 --- a/kernel/fatfs.c +++ b/kernel/fatfs.c @@ -52,7 +52,7 @@ COUNT map_cluster(f_node_ptr, COUNT); STATIC int shrink_file(f_node_ptr fnp); /* FAT time notation in the form of hhhh hmmm mmmd dddd (d = double second) */ -STATIC time time_encode(struct dostime *t) +STATIC dtime time_encode(struct dostime *t) { return (t->hour << 11) | (t->minute << 5) | (t->second >> 1); } @@ -666,7 +666,7 @@ STATIC int alloc_find_free(f_node_ptr fnp, char *path) /* */ /* dos_getdate for the file date */ /* */ -date dos_getdate(void) +ddate dos_getdate(void) { struct dosdate dd; @@ -679,7 +679,7 @@ date dos_getdate(void) /* */ /* dos_gettime for the file time */ /* */ -time dos_gettime(void) +dtime dos_gettime(void) { struct dostime dt; diff --git a/kernel/globals.h b/kernel/globals.h index 5bf5037..f00649d 100644 --- a/kernel/globals.h +++ b/kernel/globals.h @@ -37,8 +37,8 @@ static BYTE *Globals_hRcsId = #include "device.h" #include "mcb.h" #include "pcb.h" -#include "date.h" -#include "time.h" +#include "ddate.h" +#include "dtime.h" #include "fat.h" #include "fcb.h" #include "tail.h" diff --git a/kernel/init-mod.h b/kernel/init-mod.h index 2cb6391..aa1902e 100644 --- a/kernel/init-mod.h +++ b/kernel/init-mod.h @@ -2,8 +2,8 @@ #define IN_INIT_MOD #include "version.h" -#include "date.h" -#include "time.h" +#include "ddate.h" +#include "dtime.h" #include "mcb.h" #include "sft.h" #include "fat.h" diff --git a/kernel/inthndlr.c b/kernel/inthndlr.c index e5efc99..5a8f7e9 100644 --- a/kernel/inthndlr.c +++ b/kernel/inthndlr.c @@ -1200,8 +1200,8 @@ dispatch: case 0x01: rc = DosSetFtime((COUNT) lr.BX, /* Handle */ - (date) lr.DX, /* FileDate */ - (time) lr.CX); /* FileTime */ + (ddate) lr.DX, /* FileDate */ + (dtime) lr.CX); /* FileTime */ break; default: diff --git a/kernel/makefile b/kernel/makefile index 4f5fe9e..84ea822 100644 --- a/kernel/makefile +++ b/kernel/makefile @@ -87,7 +87,7 @@ serial.obj: serial.asm io.inc $(TARGET).lnk HDRS=\ $(HDR)portab.h $(HDR)device.h $(HDR)mcb.h $(HDR)pcb.h \ - $(HDR)fat.h $(HDR)fcb.h $(HDR)tail.h $(HDR)time.h $(HDR)process.h \ + $(HDR)fat.h $(HDR)fcb.h $(HDR)tail.h $(HDR)dtime.h $(HDR)process.h \ $(HDR)dcb.h $(HDR)sft.h $(HDR)cds.h $(HDR)exe.h $(HDR)fnode.h \ $(HDR)dirmatch.h $(HDR)file.h $(HDR)clock.h $(HDR)kbd.h $(HDR)error.h \ $(HDR)version.h dyndata.h diff --git a/kernel/proto.h b/kernel/proto.h index 551d03b..7b511d9 100644 --- a/kernel/proto.h +++ b/kernel/proto.h @@ -102,8 +102,8 @@ COUNT DosGetCuDir(UBYTE drive, BYTE FAR * s); COUNT DosChangeDir(BYTE FAR * s); COUNT DosFindFirst(UCOUNT attr, BYTE FAR * name); COUNT DosFindNext(void); -COUNT DosGetFtime(COUNT hndl, date * dp, time * tp); -COUNT DosSetFtimeSft(int sft_idx, date dp, time tp); +COUNT DosGetFtime(COUNT hndl, ddate * dp, dtime * tp); +COUNT DosSetFtimeSft(int sft_idx, ddate dp, dtime tp); #define DosSetFtime(hndl, dp, tp) DosSetFtimeSft(get_sft_idx(hndl), (dp), (tp)) COUNT DosGetFattr(BYTE FAR * name); COUNT DosSetFattr(BYTE FAR * name, UWORD attrp); @@ -158,8 +158,8 @@ COUNT dos_close(COUNT fd); COUNT dos_delete(BYTE * path, int attrib); COUNT dos_rmdir(BYTE * path); COUNT dos_rename(BYTE * path1, BYTE * path2, int attrib); -date dos_getdate(void); -time dos_gettime(void); +ddate dos_getdate(void); +dtime dos_gettime(void); COUNT dos_mkdir(BYTE * dir); BOOL last_link(f_node_ptr fnp); COUNT map_cluster(REG f_node_ptr fnp, COUNT mode); diff --git a/kernel/systime.c b/kernel/systime.c index a8b98b9..3c8c035 100644 --- a/kernel/systime.c +++ b/kernel/systime.c @@ -27,8 +27,8 @@ /****************************************************************/ #include "portab.h" -#include "time.h" -#include "date.h" +#include "dtime.h" +#include "ddate.h" #include "globals.h" #ifdef VERSION_STRINGS diff --git a/mkfiles/gcc.mak b/mkfiles/gcc.mak index 2d64ae4..2f642c0 100644 --- a/mkfiles/gcc.mak +++ b/mkfiles/gcc.mak @@ -70,7 +70,7 @@ endif INITPATCH=ia16-elf-objcopy --redefine-sym ___umodsi3=_init_umodsi3 --redefine-sym ___udivsi3=_init_udivsi3 --redefine-sym ___ashlsi3=_init_ashlsi3 --redefine-sym ___lshrsi3=_init_lshrsi3 --redefine-sym _printf=_init_printf --redefine-sym _sprintf=_init_sprintf --redefine-sym _execrh=_init_execrh --redefine-sym _memcpy=_init_memcpy --redefine-sym _fmemcpy=_init_fmemcpy --redefine-sym _fmemset=_init_fmemset --redefine-sym _fmemcmp=_init_fmemcmp --redefine-sym _memcmp=_init_memcmp --redefine-sym _memset=_init_memset --redefine-sym _strchr=_init_strchr --redefine-sym _strcpy=_init_strcpy --redefine-sym _fstrcpy=_init_fstrcpy --redefine-sym _strlen=_init_strlen --redefine-sym _fstrlen=_init_fstrlen --redefine-sym _open=_init_DosOpen CLDEF=1 -CLT=gcc -Wall -DDOSC_TIME_H -I../hdr -o $@ +CLT=gcc -Wall -I../hdr -o $@ CLC=$(CLT) LINK=$(XLINK) -Tkernel.ld -nostdlib -Wl,-Map,kernel.map -o kernel.exe $(OBJS) -Wl,--whole-archive ../drivers/device.lib -Wl,--no-whole-archive \# diff --git a/mkfiles/owlinux.mak b/mkfiles/owlinux.mak index 149c881..cc3b941 100644 --- a/mkfiles/owlinux.mak +++ b/mkfiles/owlinux.mak @@ -12,7 +12,7 @@ CP=cp ECHOTO=echo>> INITPATCH=@echo > /dev/null CLDEF=1 -CLT=wcl386 -zq -bcl=linux -DDOSC_TIME_H -I../hdr -fe=$@ -I$(COMPILERPATH)/lh +CLT=wcl386 -zq -bcl=linux -I../hdr -fe=$@ -I$(COMPILERPATH)/lh CLC=$(CLT) CFLAGST=-fo=.obj $(CFLAGST) ALLCFLAGS=-fo=.obj $(ALLCFLAGS) diff --git a/mkfiles/owwin.mak b/mkfiles/owwin.mak index 7d8b81d..26fae5b 100644 --- a/mkfiles/owwin.mak +++ b/mkfiles/owwin.mak @@ -13,7 +13,7 @@ INCLUDEPATH=$(COMPILERPATH)\h #ECHOTO=echo>> #INITPATCH=@echo > nul CLDEF=1 -CLT=wcl386 -zq -bcl=nt -DDOSC_TIME_H -I..\hdr -fe=$@ -I$(COMPILERPATH)\h -I$(COMPILERPATH)\h\nt +CLT=wcl386 -zq -bcl=nt -I..\hdr -fe=$@ -I$(COMPILERPATH)\h -I$(COMPILERPATH)\h\nt CLC=$(CLT) CFLAGST=-fo=.obj $(CFLAGST) ALLCFLAGS=-fo=.obj $(ALLCFLAGS) diff --git a/sys/sys.c b/sys/sys.c index 78d2fbf..23ec133 100644 --- a/sys/sys.c +++ b/sys/sys.c @@ -58,8 +58,8 @@ #include "device.h" #include "dcb.h" #include "xstructs.h" -#include "date.h" -#include "../hdr/time.h" +#include "ddate.h" +#include "dtime.h" #include "fat.h" /* These definitions deliberately put here instead of