diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml new file mode 100644 index 0000000..9c1261f --- /dev/null +++ b/.github/workflows/windows.yml @@ -0,0 +1,20 @@ +on: push +jobs: + build: + runs-on: windows-latest + steps: + #- uses: msys2/setup-msys2@v2 + # with: + # msystem: msys + # install: gcc make diffutils + - uses: actions/checkout@v4 + - shell: msys2 {0} + run: | + nmake cproc-qbe +#mount +#./configure --host=x86_64-windows-msvc CC=cl +#gcc line.c +#./a.exe | od -t ax1 +#od -t ax1 b +#od -t ax1 c +#od -t ax1 test/basic.c diff --git a/configure b/configure index 0d94402..4b1826d 100755 --- a/configure +++ b/configure @@ -122,10 +122,14 @@ case "$target" in endfiles='"-l", "c", "-l", ":crtn.o"' defines='"-D", "__builtin_stdarg_start(ap, last)=__builtin_va_start(ap, last)"' ;; -*-*msys*) +*-msys*) startfiles='"-l", ":crt0.o"' endfiles='"-l", "c", "-l", "msys-2.0", "-l", "kernel32"' ;; +*-windows-msvc*) + startfiles='"-l", ":crt0.o"' + endfiles='"-l", "c"' + ;; *) fail "unknown target '$target', please create config.h manually" esac diff --git a/line.c b/line.c new file mode 100644 index 0000000..dfd0480 --- /dev/null +++ b/line.c @@ -0,0 +1,22 @@ +#include +#include +int main(void) { + extern int getmode(int); + char line[256]; + fprintf(stderr, "mode 0=%d\n", getmode(0)); + fprintf(stderr, "mode 1=%d\n", getmode(1)); + fprintf(stderr, "mode 2=%d\n", getmode(2)); + puts("hello"); + FILE *f = fopen("b", "w"); + fprintf(stderr, "mode b=%d\n", getmode(fileno(f))); + fputs("hello\n", f); + fclose(f); + f = fopen("c", "wt"); + fprintf(stderr, "mode c=%d\n", getmode(fileno(f))); + fputs("hello\n", f); + fclose(f); + f = fopen("test/basic.c", "r"); + fgets(line, sizeof line, f); + fprintf(stderr, "c=%d %d\n", line[strlen(line) - 2], line[strlen(line) - 1]); + fclose(f); +}