Fixed sp test case
This commit is contained in:
parent
e6144d16cd
commit
89aba30e4f
2 changed files with 80 additions and 57 deletions
131
Tangled/inweb.c
131
Tangled/inweb.c
|
@ -110,17 +110,17 @@ void Platform__where_am_i(wchar_t *p, size_t length) {
|
|||
#endif /* PLATFORM_MACOS */
|
||||
#endif /* PLATFORM_POSIX */
|
||||
#ifdef PLATFORM_POSIX
|
||||
#line 346 "inweb/foundation-module/Chapter 1/POSIX Platforms.w"
|
||||
#line 355 "inweb/foundation-module/Chapter 1/POSIX Platforms.w"
|
||||
typedef pthread_t foundation_thread;
|
||||
typedef pthread_attr_t foundation_thread_attributes;
|
||||
|
||||
#endif /* PLATFORM_POSIX */
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
#line 20 "inweb/foundation-module/Chapter 1/Windows Platform.w"
|
||||
#include <sys/stat.h>
|
||||
#include <dirent.h>
|
||||
#line 23 "inweb/foundation-module/Chapter 1/Windows Platform.w"
|
||||
#line 22 "inweb/foundation-module/Chapter 1/Windows Platform.w"
|
||||
#include <io.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
|
@ -151,8 +151,8 @@ char *Platform__getenv(const char *name) {
|
|||
#ifdef PLATFORM_WINDOWS
|
||||
#line 88 "inweb/foundation-module/Chapter 1/Windows Platform.w"
|
||||
int Platform__system(const char *cmd) {
|
||||
char cmdline[4096];
|
||||
sprintf(cmdline,"cmd /s /c \"%s\"", cmd);
|
||||
char cmd_line[10*MAX_PATH];
|
||||
sprintf(cmd_line, "sh -c %s", cmd);
|
||||
|
||||
STARTUPINFOA start;
|
||||
memset(&start, 0, sizeof start);
|
||||
|
@ -161,8 +161,10 @@ int Platform__system(const char *cmd) {
|
|||
start.wShowWindow = SW_HIDE;
|
||||
|
||||
PROCESS_INFORMATION process;
|
||||
if (CreateProcessA(0, cmdline, 0, 0, FALSE, CREATE_NO_WINDOW, 0, 0, &start, &process) == 0)
|
||||
if (CreateProcessA(0, cmd_line, 0, 0, FALSE, CREATE_NO_WINDOW, 0, 0, &start, &process) == 0) {
|
||||
fprintf(stderr, "A Unix-like shell 'sh' (e.g. Cygwin or MinGW) must be in the path to run commands.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
CloseHandle(process.hThread);
|
||||
if (WaitForSingleObject(process.hProcess, INFINITE) != WAIT_OBJECT_0) {
|
||||
|
@ -179,7 +181,7 @@ int Platform__system(const char *cmd) {
|
|||
|
||||
#endif /* PLATFORM_WINDOWS */
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
#line 177 "inweb/foundation-module/Chapter 1/Windows Platform.w"
|
||||
#line 188 "inweb/foundation-module/Chapter 1/Windows Platform.w"
|
||||
typedef HANDLE foundation_thread;
|
||||
typedef int foundation_thread_attributes;
|
||||
|
||||
|
@ -187,7 +189,7 @@ struct Win32_Thread_Start { void *(*fn)(void *); void* arg; };
|
|||
|
||||
#endif /* PLATFORM_WINDOWS */
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
#line 259 "inweb/foundation-module/Chapter 1/Windows Platform.w"
|
||||
#line 270 "inweb/foundation-module/Chapter 1/Windows Platform.w"
|
||||
struct Win32_Mutex { INIT_ONCE init; CRITICAL_SECTION crit; };
|
||||
|
||||
#endif /* PLATFORM_WINDOWS */
|
||||
|
@ -2322,7 +2324,7 @@ typedef void (*log_function_I)(text_stream *, int);
|
|||
typedef char string[MAX_STRING_LENGTH+1];
|
||||
#line 89 "inweb/foundation-module/Chapter 1/Foundation Module.w"
|
||||
void Foundation__start(void) ;
|
||||
#line 171 "inweb/foundation-module/Chapter 1/Foundation Module.w"
|
||||
#line 172 "inweb/foundation-module/Chapter 1/Foundation Module.w"
|
||||
void Foundation__end(void) ;
|
||||
#ifdef PLATFORM_POSIX
|
||||
#line 90 "inweb/foundation-module/Chapter 1/POSIX Platforms.w"
|
||||
|
@ -2411,19 +2413,23 @@ void Platform__notification(text_stream *text, int happy) ;
|
|||
#endif /* PLATFORM_MACOS */
|
||||
#endif /* PLATFORM_POSIX */
|
||||
#ifdef PLATFORM_POSIX
|
||||
#line 352 "inweb/foundation-module/Chapter 1/POSIX Platforms.w"
|
||||
int Platform__create_thread(foundation_thread *pt, const foundation_thread_attributes *pa, void *(*fn)(void *), void *arg) ;
|
||||
#endif /* PLATFORM_POSIX */
|
||||
#ifdef PLATFORM_POSIX
|
||||
#line 357 "inweb/foundation-module/Chapter 1/POSIX Platforms.w"
|
||||
int Platform__join_thread(foundation_thread pt, void** rv) ;
|
||||
#line 349 "inweb/foundation-module/Chapter 1/POSIX Platforms.w"
|
||||
void Platform__enable_coloured_terminal_output(void) ;
|
||||
#endif /* PLATFORM_POSIX */
|
||||
#ifdef PLATFORM_POSIX
|
||||
#line 361 "inweb/foundation-module/Chapter 1/POSIX Platforms.w"
|
||||
void Platform__init_thread(foundation_thread_attributes *pa, size_t size) ;
|
||||
int Platform__create_thread(foundation_thread *pt, const foundation_thread_attributes *pa, void *(*fn)(void *), void *arg) ;
|
||||
#endif /* PLATFORM_POSIX */
|
||||
#ifdef PLATFORM_POSIX
|
||||
#line 366 "inweb/foundation-module/Chapter 1/POSIX Platforms.w"
|
||||
int Platform__join_thread(foundation_thread pt, void** rv) ;
|
||||
#endif /* PLATFORM_POSIX */
|
||||
#ifdef PLATFORM_POSIX
|
||||
#line 370 "inweb/foundation-module/Chapter 1/POSIX Platforms.w"
|
||||
void Platform__init_thread(foundation_thread_attributes *pa, size_t size) ;
|
||||
#endif /* PLATFORM_POSIX */
|
||||
#ifdef PLATFORM_POSIX
|
||||
#line 375 "inweb/foundation-module/Chapter 1/POSIX Platforms.w"
|
||||
size_t Platform__get_thread_stack_size(foundation_thread_attributes *pa) ;
|
||||
#endif /* PLATFORM_POSIX */
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
|
@ -2435,59 +2441,63 @@ int Platform__Windows_isdigit(int c) ;
|
|||
void Platform__where_am_i(wchar_t *p, size_t length) ;
|
||||
#endif /* PLATFORM_WINDOWS */
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
#line 118 "inweb/foundation-module/Chapter 1/Windows Platform.w"
|
||||
#line 120 "inweb/foundation-module/Chapter 1/Windows Platform.w"
|
||||
int Platform__mkdir(char *transcoded_pathname) ;
|
||||
#endif /* PLATFORM_WINDOWS */
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
#line 126 "inweb/foundation-module/Chapter 1/Windows Platform.w"
|
||||
#line 128 "inweb/foundation-module/Chapter 1/Windows Platform.w"
|
||||
void * Platform__opendir(char *dir_name) ;
|
||||
#endif /* PLATFORM_WINDOWS */
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
#line 131 "inweb/foundation-module/Chapter 1/Windows Platform.w"
|
||||
#line 133 "inweb/foundation-module/Chapter 1/Windows Platform.w"
|
||||
int Platform__readdir(void *D, char *dir_name, char *leafname) ;
|
||||
#endif /* PLATFORM_WINDOWS */
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
#line 148 "inweb/foundation-module/Chapter 1/Windows Platform.w"
|
||||
#line 150 "inweb/foundation-module/Chapter 1/Windows Platform.w"
|
||||
void Platform__closedir(void *D) ;
|
||||
#endif /* PLATFORM_WINDOWS */
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
#line 156 "inweb/foundation-module/Chapter 1/Windows Platform.w"
|
||||
#line 158 "inweb/foundation-module/Chapter 1/Windows Platform.w"
|
||||
void Platform__rsync(char *transcoded_source, char *transcoded_dest) ;
|
||||
#endif /* PLATFORM_WINDOWS */
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
#line 164 "inweb/foundation-module/Chapter 1/Windows Platform.w"
|
||||
#line 166 "inweb/foundation-module/Chapter 1/Windows Platform.w"
|
||||
void Platform__sleep(int seconds) ;
|
||||
#endif /* PLATFORM_WINDOWS */
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
#line 171 "inweb/foundation-module/Chapter 1/Windows Platform.w"
|
||||
#line 173 "inweb/foundation-module/Chapter 1/Windows Platform.w"
|
||||
void Platform__notification(text_stream *text, int happy) ;
|
||||
#endif /* PLATFORM_WINDOWS */
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
#line 191 "inweb/foundation-module/Chapter 1/Windows Platform.w"
|
||||
#line 182 "inweb/foundation-module/Chapter 1/Windows Platform.w"
|
||||
void Platform__enable_coloured_terminal_output(void) ;
|
||||
#endif /* PLATFORM_WINDOWS */
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
#line 202 "inweb/foundation-module/Chapter 1/Windows Platform.w"
|
||||
int Platform__create_thread(foundation_thread *pt, const foundation_thread_attributes *pa, void *(*fn)(void *), void *arg) ;
|
||||
#endif /* PLATFORM_WINDOWS */
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
#line 206 "inweb/foundation-module/Chapter 1/Windows Platform.w"
|
||||
#line 217 "inweb/foundation-module/Chapter 1/Windows Platform.w"
|
||||
int Platform__join_thread(foundation_thread pt, void** rv) ;
|
||||
#endif /* PLATFORM_WINDOWS */
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
#line 210 "inweb/foundation-module/Chapter 1/Windows Platform.w"
|
||||
#line 221 "inweb/foundation-module/Chapter 1/Windows Platform.w"
|
||||
void Platform__init_thread(foundation_thread_attributes* pa, size_t size) ;
|
||||
#endif /* PLATFORM_WINDOWS */
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
#line 213 "inweb/foundation-module/Chapter 1/Windows Platform.w"
|
||||
#line 224 "inweb/foundation-module/Chapter 1/Windows Platform.w"
|
||||
size_t Platform__get_thread_stack_size(foundation_thread_attributes* pa) ;
|
||||
#endif /* PLATFORM_WINDOWS */
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
#line 225 "inweb/foundation-module/Chapter 1/Windows Platform.w"
|
||||
#line 236 "inweb/foundation-module/Chapter 1/Windows Platform.w"
|
||||
time_t Platform__never_time(void) ;
|
||||
#endif /* PLATFORM_WINDOWS */
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
#line 229 "inweb/foundation-module/Chapter 1/Windows Platform.w"
|
||||
#line 240 "inweb/foundation-module/Chapter 1/Windows Platform.w"
|
||||
time_t Platform__timestamp(char *transcoded_filename) ;
|
||||
#endif /* PLATFORM_WINDOWS */
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
#line 235 "inweb/foundation-module/Chapter 1/Windows Platform.w"
|
||||
#line 246 "inweb/foundation-module/Chapter 1/Windows Platform.w"
|
||||
off_t Platform__size(char *transcoded_filename) ;
|
||||
#endif /* PLATFORM_WINDOWS */
|
||||
#line 64 "inweb/foundation-module/Chapter 2/Debugging Log.w"
|
||||
|
@ -4995,7 +5005,7 @@ void Foundation__start(void) {
|
|||
Memory__start();
|
||||
|
||||
{
|
||||
#line 106 "inweb/foundation-module/Chapter 1/Foundation Module.w"
|
||||
#line 107 "inweb/foundation-module/Chapter 1/Foundation Module.w"
|
||||
Writers__register_writer('f', &Filenames__writer);
|
||||
Writers__register_writer('p', &Pathnames__writer);
|
||||
Writers__register_writer('v', &VersionNumbers__writer);
|
||||
|
@ -5008,29 +5018,30 @@ void Foundation__start(void) {
|
|||
;
|
||||
Time__begin();
|
||||
Pathnames__start();
|
||||
Platform__enable_coloured_terminal_output();
|
||||
|
||||
{
|
||||
#line 117 "inweb/foundation-module/Chapter 1/Foundation Module.w"
|
||||
#line 118 "inweb/foundation-module/Chapter 1/Foundation Module.w"
|
||||
Log__declare_aspect(DEBUGGING_LOG_INCLUSIONS_DA, L"debugging log inclusions", FALSE, FALSE);
|
||||
Log__declare_aspect(SHELL_USAGE_DA, L"shell usage", FALSE, FALSE);
|
||||
Log__declare_aspect(MEMORY_USAGE_DA, L"memory usage", FALSE, FALSE);
|
||||
Log__declare_aspect(TEXT_FILES_DA, L"text files", FALSE, FALSE);
|
||||
|
||||
}
|
||||
#line 95 "inweb/foundation-module/Chapter 1/Foundation Module.w"
|
||||
;
|
||||
|
||||
{
|
||||
#line 128 "inweb/foundation-module/Chapter 1/Foundation Module.w"
|
||||
Writers__register_logger('a', &Tries__log_avinue);
|
||||
Writers__register_logger('S', &Streams__log);
|
||||
|
||||
}
|
||||
#line 96 "inweb/foundation-module/Chapter 1/Foundation Module.w"
|
||||
;
|
||||
|
||||
{
|
||||
#line 148 "inweb/foundation-module/Chapter 1/Foundation Module.w"
|
||||
#line 129 "inweb/foundation-module/Chapter 1/Foundation Module.w"
|
||||
Writers__register_logger('a', &Tries__log_avinue);
|
||||
Writers__register_logger('S', &Streams__log);
|
||||
|
||||
}
|
||||
#line 97 "inweb/foundation-module/Chapter 1/Foundation Module.w"
|
||||
;
|
||||
|
||||
{
|
||||
#line 149 "inweb/foundation-module/Chapter 1/Foundation Module.w"
|
||||
CommandLine__begin_group(FOUNDATION_CLSG, NULL);
|
||||
CommandLine__declare_switch(LOG_CLSW, L"log", 2,
|
||||
L"write the debugging log to include diagnostics on X");
|
||||
|
@ -5049,13 +5060,13 @@ void Foundation__start(void) {
|
|||
CommandLine__end_group();
|
||||
|
||||
}
|
||||
#line 97 "inweb/foundation-module/Chapter 1/Foundation Module.w"
|
||||
#line 98 "inweb/foundation-module/Chapter 1/Foundation Module.w"
|
||||
;
|
||||
}
|
||||
|
||||
#line 146 "inweb/foundation-module/Chapter 1/Foundation Module.w"
|
||||
#line 147 "inweb/foundation-module/Chapter 1/Foundation Module.w"
|
||||
|
||||
#line 171 "inweb/foundation-module/Chapter 1/Foundation Module.w"
|
||||
#line 172 "inweb/foundation-module/Chapter 1/Foundation Module.w"
|
||||
void Foundation__end(void) {
|
||||
if (Log__aspect_switched_on(MEMORY_USAGE_DA)) Memory__log_statistics();
|
||||
Log__close();
|
||||
|
@ -5318,7 +5329,13 @@ void Platform__notification(text_stream *text, int happy) {
|
|||
#endif /* PLATFORM_MACOS */
|
||||
#endif /* PLATFORM_POSIX */
|
||||
#ifdef PLATFORM_POSIX
|
||||
#line 352 "inweb/foundation-module/Chapter 1/POSIX Platforms.w"
|
||||
#line 349 "inweb/foundation-module/Chapter 1/POSIX Platforms.w"
|
||||
void Platform__enable_coloured_terminal_output(void) {
|
||||
}
|
||||
|
||||
#endif /* PLATFORM_POSIX */
|
||||
#ifdef PLATFORM_POSIX
|
||||
#line 361 "inweb/foundation-module/Chapter 1/POSIX Platforms.w"
|
||||
int Platform__create_thread(foundation_thread *pt,
|
||||
const foundation_thread_attributes *pa, void *(*fn)(void *), void *arg) {
|
||||
return pthread_create(pt, pa, fn, arg);
|
||||
|
@ -5360,7 +5377,7 @@ void Platform__where_am_i(wchar_t *p, size_t length) {
|
|||
|
||||
#endif /* PLATFORM_WINDOWS */
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
#line 118 "inweb/foundation-module/Chapter 1/Windows Platform.w"
|
||||
#line 120 "inweb/foundation-module/Chapter 1/Windows Platform.w"
|
||||
int Platform__mkdir(char *transcoded_pathname) {
|
||||
errno = 0;
|
||||
int rv = mkdir(transcoded_pathname);
|
||||
|
@ -5398,27 +5415,33 @@ void Platform__closedir(void *D) {
|
|||
|
||||
#endif /* PLATFORM_WINDOWS */
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
#line 156 "inweb/foundation-module/Chapter 1/Windows Platform.w"
|
||||
#line 158 "inweb/foundation-module/Chapter 1/Windows Platform.w"
|
||||
void Platform__rsync(char *transcoded_source, char *transcoded_dest) {
|
||||
printf("Platform__rsync() is not yet implemented!\n");
|
||||
}
|
||||
|
||||
#endif /* PLATFORM_WINDOWS */
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
#line 164 "inweb/foundation-module/Chapter 1/Windows Platform.w"
|
||||
#line 166 "inweb/foundation-module/Chapter 1/Windows Platform.w"
|
||||
void Platform__sleep(int seconds) {
|
||||
Sleep((DWORD)(1000*seconds));
|
||||
}
|
||||
|
||||
#endif /* PLATFORM_WINDOWS */
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
#line 171 "inweb/foundation-module/Chapter 1/Windows Platform.w"
|
||||
#line 173 "inweb/foundation-module/Chapter 1/Windows Platform.w"
|
||||
void Platform__notification(text_stream *text, int happy) {
|
||||
}
|
||||
|
||||
#endif /* PLATFORM_WINDOWS */
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
#line 184 "inweb/foundation-module/Chapter 1/Windows Platform.w"
|
||||
#line 182 "inweb/foundation-module/Chapter 1/Windows Platform.w"
|
||||
void Platform__enable_coloured_terminal_output(void) {
|
||||
}
|
||||
|
||||
#endif /* PLATFORM_WINDOWS */
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
#line 195 "inweb/foundation-module/Chapter 1/Windows Platform.w"
|
||||
DWORD WINAPI Platform__Win32_Thread_Func(LPVOID param) {
|
||||
struct Win32_Thread_Start* start = (struct Win32_Thread_Start*)param;
|
||||
(start->fn)(start->arg);
|
||||
|
@ -5454,7 +5477,7 @@ size_t Platform__get_thread_stack_size(foundation_thread_attributes* pa) {
|
|||
|
||||
#endif /* PLATFORM_WINDOWS */
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
#line 225 "inweb/foundation-module/Chapter 1/Windows Platform.w"
|
||||
#line 236 "inweb/foundation-module/Chapter 1/Windows Platform.w"
|
||||
time_t Platform__never_time(void) {
|
||||
return (time_t) 0;
|
||||
}
|
||||
|
@ -8144,11 +8167,11 @@ int CommandLine__read_pair_p(text_stream *opt, text_stream *opt_val, int N,
|
|||
; innocuous = TRUE; break;
|
||||
case VERSION_CLSW: {
|
||||
PRINT("inweb");
|
||||
char *svn = "7-alpha.1+1A51";
|
||||
char *svn = "7-alpha.1+1A52";
|
||||
if (svn[0]) PRINT(" version %s", svn);
|
||||
char *vname = "Escape to Danger";
|
||||
if (vname[0]) PRINT(" '%s'", vname);
|
||||
char *d = "4 July 2020";
|
||||
char *d = "5 July 2020";
|
||||
if (d[0]) PRINT(" (%s)", d);
|
||||
PRINT("\n");
|
||||
innocuous = TRUE; break;
|
||||
|
|
|
@ -59,7 +59,7 @@ document weave order 0
|
|||
figure <img3.jpg> -1 by -1
|
||||
vskip (in comment)
|
||||
commentary <So there, really!\n>
|
||||
download <alice.crt>
|
||||
download <alice.crt>
|
||||
paragraph P3
|
||||
material definition
|
||||
code line
|
||||
|
@ -83,10 +83,10 @@ document weave order 0
|
|||
_pppppppp_
|
||||
pmac <Solve Goldbach's conjecture for i>
|
||||
source_code <;>
|
||||
_c_
|
||||
_p_
|
||||
code line
|
||||
source_code <}>
|
||||
_c_
|
||||
_p_
|
||||
paragraph P3.1
|
||||
material discussion
|
||||
commentary <This ought to print:\n>
|
||||
|
|
Loading…
Reference in a new issue