librktio: more Windoes fixes

Now passes rktio tests and builds Racket 3m, but crashes with places.
This commit is contained in:
Matthew Flatt 2017-06-17 18:34:16 -06:00
parent 1e0a55cc8f
commit 193e6cb518
5 changed files with 19 additions and 12 deletions

4
racket/src/rktio/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
# When building and running the demo with MSVC:
/demo.exe
/demo.obj
/test1

View File

@ -494,7 +494,7 @@ static char *week_day_name(rktio_t *rktio, int dow)
{
static char *days[] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
check_valid((dow >= 0) && (dow <= 6));
return days[dow-1];
return days[dow];
}
int main(int argc, char **argv)
@ -779,9 +779,11 @@ int main(int argc, char **argv)
fd2 = rktio_accept(rktio, lnr);
printf(" fill\n");
if (verbose)
printf(" fill\n");
check_fill_write(rktio, fd2, NULL, 0, verbose);
printf(" drain\n");
if (verbose)
printf(" drain\n");
check_drain_read(rktio, fd, 0, verbose);
check_valid(rktio_close(rktio, fd));
@ -1047,9 +1049,9 @@ int main(int argc, char **argv)
amt = rktio_write(rktio, fd2, "hola", 4);
check_valid(amt == 4);
printf("wait...\n");
rktio_close(rktio, fd2);
rktio_sleep(rktio, 0, ps, NULL);
printf("done\n");
while (rktio_poll_fs_change_ready(rktio, fc) == RKTIO_POLL_NOT_READY) {
/* sleep woke up early - not what we want, but allowed by the spec */
@ -1063,7 +1065,6 @@ int main(int argc, char **argv)
check_valid(rktio_poll_fs_change_ready(rktio, fc) == RKTIO_POLL_READY);
check_valid(rktio_poll_fs_change_ready(rktio, fc) == RKTIO_POLL_READY);
check_valid(rktio_close(rktio, fd2));
rktio_poll_set_forget(rktio, ps);
rktio_fs_change_forget(rktio, fc);
@ -1103,7 +1104,7 @@ int main(int argc, char **argv)
check_valid(rktio_file_lock_try(rktio, fd, 0) == RKTIO_LOCK_ACQUIRED);
#if defined(RKTIO_SYSTEM_WINDOWS)
/* Balance unlocks (Windows only) */
check_valid(rktio_file_unlock(rktio, fd2));
check_valid(rktio_file_unlock(rktio, fd));
#endif
/* Ok to take another non-exclusive lock: */

View File

@ -2,4 +2,4 @@
echo ============================================
echo Assumes that the "librktio" project is built
echo ============================================
cl /I..\worksp\librktio demo.c ..\worksp\librktio\x32\Release\librktio.lib ws2_32.lib user32.lib shell32.lib
cl /I..\worksp\librktio demo.c ..\worksp\librktio\Win32\Release\librktio.lib ws2_32.lib user32.lib shell32.lib

View File

@ -392,7 +392,7 @@ rktio_date_t *rktio_seconds_to_date(rktio_t *rktio, rktio_timestamp_t seconds, i
dst = 0;
if (get_gmt) {
tzoffset = 0;
tzn = "UTC";
tzn = MSC_IZE(strdup)("UTC");
} else {
TIME_ZONE_INFORMATION tz;
if (GetTimeZoneInformationForYearProc)
@ -418,6 +418,7 @@ rktio_date_t *rktio_seconds_to_date(rktio_t *rktio, rktio_timestamp_t seconds, i
tzn = NARROW_PATH_copy(tz.StandardName);
}
}
# define TZN_STRDUP(s) s
#else
hour = localTime->tm_hour;
min = localTime->tm_min;
@ -470,6 +471,7 @@ rktio_date_t *rktio_seconds_to_date(rktio_t *rktio, rktio_timestamp_t seconds, i
} else
tzn = "UTC";
# define TZN_STRDUP(s) strdup
#endif
if (!tzn)
@ -489,7 +491,7 @@ rktio_date_t *rktio_seconds_to_date(rktio_t *rktio, rktio_timestamp_t seconds, i
result->is_dst = (dst ? 1 : 0);
result->zone_offset = tzoffset;
if (tzn)
result->zone_name = MSC_IZE(strdup)(tzn);
result->zone_name = TZN_STRDUP(tzn);
else
result->zone_name = NULL;

View File

@ -328,8 +328,8 @@
"xsrc/mzsj86.obj"
"xsrc/foreign.obj"
(find-build-file "libracket" "gmp.obj")
(find-build-file "racket" "libffi.lib")
(find-build-file "racket" "librktio.lib")
(find-build-file "libffi" "libffi.lib")
(find-build-file "librktio" "librktio.lib")
(append
(let ([f (and win64?
(find-build-file "libracket" "mzsj86w64.obj"))])