Skip to content

Commit 5304e65

Browse files
jmalakPerditionC
authored andcommitted
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
1 parent 4ca2825 commit 5304e65

19 files changed

+35
-35
lines changed

filelist

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,11 @@
3434
*/*/hdr/buffer.h
3535
*/*/hdr/cds.h
3636
*/*/hdr/clock.h
37-
*/*/hdr/date.h
3837
*/*/hdr/dcb.h
38+
*/*/hdr/ddate.h
3939
*/*/hdr/device.h
4040
*/*/hdr/dirmatch.h
41+
*/*/hdr/dtime.h
4142
*/*/hdr/error.h
4243
*/*/hdr/exe.h
4344
*/*/hdr/fat.h
@@ -56,7 +57,6 @@
5657
*/*/hdr/sft.h
5758
*/*/hdr/stacks.inc
5859
*/*/hdr/tail.h
59-
*/*/hdr/time.h
6060
*/*/hdr/version.h
6161
*/*/hdr/xstructs.h
6262
*/*/kernel/nls/001-437.hc

hdr/date.h renamed to hdr/ddate.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ static BYTE *date_hRcsId =
5151
#define EPOCH_DAY 1 /* 1 for January 1 */
5252
#define EPOCH_YEAR 1980 /* for Tues 1-1-80 epoch */
5353

54-
typedef UWORD date;
54+
typedef UWORD ddate;
5555

5656
#endif
5757

hdr/dirmatch.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ typedef struct {
4747
UWORD reserved2;
4848

4949
UBYTE dm_attr_fnd; /* found file attribute */
50-
time dm_time; /* file time */
51-
date dm_date; /* file date */
50+
dtime dm_time; /* file time */
51+
ddate dm_date; /* file date */
5252
ULONG dm_size; /* file size */
5353
BYTE dm_name[FNAME_SIZE + FEXT_SIZE + 2]; /* file name */
5454
} dmatch;

hdr/time.h renamed to hdr/dtime.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ static BYTE *time_hRcsId =
3939
#endif
4040
#endif
4141

42-
typedef UWORD time;
42+
typedef UWORD dtime;
4343

4444
struct dostime
4545
{

hdr/fat.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ struct dirent {
105105
UWORD dir_crdate; /* Creation date */
106106
UWORD dir_accdate; /* Last access date */
107107
UWORD dir_start_high; /* High word of the cluster */
108-
time dir_time; /* Time file created/updated */
109-
date dir_date; /* Date file created/updated */
108+
dtime dir_time; /* Time file created/updated */
109+
ddate dir_date; /* Date file created/updated */
110110
UWORD dir_start; /* Starting cluster */
111111
/* 1st available = 2 */
112112
ULONG dir_size; /* File size in bytes */

hdr/fcb.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ typedef struct {
8686
UWORD fcb_recsiz; /* Logical record size in bytes, */
8787
/* default = 128 */
8888
ULONG fcb_fsize; /* File size in bytes */
89-
date fcb_date; /* Date file created */
90-
time fcb_time; /* Time of last write */
89+
ddate fcb_date; /* Date file created */
90+
dtime fcb_time; /* Time of last write */
9191
/* the following are reserved by system */
9292
BYTE fcb_sftno; /* Device ID */
9393
BYTE fcb_attrib_hi; /* share info, dev attrib word hi */

hdr/sft.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ typedef struct {
6161
#else
6262
CLUSTER sft_stclust; /* 0b - Starting cluster */
6363
#endif
64-
time sft_time; /* 0d - File time */
65-
date sft_date; /* 0f - File date */
64+
dtime sft_time; /* 0d - File time */
65+
ddate sft_date; /* 0f - File date */
6666
ULONG sft_size; /* 11 - File size */
6767
ULONG sft_posit; /* 15 - Current file position */
6868
UWORD sft_relclust; /* 19 - File relative cluster (low part) */

kernel/dosfns.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -1130,7 +1130,7 @@ COUNT DosFindNext(void)
11301130
return pop_dmp(rc, dmp);
11311131
}
11321132

1133-
COUNT DosGetFtime(COUNT hndl, date * dp, time * tp)
1133+
COUNT DosGetFtime(COUNT hndl, ddate * dp, dtime * tp)
11341134
{
11351135
sft FAR *s;
11361136
/*sfttbl FAR *sp;*/
@@ -1144,7 +1144,7 @@ COUNT DosGetFtime(COUNT hndl, date * dp, time * tp)
11441144
return SUCCESS;
11451145
}
11461146

1147-
COUNT DosSetFtimeSft(int sft_idx, date dp, time tp)
1147+
COUNT DosSetFtimeSft(int sft_idx, ddate dp, dtime tp)
11481148
{
11491149
/* Get the SFT block that contains the SFT */
11501150
sft FAR *s = idx_to_sft(sft_idx);

kernel/fatfs.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ COUNT map_cluster(f_node_ptr, COUNT);
5252
STATIC int shrink_file(f_node_ptr fnp);
5353

5454
/* FAT time notation in the form of hhhh hmmm mmmd dddd (d = double second) */
55-
STATIC time time_encode(struct dostime *t)
55+
STATIC dtime time_encode(struct dostime *t)
5656
{
5757
return (t->hour << 11) | (t->minute << 5) | (t->second >> 1);
5858
}
@@ -666,7 +666,7 @@ STATIC int alloc_find_free(f_node_ptr fnp, char *path)
666666
/* */
667667
/* dos_getdate for the file date */
668668
/* */
669-
date dos_getdate(void)
669+
ddate dos_getdate(void)
670670
{
671671
struct dosdate dd;
672672

@@ -679,7 +679,7 @@ date dos_getdate(void)
679679
/* */
680680
/* dos_gettime for the file time */
681681
/* */
682-
time dos_gettime(void)
682+
dtime dos_gettime(void)
683683
{
684684
struct dostime dt;
685685

kernel/globals.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ static BYTE *Globals_hRcsId =
3737
#include "device.h"
3838
#include "mcb.h"
3939
#include "pcb.h"
40-
#include "date.h"
41-
#include "time.h"
40+
#include "ddate.h"
41+
#include "dtime.h"
4242
#include "fat.h"
4343
#include "fcb.h"
4444
#include "tail.h"

kernel/init-mod.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
#define IN_INIT_MOD
33

44
#include "version.h"
5-
#include "date.h"
6-
#include "time.h"
5+
#include "ddate.h"
6+
#include "dtime.h"
77
#include "mcb.h"
88
#include "sft.h"
99
#include "fat.h"

kernel/inthndlr.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -1200,8 +1200,8 @@ VOID ASMCFUNC int21_service(iregs FAR * r)
12001200

12011201
case 0x01:
12021202
rc = DosSetFtime((COUNT) lr.BX, /* Handle */
1203-
(date) lr.DX, /* FileDate */
1204-
(time) lr.CX); /* FileTime */
1203+
(ddate) lr.DX, /* FileDate */
1204+
(dtime) lr.CX); /* FileTime */
12051205
break;
12061206

12071207
default:

kernel/makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ serial.obj: serial.asm io.inc $(TARGET).lnk
8787

8888
HDRS=\
8989
$(HDR)portab.h $(HDR)device.h $(HDR)mcb.h $(HDR)pcb.h \
90-
$(HDR)fat.h $(HDR)fcb.h $(HDR)tail.h $(HDR)time.h $(HDR)process.h \
90+
$(HDR)fat.h $(HDR)fcb.h $(HDR)tail.h $(HDR)dtime.h $(HDR)process.h \
9191
$(HDR)dcb.h $(HDR)sft.h $(HDR)cds.h $(HDR)exe.h $(HDR)fnode.h \
9292
$(HDR)dirmatch.h $(HDR)file.h $(HDR)clock.h $(HDR)kbd.h $(HDR)error.h \
9393
$(HDR)version.h dyndata.h

kernel/proto.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ COUNT DosGetCuDir(UBYTE drive, BYTE FAR * s);
102102
COUNT DosChangeDir(BYTE FAR * s);
103103
COUNT DosFindFirst(UCOUNT attr, BYTE FAR * name);
104104
COUNT DosFindNext(void);
105-
COUNT DosGetFtime(COUNT hndl, date * dp, time * tp);
106-
COUNT DosSetFtimeSft(int sft_idx, date dp, time tp);
105+
COUNT DosGetFtime(COUNT hndl, ddate * dp, dtime * tp);
106+
COUNT DosSetFtimeSft(int sft_idx, ddate dp, dtime tp);
107107
#define DosSetFtime(hndl, dp, tp) DosSetFtimeSft(get_sft_idx(hndl), (dp), (tp))
108108
COUNT DosGetFattr(BYTE FAR * name);
109109
COUNT DosSetFattr(BYTE FAR * name, UWORD attrp);
@@ -158,8 +158,8 @@ COUNT dos_close(COUNT fd);
158158
COUNT dos_delete(BYTE * path, int attrib);
159159
COUNT dos_rmdir(BYTE * path);
160160
COUNT dos_rename(BYTE * path1, BYTE * path2, int attrib);
161-
date dos_getdate(void);
162-
time dos_gettime(void);
161+
ddate dos_getdate(void);
162+
dtime dos_gettime(void);
163163
COUNT dos_mkdir(BYTE * dir);
164164
BOOL last_link(f_node_ptr fnp);
165165
COUNT map_cluster(REG f_node_ptr fnp, COUNT mode);

kernel/systime.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
/****************************************************************/
2828

2929
#include "portab.h"
30-
#include "time.h"
31-
#include "date.h"
30+
#include "dtime.h"
31+
#include "ddate.h"
3232
#include "globals.h"
3333

3434
#ifdef VERSION_STRINGS

mkfiles/gcc.mak

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ endif
7070

7171
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
7272
CLDEF=1
73-
CLT=gcc -Wall -DDOSC_TIME_H -I../hdr -o $@
73+
CLT=gcc -Wall -I../hdr -o $@
7474
CLC=$(CLT)
7575
LINK=$(XLINK) -Tkernel.ld -nostdlib -Wl,-Map,kernel.map -o kernel.exe $(OBJS) -Wl,--whole-archive ../drivers/device.lib -Wl,--no-whole-archive \#
7676

mkfiles/owlinux.mak

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ CP=cp
1212
ECHOTO=echo>>
1313
INITPATCH=@echo > /dev/null
1414
CLDEF=1
15-
CLT=wcl386 -zq -bcl=linux -DDOSC_TIME_H -I../hdr -fe=$@ -I$(COMPILERPATH)/lh
15+
CLT=wcl386 -zq -bcl=linux -I../hdr -fe=$@ -I$(COMPILERPATH)/lh
1616
CLC=$(CLT)
1717
CFLAGST=-fo=.obj $(CFLAGST)
1818
ALLCFLAGS=-fo=.obj $(ALLCFLAGS)

mkfiles/owwin.mak

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ INCLUDEPATH=$(COMPILERPATH)\h
1313
#ECHOTO=echo>>
1414
#INITPATCH=@echo > nul
1515
CLDEF=1
16-
CLT=wcl386 -zq -bcl=nt -DDOSC_TIME_H -I..\hdr -fe=$@ -I$(COMPILERPATH)\h -I$(COMPILERPATH)\h\nt
16+
CLT=wcl386 -zq -bcl=nt -I..\hdr -fe=$@ -I$(COMPILERPATH)\h -I$(COMPILERPATH)\h\nt
1717
CLC=$(CLT)
1818
CFLAGST=-fo=.obj $(CFLAGST)
1919
ALLCFLAGS=-fo=.obj $(ALLCFLAGS)

sys/sys.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@
5858
#include "device.h"
5959
#include "dcb.h"
6060
#include "xstructs.h"
61-
#include "date.h"
62-
#include "../hdr/time.h"
61+
#include "ddate.h"
62+
#include "dtime.h"
6363
#include "fat.h"
6464

6565
/* These definitions deliberately put here instead of

0 commit comments

Comments
 (0)