mes/lib/tests/stdio/70-printf.c

173 lines
3.9 KiB
C
Raw Normal View History

/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
test: Remove 30-test.i indirection. * include/30-test.i: Remove. * scaffold/tests/30-strlen.c: Remove 30-test.i indirection. * scaffold/tests/31-eputs.c: Likewise. * scaffold/tests/32-compare.c: Likewise. * scaffold/tests/33-and-or.c: Likewise. * scaffold/tests/34-pre-post.c: Likewise. * scaffold/tests/35-compare-char.c: Likewise. * scaffold/tests/36-compare-arithmetic.c: Likewise. * scaffold/tests/37-compare-assign.c: Likewise. * scaffold/tests/38-compare-call.c: Likewise. * scaffold/tests/40-if-else.c: Likewise. * scaffold/tests/41-?.c: Likewise. * scaffold/tests/42-goto-label.c: Likewise. * scaffold/tests/43-for-do-while.c: Likewise. * scaffold/tests/44-switch.c: Likewise. * scaffold/tests/45-void-call.c: Likewise. * scaffold/tests/46-function-static.c: Likewise. * scaffold/tests/50-assert.c: Likewise. * scaffold/tests/51-strcmp.c: Likewise. * scaffold/tests/52-itoa.c: Likewise. * scaffold/tests/53-strcpy.c: Likewise. * scaffold/tests/60-math.c: Likewise. * scaffold/tests/63-struct-cell.c: Likewise. * scaffold/tests/64-make-cell.c: Likewise. * scaffold/tests/65-read.c: Likewise. * scaffold/tests/66-local-char-array.c: Likewise. * scaffold/tests/70-printf.c: Likewise. * scaffold/tests/71-struct-array.c: Likewise. * scaffold/tests/72-typedef-struct-def.c: Likewise. * scaffold/tests/73-union.c: Likewise. * scaffold/tests/74-multi-line-string.c: Likewise. * scaffold/tests/75-struct-union.c: Likewise. * scaffold/tests/76-pointer-arithmetic.c: Likewise. * scaffold/tests/77-pointer-assign.c: Likewise. * scaffold/tests/78-union-struct.c: Likewise. * scaffold/tests/79-int-array.c: Likewise. * scaffold/tests/7a-struct-char-array.c: Likewise. * scaffold/tests/7b-struct-int-array.c: Likewise. * scaffold/tests/7c-dynarray.c: Likewise. * scaffold/tests/7d-cast-char.c: Likewise. * scaffold/tests/7e-struct-array-access.c: Likewise. * scaffold/tests/7f-struct-pointer-arithmetic.c: Likewise. * scaffold/tests/7g-struct-byte-word-field.c: Likewise. * scaffold/tests/7h-struct-assign.c: Likewise. * scaffold/tests/7i-struct-struct.c: Likewise. * scaffold/tests/7j-strtoull.c: Likewise. * scaffold/tests/7k-for-each-elem.c: Likewise. * scaffold/tests/7l-struct-any-size-array.c: Likewise. * scaffold/tests/7m-struct-char-array-assign.c: Likewise. * scaffold/tests/7n-struct-struct-array.c: Likewise. * scaffold/tests/80-setjmp.c: Likewise. * scaffold/tests/81-qsort.c: Likewise. * scaffold/tests/86-strncpy.c: Likewise. * scaffold/tests/87-sscanf.c: Likewise.
2018-08-15 16:01:14 +00:00
#include <libmes.h>
mescc: x86_64 support: Refactor to abstracted assembly, add x86_64. * module/mescc/as.scm: Support abstracted assembly. * module/mescc/i386/as.scm: Rewrite. * module/mescc/x86_64/as.scm: Implement. * module/mescc/compile.scm: Refactor to abstracted assembly. * module/mescc/M1.scm: Update for partial 64 bit support. * module/mescc/bytevectors.scm (bytevector-u64-native-set!): New procedure. * module/mescc/i386/info.scm (i386:type-alist): Use 4 byte type length also for faking double, long long, long double. * module/mescc/info.scm:modified: * module/mescc/x86_64/info.scm (x86_64:registers): New variable. * lib/x86-mes/x86.M1: Update for new register scheme. * lib/x86_64-mes/x86_64.M1: Implement. * lib/x86-mes/setjmp.c: Implement. * lib/x86_64-mes-gcc/setjmp.c: Implement. * build-aux/build-cc.sh: Update for x86_64. * build-aux/build-cc32.sh: Likewise. * build-aux/build-mes.sh: Likewise. * build-aux/build-x86_64-mes.sh: Likewise. * build-aux/check-mescc.sh: Likewise. * build-aux/test64.sh: Likewise. * include/libmes.h: Likewise. * include/setjmp.h: Likewise. * include/signal.h: Likewise. * include/stdarg.h: Likewise. * include/sys/stat.h: Likewise. * include/sys/types.h: Likewise. * include/sys/wait.h: Likewise. * include/unistd.h: Likewise. * lib/libc+gnu.c: Likewise. * lib/libc+tcc.c: Likewise. * lib/linux/gnu.c: Likewise. * lib/linux/libc-mini.c: Likewise. * lib/linux/libc.c: Likewise. * lib/linux/tcc.c: Likewise. * lib/linux/x86_64-mes-gcc/mes.c: Likewise. * lib/linux/x86_64-mes/crt1.c: Likewise. * lib/mes/abtol.c: Likewise. * lib/posix/mktemp.c: Likewise. * lib/posix/wait.c: Likewise. * lib/stdio/fopen.c: Likewise. * lib/stdio/fputc.c: Likewise. * lib/stdio/fseek.c: Likewise. * lib/stdio/printf.c: Likewise. * lib/stdio/sprintf.c: Likewise. * lib/stdio/vfprintf.c: Likewise. * lib/stdio/vsprintf.c: Likewise. * lib/stdio/vsscanf.c: Likewise. * lib/stdlib/qsort.c: Likewise. * lib/x86-mes-gcc/setjmp.c: Likewise. * scaffold/tests/11-if-1.c: Likewise. * scaffold/tests/15-if-!f.c: Likewise. * scaffold/tests/16-if-t.c: Likewise. * scaffold/tests/21-char[].c: Likewise. * scaffold/tests/23-pointer.c: Likewise. * scaffold/tests/32-compare.c: Likewise. * scaffold/tests/33-and-or.c: Likewise. * scaffold/tests/34-pre-post.c: Likewise. * scaffold/tests/35-compare-char.c: Likewise. * scaffold/tests/36-compare-arithmetic.c: Likewise. * scaffold/tests/37-compare-assign.c: Likewise. * scaffold/tests/38-compare-call.c: Likewise. * scaffold/tests/40-if-else.c: Likewise. * scaffold/tests/41-?.c: Likewise. * scaffold/tests/42-goto-label.c: Likewise. * scaffold/tests/43-for-do-while.c: Likewise. * scaffold/tests/44-switch.c: Likewise. * scaffold/tests/45-void-call.c: Likewise. * scaffold/tests/46-function-static.c: Likewise. * scaffold/tests/51-strcmp.c: Likewise. * scaffold/tests/51-strncmp.c: Likewise. * scaffold/tests/53-strcpy.c: Likewise. * scaffold/tests/54-argv.c: Likewise. * scaffold/tests/60-math.c: Likewise. * scaffold/tests/61-array.c: Likewise. * scaffold/tests/63-struct-cell.c: Likewise. * scaffold/tests/64-make-cell.c: Likewise. * scaffold/tests/65-read.c: Likewise. * scaffold/tests/70-printf.c: Likewise. * scaffold/tests/71-struct-array.c: Likewise. * scaffold/tests/72-typedef-struct-def.c: Likewise. * scaffold/tests/74-multi-line-string.c: Likewise. * scaffold/tests/76-pointer-arithmetic.c: Likewise. * scaffold/tests/79-int-array.c: Likewise. * scaffold/tests/7a-struct-char-array.c: Likewise. * scaffold/tests/7b-struct-int-array.c: Likewise. * scaffold/tests/7i-struct-struct.c: Likewise. * scaffold/tests/7k-for-each-elem.c: Likewise. * scaffold/tests/7l-struct-any-size-array.c: Likewise. * scaffold/tests/7o-struct-pre-post.c: Likewise. * scaffold/tests/7q-bit-field.c: Likewise. * scaffold/tests/7s-struct-short.c: Likewise. * scaffold/tests/80-setjmp.c: Likewise. * scaffold/tests/81-qsort.c: Likewise. * scaffold/tests/85-sizeof.c: Likewise. * scaffold/tests/87-sscanf.c: Likewise. * scaffold/tests/90-strpbrk.c: Likewise. * scaffold/tests/91-fseek.c: Likewise. * scaffold/tests/95-signal.c: Likewise. * scaffold/tests/97-fopen.c: Likewise. * scaffold/tests/99-readdir.c: Likewise. * scaffold/tests/t.c: Likewise. * lib/linux/x86_64-mes/mes.c: New file. * lib/linux/x86_64-mes/mini.c: New file. * lib/x86_64-mes/setjmp.c: New file. * scaffold/tests/06-!call-1.c: New file. * scaffold/tests/06-call-2.c: New file. * scaffold/tests/06-call-variable.c: New file. * scaffold/tests/08-assign-global.c: New file. * scaffold/tests/08-assign-negative.c: New file. * scaffold/tests/17-compare-and-or.c: New file. * scaffold/tests/17-compare-and.c: New file. * scaffold/tests/17-compare-ge.c: New file. * scaffold/tests/17-compare-gt.c: New file. * scaffold/tests/17-compare-le.c: New file. * scaffold/tests/17-compare-lt.c: New file. * scaffold/tests/17-compare-or.c: New file. * scaffold/tests/17-compare-unsigned-ge.c: New file. * scaffold/tests/17-compare-unsigned-gt.c: New file. * scaffold/tests/17-compare-unsigned-le.c: New file. * scaffold/tests/17-compare-unsigned-lt.c: New file. * scaffold/tests/21-char[]-simple.c: New file. * scaffold/tests/23-global-pointer-init-null.c: New file. * scaffold/tests/23-global-pointer-init.c: New file. * scaffold/tests/23-global-pointer-pointer-ref.c: New file. * scaffold/tests/23-global-pointer-ref.c: New file. * scaffold/tests/23-pointer-sub.c: New file. * scaffold/tests/31-oputs.c: New file. * scaffold/tests/32-call-wrap.c: New file. * scaffold/tests/38-compare-call-2.c: New file. * scaffold/tests/38-compare-call-3.c: New file. * scaffold/tests/51-pointer-sub.c: New file. * scaffold/tests/54-argc.c: New file. * scaffold/tests/63-struct-array-assign.c: New file. * scaffold/tests/63-struct-array-compare.c: New file. * scaffold/tests/63-struct-array.c: New file. * scaffold/tests/63-struct-assign.c: New file. * scaffold/tests/63-struct-function.c: New file. * scaffold/tests/63-struct-local.c: New file. * scaffold/tests/63-struct-pointer.c: New file. * scaffold/tests/63-struct.c: New file. * scaffold/tests/70-printf-hello.c: New file. * scaffold/tests/70-printf-simple.c: New file. * scaffold/tests/70-stdarg.c: New file. * scaffold/tests/70-strchr.c: New file. * scaffold/tests/73-union-hello.c: New file. * scaffold/tests/76-pointer-arithmetic-pp.c: New file. * scaffold/tests/79-int-array-simple.c: New file. * scaffold/tests/7b-struct-int-array-hello.c: New file. * scaffold/tests/7b-struct-int-array-pointer.c: New file. * scaffold/tests/7i-struct-struct-simple.c: New file. * scaffold/tests/7k-for-each-elem-simple.c: New file. * scaffold/tests/7l-struct-any-size-array-simple.c: New file. * scaffold/tests/7o-struct-pre-post-simple.c: New file. * scaffold/tests/7q-bit-field-simple.c: New file. * scaffold/tests/90-strspn.c: New file. * scaffold/tests/06-call-string.c.: Rename from 31-eputs.c. * scaffold/tests/7t-function-destruct.c: Rename from 48-function-destruct.c. * scaffold/tests/48-global-static.c: Rename from 49-global-static.c. * scaffold/tests/55-char-array.c:renamed: Rename from 4a-char-array.c. * scaffold/tests/51-itoa.c:r Rename from 52-itoa.c. * include/signal.h:(struct sigaction):
2018-08-15 16:26:55 +00:00
#include <stdio.h>
test: Split-up Mescc scaffold test. * make.scm (check-scaffold, check-scaffold-tests): New targets. * mlibc/include/00-test.i: New file. * mlibc/include/30-test.i: New file. * mlibc/mini-libc-mes.c (puts): New function. * scaffold/tests/00-exit-0.c: : New file. * scaffold/tests/01-return-0.c: : New file. * scaffold/tests/02-return-1.c: : New file. * scaffold/tests/03-call.c: : New file. * scaffold/tests/04-call-0.c: : New file. * scaffold/tests/05-call-1.c: : New file. * scaffold/tests/06-call-!1.c: : New file. * scaffold/tests/10-if-0.c: : New file. * scaffold/tests/11-if-1.c: : New file. * scaffold/tests/12-if-==.c: : New file. * scaffold/tests/13-if-!=.c: : New file. * scaffold/tests/14-if-goto.c: : New file. * scaffold/tests/15-if-!f.c: : New file. * scaffold/tests/16-if-t.c: : New file. * scaffold/tests/20-while.c: : New file. * scaffold/tests/21-char[].c: : New file. * scaffold/tests/22-while-char[].c: : New file. * scaffold/tests/30-strlen.c: : New file. * scaffold/tests/31-eputs.c: : New file. * scaffold/tests/32-compare.c: : New file. * scaffold/tests/33-and-or.c: : New file. * scaffold/tests/34-pre-post.c: : New file. * scaffold/tests/35-compare-char.c: : New file. * scaffold/tests/36-compare-arithmetic.c: : New file. * scaffold/tests/37-compare-assign.c: : New file. * scaffold/tests/38-compare-call.c: : New file. * scaffold/tests/40-if-else.c: : New file. * scaffold/tests/41-?.c: : New file. * scaffold/tests/42-goto-label.c: : New file. * scaffold/tests/43-for-do-while.c: : New file. * scaffold/tests/44-switch.c: : New file. * scaffold/tests/45-void-call.c: : New file. * scaffold/tests/50-assert.c: : New file. * scaffold/tests/51-strcmp.c: : New file. * scaffold/tests/52-itoa.c: : New file. * scaffold/tests/53-strcpy.c: : New file. * scaffold/tests/54-argv.c: : New file. * scaffold/tests/60-math.c: : New file. * scaffold/tests/61-array.c: : New file. * scaffold/tests/63-struct-cell.c: : New file. * scaffold/tests/64-make-cell.c: : New file. * scaffold/tests/65-read.c: : New file. * scaffold/tests/66-struct-array.c: : New file. * scaffold/t.c: Remove. * scaffold/t-tcc.c: Remove.
2017-07-09 07:24:07 +00:00
#include <string.h>
2018-06-02 09:41:06 +00:00
#include <stdarg.h>
int
test: Remove 30-test.i indirection. * include/30-test.i: Remove. * scaffold/tests/30-strlen.c: Remove 30-test.i indirection. * scaffold/tests/31-eputs.c: Likewise. * scaffold/tests/32-compare.c: Likewise. * scaffold/tests/33-and-or.c: Likewise. * scaffold/tests/34-pre-post.c: Likewise. * scaffold/tests/35-compare-char.c: Likewise. * scaffold/tests/36-compare-arithmetic.c: Likewise. * scaffold/tests/37-compare-assign.c: Likewise. * scaffold/tests/38-compare-call.c: Likewise. * scaffold/tests/40-if-else.c: Likewise. * scaffold/tests/41-?.c: Likewise. * scaffold/tests/42-goto-label.c: Likewise. * scaffold/tests/43-for-do-while.c: Likewise. * scaffold/tests/44-switch.c: Likewise. * scaffold/tests/45-void-call.c: Likewise. * scaffold/tests/46-function-static.c: Likewise. * scaffold/tests/50-assert.c: Likewise. * scaffold/tests/51-strcmp.c: Likewise. * scaffold/tests/52-itoa.c: Likewise. * scaffold/tests/53-strcpy.c: Likewise. * scaffold/tests/60-math.c: Likewise. * scaffold/tests/63-struct-cell.c: Likewise. * scaffold/tests/64-make-cell.c: Likewise. * scaffold/tests/65-read.c: Likewise. * scaffold/tests/66-local-char-array.c: Likewise. * scaffold/tests/70-printf.c: Likewise. * scaffold/tests/71-struct-array.c: Likewise. * scaffold/tests/72-typedef-struct-def.c: Likewise. * scaffold/tests/73-union.c: Likewise. * scaffold/tests/74-multi-line-string.c: Likewise. * scaffold/tests/75-struct-union.c: Likewise. * scaffold/tests/76-pointer-arithmetic.c: Likewise. * scaffold/tests/77-pointer-assign.c: Likewise. * scaffold/tests/78-union-struct.c: Likewise. * scaffold/tests/79-int-array.c: Likewise. * scaffold/tests/7a-struct-char-array.c: Likewise. * scaffold/tests/7b-struct-int-array.c: Likewise. * scaffold/tests/7c-dynarray.c: Likewise. * scaffold/tests/7d-cast-char.c: Likewise. * scaffold/tests/7e-struct-array-access.c: Likewise. * scaffold/tests/7f-struct-pointer-arithmetic.c: Likewise. * scaffold/tests/7g-struct-byte-word-field.c: Likewise. * scaffold/tests/7h-struct-assign.c: Likewise. * scaffold/tests/7i-struct-struct.c: Likewise. * scaffold/tests/7j-strtoull.c: Likewise. * scaffold/tests/7k-for-each-elem.c: Likewise. * scaffold/tests/7l-struct-any-size-array.c: Likewise. * scaffold/tests/7m-struct-char-array-assign.c: Likewise. * scaffold/tests/7n-struct-struct-array.c: Likewise. * scaffold/tests/80-setjmp.c: Likewise. * scaffold/tests/81-qsort.c: Likewise. * scaffold/tests/86-strncpy.c: Likewise. * scaffold/tests/87-sscanf.c: Likewise.
2018-08-15 16:01:14 +00:00
main ()
{
mescc: x86_64 support: Refactor to abstracted assembly, add x86_64. * module/mescc/as.scm: Support abstracted assembly. * module/mescc/i386/as.scm: Rewrite. * module/mescc/x86_64/as.scm: Implement. * module/mescc/compile.scm: Refactor to abstracted assembly. * module/mescc/M1.scm: Update for partial 64 bit support. * module/mescc/bytevectors.scm (bytevector-u64-native-set!): New procedure. * module/mescc/i386/info.scm (i386:type-alist): Use 4 byte type length also for faking double, long long, long double. * module/mescc/info.scm:modified: * module/mescc/x86_64/info.scm (x86_64:registers): New variable. * lib/x86-mes/x86.M1: Update for new register scheme. * lib/x86_64-mes/x86_64.M1: Implement. * lib/x86-mes/setjmp.c: Implement. * lib/x86_64-mes-gcc/setjmp.c: Implement. * build-aux/build-cc.sh: Update for x86_64. * build-aux/build-cc32.sh: Likewise. * build-aux/build-mes.sh: Likewise. * build-aux/build-x86_64-mes.sh: Likewise. * build-aux/check-mescc.sh: Likewise. * build-aux/test64.sh: Likewise. * include/libmes.h: Likewise. * include/setjmp.h: Likewise. * include/signal.h: Likewise. * include/stdarg.h: Likewise. * include/sys/stat.h: Likewise. * include/sys/types.h: Likewise. * include/sys/wait.h: Likewise. * include/unistd.h: Likewise. * lib/libc+gnu.c: Likewise. * lib/libc+tcc.c: Likewise. * lib/linux/gnu.c: Likewise. * lib/linux/libc-mini.c: Likewise. * lib/linux/libc.c: Likewise. * lib/linux/tcc.c: Likewise. * lib/linux/x86_64-mes-gcc/mes.c: Likewise. * lib/linux/x86_64-mes/crt1.c: Likewise. * lib/mes/abtol.c: Likewise. * lib/posix/mktemp.c: Likewise. * lib/posix/wait.c: Likewise. * lib/stdio/fopen.c: Likewise. * lib/stdio/fputc.c: Likewise. * lib/stdio/fseek.c: Likewise. * lib/stdio/printf.c: Likewise. * lib/stdio/sprintf.c: Likewise. * lib/stdio/vfprintf.c: Likewise. * lib/stdio/vsprintf.c: Likewise. * lib/stdio/vsscanf.c: Likewise. * lib/stdlib/qsort.c: Likewise. * lib/x86-mes-gcc/setjmp.c: Likewise. * scaffold/tests/11-if-1.c: Likewise. * scaffold/tests/15-if-!f.c: Likewise. * scaffold/tests/16-if-t.c: Likewise. * scaffold/tests/21-char[].c: Likewise. * scaffold/tests/23-pointer.c: Likewise. * scaffold/tests/32-compare.c: Likewise. * scaffold/tests/33-and-or.c: Likewise. * scaffold/tests/34-pre-post.c: Likewise. * scaffold/tests/35-compare-char.c: Likewise. * scaffold/tests/36-compare-arithmetic.c: Likewise. * scaffold/tests/37-compare-assign.c: Likewise. * scaffold/tests/38-compare-call.c: Likewise. * scaffold/tests/40-if-else.c: Likewise. * scaffold/tests/41-?.c: Likewise. * scaffold/tests/42-goto-label.c: Likewise. * scaffold/tests/43-for-do-while.c: Likewise. * scaffold/tests/44-switch.c: Likewise. * scaffold/tests/45-void-call.c: Likewise. * scaffold/tests/46-function-static.c: Likewise. * scaffold/tests/51-strcmp.c: Likewise. * scaffold/tests/51-strncmp.c: Likewise. * scaffold/tests/53-strcpy.c: Likewise. * scaffold/tests/54-argv.c: Likewise. * scaffold/tests/60-math.c: Likewise. * scaffold/tests/61-array.c: Likewise. * scaffold/tests/63-struct-cell.c: Likewise. * scaffold/tests/64-make-cell.c: Likewise. * scaffold/tests/65-read.c: Likewise. * scaffold/tests/70-printf.c: Likewise. * scaffold/tests/71-struct-array.c: Likewise. * scaffold/tests/72-typedef-struct-def.c: Likewise. * scaffold/tests/74-multi-line-string.c: Likewise. * scaffold/tests/76-pointer-arithmetic.c: Likewise. * scaffold/tests/79-int-array.c: Likewise. * scaffold/tests/7a-struct-char-array.c: Likewise. * scaffold/tests/7b-struct-int-array.c: Likewise. * scaffold/tests/7i-struct-struct.c: Likewise. * scaffold/tests/7k-for-each-elem.c: Likewise. * scaffold/tests/7l-struct-any-size-array.c: Likewise. * scaffold/tests/7o-struct-pre-post.c: Likewise. * scaffold/tests/7q-bit-field.c: Likewise. * scaffold/tests/7s-struct-short.c: Likewise. * scaffold/tests/80-setjmp.c: Likewise. * scaffold/tests/81-qsort.c: Likewise. * scaffold/tests/85-sizeof.c: Likewise. * scaffold/tests/87-sscanf.c: Likewise. * scaffold/tests/90-strpbrk.c: Likewise. * scaffold/tests/91-fseek.c: Likewise. * scaffold/tests/95-signal.c: Likewise. * scaffold/tests/97-fopen.c: Likewise. * scaffold/tests/99-readdir.c: Likewise. * scaffold/tests/t.c: Likewise. * lib/linux/x86_64-mes/mes.c: New file. * lib/linux/x86_64-mes/mini.c: New file. * lib/x86_64-mes/setjmp.c: New file. * scaffold/tests/06-!call-1.c: New file. * scaffold/tests/06-call-2.c: New file. * scaffold/tests/06-call-variable.c: New file. * scaffold/tests/08-assign-global.c: New file. * scaffold/tests/08-assign-negative.c: New file. * scaffold/tests/17-compare-and-or.c: New file. * scaffold/tests/17-compare-and.c: New file. * scaffold/tests/17-compare-ge.c: New file. * scaffold/tests/17-compare-gt.c: New file. * scaffold/tests/17-compare-le.c: New file. * scaffold/tests/17-compare-lt.c: New file. * scaffold/tests/17-compare-or.c: New file. * scaffold/tests/17-compare-unsigned-ge.c: New file. * scaffold/tests/17-compare-unsigned-gt.c: New file. * scaffold/tests/17-compare-unsigned-le.c: New file. * scaffold/tests/17-compare-unsigned-lt.c: New file. * scaffold/tests/21-char[]-simple.c: New file. * scaffold/tests/23-global-pointer-init-null.c: New file. * scaffold/tests/23-global-pointer-init.c: New file. * scaffold/tests/23-global-pointer-pointer-ref.c: New file. * scaffold/tests/23-global-pointer-ref.c: New file. * scaffold/tests/23-pointer-sub.c: New file. * scaffold/tests/31-oputs.c: New file. * scaffold/tests/32-call-wrap.c: New file. * scaffold/tests/38-compare-call-2.c: New file. * scaffold/tests/38-compare-call-3.c: New file. * scaffold/tests/51-pointer-sub.c: New file. * scaffold/tests/54-argc.c: New file. * scaffold/tests/63-struct-array-assign.c: New file. * scaffold/tests/63-struct-array-compare.c: New file. * scaffold/tests/63-struct-array.c: New file. * scaffold/tests/63-struct-assign.c: New file. * scaffold/tests/63-struct-function.c: New file. * scaffold/tests/63-struct-local.c: New file. * scaffold/tests/63-struct-pointer.c: New file. * scaffold/tests/63-struct.c: New file. * scaffold/tests/70-printf-hello.c: New file. * scaffold/tests/70-printf-simple.c: New file. * scaffold/tests/70-stdarg.c: New file. * scaffold/tests/70-strchr.c: New file. * scaffold/tests/73-union-hello.c: New file. * scaffold/tests/76-pointer-arithmetic-pp.c: New file. * scaffold/tests/79-int-array-simple.c: New file. * scaffold/tests/7b-struct-int-array-hello.c: New file. * scaffold/tests/7b-struct-int-array-pointer.c: New file. * scaffold/tests/7i-struct-struct-simple.c: New file. * scaffold/tests/7k-for-each-elem-simple.c: New file. * scaffold/tests/7l-struct-any-size-array-simple.c: New file. * scaffold/tests/7o-struct-pre-post-simple.c: New file. * scaffold/tests/7q-bit-field-simple.c: New file. * scaffold/tests/90-strspn.c: New file. * scaffold/tests/06-call-string.c.: Rename from 31-eputs.c. * scaffold/tests/7t-function-destruct.c: Rename from 48-function-destruct.c. * scaffold/tests/48-global-static.c: Rename from 49-global-static.c. * scaffold/tests/55-char-array.c:renamed: Rename from 4a-char-array.c. * scaffold/tests/51-itoa.c:r Rename from 52-itoa.c. * include/signal.h:(struct sigaction):
2018-08-15 16:26:55 +00:00
#if __GNUC__ && __x86_64__
return 0;
#endif
test: Split-up Mescc scaffold test. * make.scm (check-scaffold, check-scaffold-tests): New targets. * mlibc/include/00-test.i: New file. * mlibc/include/30-test.i: New file. * mlibc/mini-libc-mes.c (puts): New function. * scaffold/tests/00-exit-0.c: : New file. * scaffold/tests/01-return-0.c: : New file. * scaffold/tests/02-return-1.c: : New file. * scaffold/tests/03-call.c: : New file. * scaffold/tests/04-call-0.c: : New file. * scaffold/tests/05-call-1.c: : New file. * scaffold/tests/06-call-!1.c: : New file. * scaffold/tests/10-if-0.c: : New file. * scaffold/tests/11-if-1.c: : New file. * scaffold/tests/12-if-==.c: : New file. * scaffold/tests/13-if-!=.c: : New file. * scaffold/tests/14-if-goto.c: : New file. * scaffold/tests/15-if-!f.c: : New file. * scaffold/tests/16-if-t.c: : New file. * scaffold/tests/20-while.c: : New file. * scaffold/tests/21-char[].c: : New file. * scaffold/tests/22-while-char[].c: : New file. * scaffold/tests/30-strlen.c: : New file. * scaffold/tests/31-eputs.c: : New file. * scaffold/tests/32-compare.c: : New file. * scaffold/tests/33-and-or.c: : New file. * scaffold/tests/34-pre-post.c: : New file. * scaffold/tests/35-compare-char.c: : New file. * scaffold/tests/36-compare-arithmetic.c: : New file. * scaffold/tests/37-compare-assign.c: : New file. * scaffold/tests/38-compare-call.c: : New file. * scaffold/tests/40-if-else.c: : New file. * scaffold/tests/41-?.c: : New file. * scaffold/tests/42-goto-label.c: : New file. * scaffold/tests/43-for-do-while.c: : New file. * scaffold/tests/44-switch.c: : New file. * scaffold/tests/45-void-call.c: : New file. * scaffold/tests/50-assert.c: : New file. * scaffold/tests/51-strcmp.c: : New file. * scaffold/tests/52-itoa.c: : New file. * scaffold/tests/53-strcpy.c: : New file. * scaffold/tests/54-argv.c: : New file. * scaffold/tests/60-math.c: : New file. * scaffold/tests/61-array.c: : New file. * scaffold/tests/63-struct-cell.c: : New file. * scaffold/tests/64-make-cell.c: : New file. * scaffold/tests/65-read.c: : New file. * scaffold/tests/66-struct-array.c: : New file. * scaffold/t.c: Remove. * scaffold/t-tcc.c: Remove.
2017-07-09 07:24:07 +00:00
char *s = "mes";
char c = 'm';
int i = 3;
char buf[20];
test: Split-up Mescc scaffold test. * make.scm (check-scaffold, check-scaffold-tests): New targets. * mlibc/include/00-test.i: New file. * mlibc/include/30-test.i: New file. * mlibc/mini-libc-mes.c (puts): New function. * scaffold/tests/00-exit-0.c: : New file. * scaffold/tests/01-return-0.c: : New file. * scaffold/tests/02-return-1.c: : New file. * scaffold/tests/03-call.c: : New file. * scaffold/tests/04-call-0.c: : New file. * scaffold/tests/05-call-1.c: : New file. * scaffold/tests/06-call-!1.c: : New file. * scaffold/tests/10-if-0.c: : New file. * scaffold/tests/11-if-1.c: : New file. * scaffold/tests/12-if-==.c: : New file. * scaffold/tests/13-if-!=.c: : New file. * scaffold/tests/14-if-goto.c: : New file. * scaffold/tests/15-if-!f.c: : New file. * scaffold/tests/16-if-t.c: : New file. * scaffold/tests/20-while.c: : New file. * scaffold/tests/21-char[].c: : New file. * scaffold/tests/22-while-char[].c: : New file. * scaffold/tests/30-strlen.c: : New file. * scaffold/tests/31-eputs.c: : New file. * scaffold/tests/32-compare.c: : New file. * scaffold/tests/33-and-or.c: : New file. * scaffold/tests/34-pre-post.c: : New file. * scaffold/tests/35-compare-char.c: : New file. * scaffold/tests/36-compare-arithmetic.c: : New file. * scaffold/tests/37-compare-assign.c: : New file. * scaffold/tests/38-compare-call.c: : New file. * scaffold/tests/40-if-else.c: : New file. * scaffold/tests/41-?.c: : New file. * scaffold/tests/42-goto-label.c: : New file. * scaffold/tests/43-for-do-while.c: : New file. * scaffold/tests/44-switch.c: : New file. * scaffold/tests/45-void-call.c: : New file. * scaffold/tests/50-assert.c: : New file. * scaffold/tests/51-strcmp.c: : New file. * scaffold/tests/52-itoa.c: : New file. * scaffold/tests/53-strcpy.c: : New file. * scaffold/tests/54-argv.c: : New file. * scaffold/tests/60-math.c: : New file. * scaffold/tests/61-array.c: : New file. * scaffold/tests/63-struct-cell.c: : New file. * scaffold/tests/64-make-cell.c: : New file. * scaffold/tests/65-read.c: : New file. * scaffold/tests/66-struct-array.c: : New file. * scaffold/t.c: Remove. * scaffold/t-tcc.c: Remove.
2017-07-09 07:24:07 +00:00
printf ("c=%c\n", c);
sprintf (buf, "c=%c\n", c);
if (strcmp (buf, "c=m\n"))
return 1;
test: Split-up Mescc scaffold test. * make.scm (check-scaffold, check-scaffold-tests): New targets. * mlibc/include/00-test.i: New file. * mlibc/include/30-test.i: New file. * mlibc/mini-libc-mes.c (puts): New function. * scaffold/tests/00-exit-0.c: : New file. * scaffold/tests/01-return-0.c: : New file. * scaffold/tests/02-return-1.c: : New file. * scaffold/tests/03-call.c: : New file. * scaffold/tests/04-call-0.c: : New file. * scaffold/tests/05-call-1.c: : New file. * scaffold/tests/06-call-!1.c: : New file. * scaffold/tests/10-if-0.c: : New file. * scaffold/tests/11-if-1.c: : New file. * scaffold/tests/12-if-==.c: : New file. * scaffold/tests/13-if-!=.c: : New file. * scaffold/tests/14-if-goto.c: : New file. * scaffold/tests/15-if-!f.c: : New file. * scaffold/tests/16-if-t.c: : New file. * scaffold/tests/20-while.c: : New file. * scaffold/tests/21-char[].c: : New file. * scaffold/tests/22-while-char[].c: : New file. * scaffold/tests/30-strlen.c: : New file. * scaffold/tests/31-eputs.c: : New file. * scaffold/tests/32-compare.c: : New file. * scaffold/tests/33-and-or.c: : New file. * scaffold/tests/34-pre-post.c: : New file. * scaffold/tests/35-compare-char.c: : New file. * scaffold/tests/36-compare-arithmetic.c: : New file. * scaffold/tests/37-compare-assign.c: : New file. * scaffold/tests/38-compare-call.c: : New file. * scaffold/tests/40-if-else.c: : New file. * scaffold/tests/41-?.c: : New file. * scaffold/tests/42-goto-label.c: : New file. * scaffold/tests/43-for-do-while.c: : New file. * scaffold/tests/44-switch.c: : New file. * scaffold/tests/45-void-call.c: : New file. * scaffold/tests/50-assert.c: : New file. * scaffold/tests/51-strcmp.c: : New file. * scaffold/tests/52-itoa.c: : New file. * scaffold/tests/53-strcpy.c: : New file. * scaffold/tests/54-argv.c: : New file. * scaffold/tests/60-math.c: : New file. * scaffold/tests/61-array.c: : New file. * scaffold/tests/63-struct-cell.c: : New file. * scaffold/tests/64-make-cell.c: : New file. * scaffold/tests/65-read.c: : New file. * scaffold/tests/66-struct-array.c: : New file. * scaffold/t.c: Remove. * scaffold/t-tcc.c: Remove.
2017-07-09 07:24:07 +00:00
mescc: x86_64 support: Refactor to abstracted assembly, add x86_64. * module/mescc/as.scm: Support abstracted assembly. * module/mescc/i386/as.scm: Rewrite. * module/mescc/x86_64/as.scm: Implement. * module/mescc/compile.scm: Refactor to abstracted assembly. * module/mescc/M1.scm: Update for partial 64 bit support. * module/mescc/bytevectors.scm (bytevector-u64-native-set!): New procedure. * module/mescc/i386/info.scm (i386:type-alist): Use 4 byte type length also for faking double, long long, long double. * module/mescc/info.scm:modified: * module/mescc/x86_64/info.scm (x86_64:registers): New variable. * lib/x86-mes/x86.M1: Update for new register scheme. * lib/x86_64-mes/x86_64.M1: Implement. * lib/x86-mes/setjmp.c: Implement. * lib/x86_64-mes-gcc/setjmp.c: Implement. * build-aux/build-cc.sh: Update for x86_64. * build-aux/build-cc32.sh: Likewise. * build-aux/build-mes.sh: Likewise. * build-aux/build-x86_64-mes.sh: Likewise. * build-aux/check-mescc.sh: Likewise. * build-aux/test64.sh: Likewise. * include/libmes.h: Likewise. * include/setjmp.h: Likewise. * include/signal.h: Likewise. * include/stdarg.h: Likewise. * include/sys/stat.h: Likewise. * include/sys/types.h: Likewise. * include/sys/wait.h: Likewise. * include/unistd.h: Likewise. * lib/libc+gnu.c: Likewise. * lib/libc+tcc.c: Likewise. * lib/linux/gnu.c: Likewise. * lib/linux/libc-mini.c: Likewise. * lib/linux/libc.c: Likewise. * lib/linux/tcc.c: Likewise. * lib/linux/x86_64-mes-gcc/mes.c: Likewise. * lib/linux/x86_64-mes/crt1.c: Likewise. * lib/mes/abtol.c: Likewise. * lib/posix/mktemp.c: Likewise. * lib/posix/wait.c: Likewise. * lib/stdio/fopen.c: Likewise. * lib/stdio/fputc.c: Likewise. * lib/stdio/fseek.c: Likewise. * lib/stdio/printf.c: Likewise. * lib/stdio/sprintf.c: Likewise. * lib/stdio/vfprintf.c: Likewise. * lib/stdio/vsprintf.c: Likewise. * lib/stdio/vsscanf.c: Likewise. * lib/stdlib/qsort.c: Likewise. * lib/x86-mes-gcc/setjmp.c: Likewise. * scaffold/tests/11-if-1.c: Likewise. * scaffold/tests/15-if-!f.c: Likewise. * scaffold/tests/16-if-t.c: Likewise. * scaffold/tests/21-char[].c: Likewise. * scaffold/tests/23-pointer.c: Likewise. * scaffold/tests/32-compare.c: Likewise. * scaffold/tests/33-and-or.c: Likewise. * scaffold/tests/34-pre-post.c: Likewise. * scaffold/tests/35-compare-char.c: Likewise. * scaffold/tests/36-compare-arithmetic.c: Likewise. * scaffold/tests/37-compare-assign.c: Likewise. * scaffold/tests/38-compare-call.c: Likewise. * scaffold/tests/40-if-else.c: Likewise. * scaffold/tests/41-?.c: Likewise. * scaffold/tests/42-goto-label.c: Likewise. * scaffold/tests/43-for-do-while.c: Likewise. * scaffold/tests/44-switch.c: Likewise. * scaffold/tests/45-void-call.c: Likewise. * scaffold/tests/46-function-static.c: Likewise. * scaffold/tests/51-strcmp.c: Likewise. * scaffold/tests/51-strncmp.c: Likewise. * scaffold/tests/53-strcpy.c: Likewise. * scaffold/tests/54-argv.c: Likewise. * scaffold/tests/60-math.c: Likewise. * scaffold/tests/61-array.c: Likewise. * scaffold/tests/63-struct-cell.c: Likewise. * scaffold/tests/64-make-cell.c: Likewise. * scaffold/tests/65-read.c: Likewise. * scaffold/tests/70-printf.c: Likewise. * scaffold/tests/71-struct-array.c: Likewise. * scaffold/tests/72-typedef-struct-def.c: Likewise. * scaffold/tests/74-multi-line-string.c: Likewise. * scaffold/tests/76-pointer-arithmetic.c: Likewise. * scaffold/tests/79-int-array.c: Likewise. * scaffold/tests/7a-struct-char-array.c: Likewise. * scaffold/tests/7b-struct-int-array.c: Likewise. * scaffold/tests/7i-struct-struct.c: Likewise. * scaffold/tests/7k-for-each-elem.c: Likewise. * scaffold/tests/7l-struct-any-size-array.c: Likewise. * scaffold/tests/7o-struct-pre-post.c: Likewise. * scaffold/tests/7q-bit-field.c: Likewise. * scaffold/tests/7s-struct-short.c: Likewise. * scaffold/tests/80-setjmp.c: Likewise. * scaffold/tests/81-qsort.c: Likewise. * scaffold/tests/85-sizeof.c: Likewise. * scaffold/tests/87-sscanf.c: Likewise. * scaffold/tests/90-strpbrk.c: Likewise. * scaffold/tests/91-fseek.c: Likewise. * scaffold/tests/95-signal.c: Likewise. * scaffold/tests/97-fopen.c: Likewise. * scaffold/tests/99-readdir.c: Likewise. * scaffold/tests/t.c: Likewise. * lib/linux/x86_64-mes/mes.c: New file. * lib/linux/x86_64-mes/mini.c: New file. * lib/x86_64-mes/setjmp.c: New file. * scaffold/tests/06-!call-1.c: New file. * scaffold/tests/06-call-2.c: New file. * scaffold/tests/06-call-variable.c: New file. * scaffold/tests/08-assign-global.c: New file. * scaffold/tests/08-assign-negative.c: New file. * scaffold/tests/17-compare-and-or.c: New file. * scaffold/tests/17-compare-and.c: New file. * scaffold/tests/17-compare-ge.c: New file. * scaffold/tests/17-compare-gt.c: New file. * scaffold/tests/17-compare-le.c: New file. * scaffold/tests/17-compare-lt.c: New file. * scaffold/tests/17-compare-or.c: New file. * scaffold/tests/17-compare-unsigned-ge.c: New file. * scaffold/tests/17-compare-unsigned-gt.c: New file. * scaffold/tests/17-compare-unsigned-le.c: New file. * scaffold/tests/17-compare-unsigned-lt.c: New file. * scaffold/tests/21-char[]-simple.c: New file. * scaffold/tests/23-global-pointer-init-null.c: New file. * scaffold/tests/23-global-pointer-init.c: New file. * scaffold/tests/23-global-pointer-pointer-ref.c: New file. * scaffold/tests/23-global-pointer-ref.c: New file. * scaffold/tests/23-pointer-sub.c: New file. * scaffold/tests/31-oputs.c: New file. * scaffold/tests/32-call-wrap.c: New file. * scaffold/tests/38-compare-call-2.c: New file. * scaffold/tests/38-compare-call-3.c: New file. * scaffold/tests/51-pointer-sub.c: New file. * scaffold/tests/54-argc.c: New file. * scaffold/tests/63-struct-array-assign.c: New file. * scaffold/tests/63-struct-array-compare.c: New file. * scaffold/tests/63-struct-array.c: New file. * scaffold/tests/63-struct-assign.c: New file. * scaffold/tests/63-struct-function.c: New file. * scaffold/tests/63-struct-local.c: New file. * scaffold/tests/63-struct-pointer.c: New file. * scaffold/tests/63-struct.c: New file. * scaffold/tests/70-printf-hello.c: New file. * scaffold/tests/70-printf-simple.c: New file. * scaffold/tests/70-stdarg.c: New file. * scaffold/tests/70-strchr.c: New file. * scaffold/tests/73-union-hello.c: New file. * scaffold/tests/76-pointer-arithmetic-pp.c: New file. * scaffold/tests/79-int-array-simple.c: New file. * scaffold/tests/7b-struct-int-array-hello.c: New file. * scaffold/tests/7b-struct-int-array-pointer.c: New file. * scaffold/tests/7i-struct-struct-simple.c: New file. * scaffold/tests/7k-for-each-elem-simple.c: New file. * scaffold/tests/7l-struct-any-size-array-simple.c: New file. * scaffold/tests/7o-struct-pre-post-simple.c: New file. * scaffold/tests/7q-bit-field-simple.c: New file. * scaffold/tests/90-strspn.c: New file. * scaffold/tests/06-call-string.c.: Rename from 31-eputs.c. * scaffold/tests/7t-function-destruct.c: Rename from 48-function-destruct.c. * scaffold/tests/48-global-static.c: Rename from 49-global-static.c. * scaffold/tests/55-char-array.c:renamed: Rename from 4a-char-array.c. * scaffold/tests/51-itoa.c:r Rename from 52-itoa.c. * include/signal.h:(struct sigaction):
2018-08-15 16:26:55 +00:00
if (i != 3)
return 15;
test: Split-up Mescc scaffold test. * make.scm (check-scaffold, check-scaffold-tests): New targets. * mlibc/include/00-test.i: New file. * mlibc/include/30-test.i: New file. * mlibc/mini-libc-mes.c (puts): New function. * scaffold/tests/00-exit-0.c: : New file. * scaffold/tests/01-return-0.c: : New file. * scaffold/tests/02-return-1.c: : New file. * scaffold/tests/03-call.c: : New file. * scaffold/tests/04-call-0.c: : New file. * scaffold/tests/05-call-1.c: : New file. * scaffold/tests/06-call-!1.c: : New file. * scaffold/tests/10-if-0.c: : New file. * scaffold/tests/11-if-1.c: : New file. * scaffold/tests/12-if-==.c: : New file. * scaffold/tests/13-if-!=.c: : New file. * scaffold/tests/14-if-goto.c: : New file. * scaffold/tests/15-if-!f.c: : New file. * scaffold/tests/16-if-t.c: : New file. * scaffold/tests/20-while.c: : New file. * scaffold/tests/21-char[].c: : New file. * scaffold/tests/22-while-char[].c: : New file. * scaffold/tests/30-strlen.c: : New file. * scaffold/tests/31-eputs.c: : New file. * scaffold/tests/32-compare.c: : New file. * scaffold/tests/33-and-or.c: : New file. * scaffold/tests/34-pre-post.c: : New file. * scaffold/tests/35-compare-char.c: : New file. * scaffold/tests/36-compare-arithmetic.c: : New file. * scaffold/tests/37-compare-assign.c: : New file. * scaffold/tests/38-compare-call.c: : New file. * scaffold/tests/40-if-else.c: : New file. * scaffold/tests/41-?.c: : New file. * scaffold/tests/42-goto-label.c: : New file. * scaffold/tests/43-for-do-while.c: : New file. * scaffold/tests/44-switch.c: : New file. * scaffold/tests/45-void-call.c: : New file. * scaffold/tests/50-assert.c: : New file. * scaffold/tests/51-strcmp.c: : New file. * scaffold/tests/52-itoa.c: : New file. * scaffold/tests/53-strcpy.c: : New file. * scaffold/tests/54-argv.c: : New file. * scaffold/tests/60-math.c: : New file. * scaffold/tests/61-array.c: : New file. * scaffold/tests/63-struct-cell.c: : New file. * scaffold/tests/64-make-cell.c: : New file. * scaffold/tests/65-read.c: : New file. * scaffold/tests/66-struct-array.c: : New file. * scaffold/t.c: Remove. * scaffold/t-tcc.c: Remove.
2017-07-09 07:24:07 +00:00
printf ("i=%d\n", i);
sprintf (buf, "i=%d\n", i);
if (strcmp (buf, "i=3\n"))
return 2;
test: Split-up Mescc scaffold test. * make.scm (check-scaffold, check-scaffold-tests): New targets. * mlibc/include/00-test.i: New file. * mlibc/include/30-test.i: New file. * mlibc/mini-libc-mes.c (puts): New function. * scaffold/tests/00-exit-0.c: : New file. * scaffold/tests/01-return-0.c: : New file. * scaffold/tests/02-return-1.c: : New file. * scaffold/tests/03-call.c: : New file. * scaffold/tests/04-call-0.c: : New file. * scaffold/tests/05-call-1.c: : New file. * scaffold/tests/06-call-!1.c: : New file. * scaffold/tests/10-if-0.c: : New file. * scaffold/tests/11-if-1.c: : New file. * scaffold/tests/12-if-==.c: : New file. * scaffold/tests/13-if-!=.c: : New file. * scaffold/tests/14-if-goto.c: : New file. * scaffold/tests/15-if-!f.c: : New file. * scaffold/tests/16-if-t.c: : New file. * scaffold/tests/20-while.c: : New file. * scaffold/tests/21-char[].c: : New file. * scaffold/tests/22-while-char[].c: : New file. * scaffold/tests/30-strlen.c: : New file. * scaffold/tests/31-eputs.c: : New file. * scaffold/tests/32-compare.c: : New file. * scaffold/tests/33-and-or.c: : New file. * scaffold/tests/34-pre-post.c: : New file. * scaffold/tests/35-compare-char.c: : New file. * scaffold/tests/36-compare-arithmetic.c: : New file. * scaffold/tests/37-compare-assign.c: : New file. * scaffold/tests/38-compare-call.c: : New file. * scaffold/tests/40-if-else.c: : New file. * scaffold/tests/41-?.c: : New file. * scaffold/tests/42-goto-label.c: : New file. * scaffold/tests/43-for-do-while.c: : New file. * scaffold/tests/44-switch.c: : New file. * scaffold/tests/45-void-call.c: : New file. * scaffold/tests/50-assert.c: : New file. * scaffold/tests/51-strcmp.c: : New file. * scaffold/tests/52-itoa.c: : New file. * scaffold/tests/53-strcpy.c: : New file. * scaffold/tests/54-argv.c: : New file. * scaffold/tests/60-math.c: : New file. * scaffold/tests/61-array.c: : New file. * scaffold/tests/63-struct-cell.c: : New file. * scaffold/tests/64-make-cell.c: : New file. * scaffold/tests/65-read.c: : New file. * scaffold/tests/66-struct-array.c: : New file. * scaffold/t.c: Remove. * scaffold/t-tcc.c: Remove.
2017-07-09 07:24:07 +00:00
printf ("s=%s\n", s);
sprintf (buf, "s=%s\n", s);
if (strcmp (buf, "s=mes\n"))
return 3;
sprintf (buf, ">%3d<", 11);
eputs (buf); eputs ("\n");
if (strcmp (buf, "> 11<"))
return 4;
sprintf (buf, ">%03d<", 22);
eputs (buf); eputs ("\n");
if (strcmp (buf, ">022<"))
return 5;
sprintf (buf, ">%-10d<", 33);
eputs (buf); eputs ("\n");
if (strcmp (buf, ">33 <"))
return 6;
sprintf (buf, ">%0d<", 44);
eputs (buf); eputs ("\n");
if (strcmp (buf, ">44<"))
return 7;
2018-06-02 09:41:06 +00:00
printf (">>%.*s<<\n", 5, "hello, world");
printf (">>%.*s<<\n", 20, "hello, world");
printf (">>%.*s<<\n", 10, "foo");
printf (">>%*s<<\n", 10, "bar");
printf (">>%-*s<<\n", 10, "baz");
sprintf (buf, "%ld", 42);
eputs ("buf="); eputs (buf); eputs ("\n");
if (strcmp (buf, "42"))
return 8;
sprintf (buf, "%u", -1);
eputs ("buf="); eputs (buf); eputs ("\n");
mescc: x86_64 support: Refactor to abstracted assembly, add x86_64. * module/mescc/as.scm: Support abstracted assembly. * module/mescc/i386/as.scm: Rewrite. * module/mescc/x86_64/as.scm: Implement. * module/mescc/compile.scm: Refactor to abstracted assembly. * module/mescc/M1.scm: Update for partial 64 bit support. * module/mescc/bytevectors.scm (bytevector-u64-native-set!): New procedure. * module/mescc/i386/info.scm (i386:type-alist): Use 4 byte type length also for faking double, long long, long double. * module/mescc/info.scm:modified: * module/mescc/x86_64/info.scm (x86_64:registers): New variable. * lib/x86-mes/x86.M1: Update for new register scheme. * lib/x86_64-mes/x86_64.M1: Implement. * lib/x86-mes/setjmp.c: Implement. * lib/x86_64-mes-gcc/setjmp.c: Implement. * build-aux/build-cc.sh: Update for x86_64. * build-aux/build-cc32.sh: Likewise. * build-aux/build-mes.sh: Likewise. * build-aux/build-x86_64-mes.sh: Likewise. * build-aux/check-mescc.sh: Likewise. * build-aux/test64.sh: Likewise. * include/libmes.h: Likewise. * include/setjmp.h: Likewise. * include/signal.h: Likewise. * include/stdarg.h: Likewise. * include/sys/stat.h: Likewise. * include/sys/types.h: Likewise. * include/sys/wait.h: Likewise. * include/unistd.h: Likewise. * lib/libc+gnu.c: Likewise. * lib/libc+tcc.c: Likewise. * lib/linux/gnu.c: Likewise. * lib/linux/libc-mini.c: Likewise. * lib/linux/libc.c: Likewise. * lib/linux/tcc.c: Likewise. * lib/linux/x86_64-mes-gcc/mes.c: Likewise. * lib/linux/x86_64-mes/crt1.c: Likewise. * lib/mes/abtol.c: Likewise. * lib/posix/mktemp.c: Likewise. * lib/posix/wait.c: Likewise. * lib/stdio/fopen.c: Likewise. * lib/stdio/fputc.c: Likewise. * lib/stdio/fseek.c: Likewise. * lib/stdio/printf.c: Likewise. * lib/stdio/sprintf.c: Likewise. * lib/stdio/vfprintf.c: Likewise. * lib/stdio/vsprintf.c: Likewise. * lib/stdio/vsscanf.c: Likewise. * lib/stdlib/qsort.c: Likewise. * lib/x86-mes-gcc/setjmp.c: Likewise. * scaffold/tests/11-if-1.c: Likewise. * scaffold/tests/15-if-!f.c: Likewise. * scaffold/tests/16-if-t.c: Likewise. * scaffold/tests/21-char[].c: Likewise. * scaffold/tests/23-pointer.c: Likewise. * scaffold/tests/32-compare.c: Likewise. * scaffold/tests/33-and-or.c: Likewise. * scaffold/tests/34-pre-post.c: Likewise. * scaffold/tests/35-compare-char.c: Likewise. * scaffold/tests/36-compare-arithmetic.c: Likewise. * scaffold/tests/37-compare-assign.c: Likewise. * scaffold/tests/38-compare-call.c: Likewise. * scaffold/tests/40-if-else.c: Likewise. * scaffold/tests/41-?.c: Likewise. * scaffold/tests/42-goto-label.c: Likewise. * scaffold/tests/43-for-do-while.c: Likewise. * scaffold/tests/44-switch.c: Likewise. * scaffold/tests/45-void-call.c: Likewise. * scaffold/tests/46-function-static.c: Likewise. * scaffold/tests/51-strcmp.c: Likewise. * scaffold/tests/51-strncmp.c: Likewise. * scaffold/tests/53-strcpy.c: Likewise. * scaffold/tests/54-argv.c: Likewise. * scaffold/tests/60-math.c: Likewise. * scaffold/tests/61-array.c: Likewise. * scaffold/tests/63-struct-cell.c: Likewise. * scaffold/tests/64-make-cell.c: Likewise. * scaffold/tests/65-read.c: Likewise. * scaffold/tests/70-printf.c: Likewise. * scaffold/tests/71-struct-array.c: Likewise. * scaffold/tests/72-typedef-struct-def.c: Likewise. * scaffold/tests/74-multi-line-string.c: Likewise. * scaffold/tests/76-pointer-arithmetic.c: Likewise. * scaffold/tests/79-int-array.c: Likewise. * scaffold/tests/7a-struct-char-array.c: Likewise. * scaffold/tests/7b-struct-int-array.c: Likewise. * scaffold/tests/7i-struct-struct.c: Likewise. * scaffold/tests/7k-for-each-elem.c: Likewise. * scaffold/tests/7l-struct-any-size-array.c: Likewise. * scaffold/tests/7o-struct-pre-post.c: Likewise. * scaffold/tests/7q-bit-field.c: Likewise. * scaffold/tests/7s-struct-short.c: Likewise. * scaffold/tests/80-setjmp.c: Likewise. * scaffold/tests/81-qsort.c: Likewise. * scaffold/tests/85-sizeof.c: Likewise. * scaffold/tests/87-sscanf.c: Likewise. * scaffold/tests/90-strpbrk.c: Likewise. * scaffold/tests/91-fseek.c: Likewise. * scaffold/tests/95-signal.c: Likewise. * scaffold/tests/97-fopen.c: Likewise. * scaffold/tests/99-readdir.c: Likewise. * scaffold/tests/t.c: Likewise. * lib/linux/x86_64-mes/mes.c: New file. * lib/linux/x86_64-mes/mini.c: New file. * lib/x86_64-mes/setjmp.c: New file. * scaffold/tests/06-!call-1.c: New file. * scaffold/tests/06-call-2.c: New file. * scaffold/tests/06-call-variable.c: New file. * scaffold/tests/08-assign-global.c: New file. * scaffold/tests/08-assign-negative.c: New file. * scaffold/tests/17-compare-and-or.c: New file. * scaffold/tests/17-compare-and.c: New file. * scaffold/tests/17-compare-ge.c: New file. * scaffold/tests/17-compare-gt.c: New file. * scaffold/tests/17-compare-le.c: New file. * scaffold/tests/17-compare-lt.c: New file. * scaffold/tests/17-compare-or.c: New file. * scaffold/tests/17-compare-unsigned-ge.c: New file. * scaffold/tests/17-compare-unsigned-gt.c: New file. * scaffold/tests/17-compare-unsigned-le.c: New file. * scaffold/tests/17-compare-unsigned-lt.c: New file. * scaffold/tests/21-char[]-simple.c: New file. * scaffold/tests/23-global-pointer-init-null.c: New file. * scaffold/tests/23-global-pointer-init.c: New file. * scaffold/tests/23-global-pointer-pointer-ref.c: New file. * scaffold/tests/23-global-pointer-ref.c: New file. * scaffold/tests/23-pointer-sub.c: New file. * scaffold/tests/31-oputs.c: New file. * scaffold/tests/32-call-wrap.c: New file. * scaffold/tests/38-compare-call-2.c: New file. * scaffold/tests/38-compare-call-3.c: New file. * scaffold/tests/51-pointer-sub.c: New file. * scaffold/tests/54-argc.c: New file. * scaffold/tests/63-struct-array-assign.c: New file. * scaffold/tests/63-struct-array-compare.c: New file. * scaffold/tests/63-struct-array.c: New file. * scaffold/tests/63-struct-assign.c: New file. * scaffold/tests/63-struct-function.c: New file. * scaffold/tests/63-struct-local.c: New file. * scaffold/tests/63-struct-pointer.c: New file. * scaffold/tests/63-struct.c: New file. * scaffold/tests/70-printf-hello.c: New file. * scaffold/tests/70-printf-simple.c: New file. * scaffold/tests/70-stdarg.c: New file. * scaffold/tests/70-strchr.c: New file. * scaffold/tests/73-union-hello.c: New file. * scaffold/tests/76-pointer-arithmetic-pp.c: New file. * scaffold/tests/79-int-array-simple.c: New file. * scaffold/tests/7b-struct-int-array-hello.c: New file. * scaffold/tests/7b-struct-int-array-pointer.c: New file. * scaffold/tests/7i-struct-struct-simple.c: New file. * scaffold/tests/7k-for-each-elem-simple.c: New file. * scaffold/tests/7l-struct-any-size-array-simple.c: New file. * scaffold/tests/7o-struct-pre-post-simple.c: New file. * scaffold/tests/7q-bit-field-simple.c: New file. * scaffold/tests/90-strspn.c: New file. * scaffold/tests/06-call-string.c.: Rename from 31-eputs.c. * scaffold/tests/7t-function-destruct.c: Rename from 48-function-destruct.c. * scaffold/tests/48-global-static.c: Rename from 49-global-static.c. * scaffold/tests/55-char-array.c:renamed: Rename from 4a-char-array.c. * scaffold/tests/51-itoa.c:r Rename from 52-itoa.c. * include/signal.h:(struct sigaction):
2018-08-15 16:26:55 +00:00
#if __i386__
2018-06-02 09:41:06 +00:00
if (strcmp (buf, "4294967295"))
return 9;
mescc: x86_64 support: Refactor to abstracted assembly, add x86_64. * module/mescc/as.scm: Support abstracted assembly. * module/mescc/i386/as.scm: Rewrite. * module/mescc/x86_64/as.scm: Implement. * module/mescc/compile.scm: Refactor to abstracted assembly. * module/mescc/M1.scm: Update for partial 64 bit support. * module/mescc/bytevectors.scm (bytevector-u64-native-set!): New procedure. * module/mescc/i386/info.scm (i386:type-alist): Use 4 byte type length also for faking double, long long, long double. * module/mescc/info.scm:modified: * module/mescc/x86_64/info.scm (x86_64:registers): New variable. * lib/x86-mes/x86.M1: Update for new register scheme. * lib/x86_64-mes/x86_64.M1: Implement. * lib/x86-mes/setjmp.c: Implement. * lib/x86_64-mes-gcc/setjmp.c: Implement. * build-aux/build-cc.sh: Update for x86_64. * build-aux/build-cc32.sh: Likewise. * build-aux/build-mes.sh: Likewise. * build-aux/build-x86_64-mes.sh: Likewise. * build-aux/check-mescc.sh: Likewise. * build-aux/test64.sh: Likewise. * include/libmes.h: Likewise. * include/setjmp.h: Likewise. * include/signal.h: Likewise. * include/stdarg.h: Likewise. * include/sys/stat.h: Likewise. * include/sys/types.h: Likewise. * include/sys/wait.h: Likewise. * include/unistd.h: Likewise. * lib/libc+gnu.c: Likewise. * lib/libc+tcc.c: Likewise. * lib/linux/gnu.c: Likewise. * lib/linux/libc-mini.c: Likewise. * lib/linux/libc.c: Likewise. * lib/linux/tcc.c: Likewise. * lib/linux/x86_64-mes-gcc/mes.c: Likewise. * lib/linux/x86_64-mes/crt1.c: Likewise. * lib/mes/abtol.c: Likewise. * lib/posix/mktemp.c: Likewise. * lib/posix/wait.c: Likewise. * lib/stdio/fopen.c: Likewise. * lib/stdio/fputc.c: Likewise. * lib/stdio/fseek.c: Likewise. * lib/stdio/printf.c: Likewise. * lib/stdio/sprintf.c: Likewise. * lib/stdio/vfprintf.c: Likewise. * lib/stdio/vsprintf.c: Likewise. * lib/stdio/vsscanf.c: Likewise. * lib/stdlib/qsort.c: Likewise. * lib/x86-mes-gcc/setjmp.c: Likewise. * scaffold/tests/11-if-1.c: Likewise. * scaffold/tests/15-if-!f.c: Likewise. * scaffold/tests/16-if-t.c: Likewise. * scaffold/tests/21-char[].c: Likewise. * scaffold/tests/23-pointer.c: Likewise. * scaffold/tests/32-compare.c: Likewise. * scaffold/tests/33-and-or.c: Likewise. * scaffold/tests/34-pre-post.c: Likewise. * scaffold/tests/35-compare-char.c: Likewise. * scaffold/tests/36-compare-arithmetic.c: Likewise. * scaffold/tests/37-compare-assign.c: Likewise. * scaffold/tests/38-compare-call.c: Likewise. * scaffold/tests/40-if-else.c: Likewise. * scaffold/tests/41-?.c: Likewise. * scaffold/tests/42-goto-label.c: Likewise. * scaffold/tests/43-for-do-while.c: Likewise. * scaffold/tests/44-switch.c: Likewise. * scaffold/tests/45-void-call.c: Likewise. * scaffold/tests/46-function-static.c: Likewise. * scaffold/tests/51-strcmp.c: Likewise. * scaffold/tests/51-strncmp.c: Likewise. * scaffold/tests/53-strcpy.c: Likewise. * scaffold/tests/54-argv.c: Likewise. * scaffold/tests/60-math.c: Likewise. * scaffold/tests/61-array.c: Likewise. * scaffold/tests/63-struct-cell.c: Likewise. * scaffold/tests/64-make-cell.c: Likewise. * scaffold/tests/65-read.c: Likewise. * scaffold/tests/70-printf.c: Likewise. * scaffold/tests/71-struct-array.c: Likewise. * scaffold/tests/72-typedef-struct-def.c: Likewise. * scaffold/tests/74-multi-line-string.c: Likewise. * scaffold/tests/76-pointer-arithmetic.c: Likewise. * scaffold/tests/79-int-array.c: Likewise. * scaffold/tests/7a-struct-char-array.c: Likewise. * scaffold/tests/7b-struct-int-array.c: Likewise. * scaffold/tests/7i-struct-struct.c: Likewise. * scaffold/tests/7k-for-each-elem.c: Likewise. * scaffold/tests/7l-struct-any-size-array.c: Likewise. * scaffold/tests/7o-struct-pre-post.c: Likewise. * scaffold/tests/7q-bit-field.c: Likewise. * scaffold/tests/7s-struct-short.c: Likewise. * scaffold/tests/80-setjmp.c: Likewise. * scaffold/tests/81-qsort.c: Likewise. * scaffold/tests/85-sizeof.c: Likewise. * scaffold/tests/87-sscanf.c: Likewise. * scaffold/tests/90-strpbrk.c: Likewise. * scaffold/tests/91-fseek.c: Likewise. * scaffold/tests/95-signal.c: Likewise. * scaffold/tests/97-fopen.c: Likewise. * scaffold/tests/99-readdir.c: Likewise. * scaffold/tests/t.c: Likewise. * lib/linux/x86_64-mes/mes.c: New file. * lib/linux/x86_64-mes/mini.c: New file. * lib/x86_64-mes/setjmp.c: New file. * scaffold/tests/06-!call-1.c: New file. * scaffold/tests/06-call-2.c: New file. * scaffold/tests/06-call-variable.c: New file. * scaffold/tests/08-assign-global.c: New file. * scaffold/tests/08-assign-negative.c: New file. * scaffold/tests/17-compare-and-or.c: New file. * scaffold/tests/17-compare-and.c: New file. * scaffold/tests/17-compare-ge.c: New file. * scaffold/tests/17-compare-gt.c: New file. * scaffold/tests/17-compare-le.c: New file. * scaffold/tests/17-compare-lt.c: New file. * scaffold/tests/17-compare-or.c: New file. * scaffold/tests/17-compare-unsigned-ge.c: New file. * scaffold/tests/17-compare-unsigned-gt.c: New file. * scaffold/tests/17-compare-unsigned-le.c: New file. * scaffold/tests/17-compare-unsigned-lt.c: New file. * scaffold/tests/21-char[]-simple.c: New file. * scaffold/tests/23-global-pointer-init-null.c: New file. * scaffold/tests/23-global-pointer-init.c: New file. * scaffold/tests/23-global-pointer-pointer-ref.c: New file. * scaffold/tests/23-global-pointer-ref.c: New file. * scaffold/tests/23-pointer-sub.c: New file. * scaffold/tests/31-oputs.c: New file. * scaffold/tests/32-call-wrap.c: New file. * scaffold/tests/38-compare-call-2.c: New file. * scaffold/tests/38-compare-call-3.c: New file. * scaffold/tests/51-pointer-sub.c: New file. * scaffold/tests/54-argc.c: New file. * scaffold/tests/63-struct-array-assign.c: New file. * scaffold/tests/63-struct-array-compare.c: New file. * scaffold/tests/63-struct-array.c: New file. * scaffold/tests/63-struct-assign.c: New file. * scaffold/tests/63-struct-function.c: New file. * scaffold/tests/63-struct-local.c: New file. * scaffold/tests/63-struct-pointer.c: New file. * scaffold/tests/63-struct.c: New file. * scaffold/tests/70-printf-hello.c: New file. * scaffold/tests/70-printf-simple.c: New file. * scaffold/tests/70-stdarg.c: New file. * scaffold/tests/70-strchr.c: New file. * scaffold/tests/73-union-hello.c: New file. * scaffold/tests/76-pointer-arithmetic-pp.c: New file. * scaffold/tests/79-int-array-simple.c: New file. * scaffold/tests/7b-struct-int-array-hello.c: New file. * scaffold/tests/7b-struct-int-array-pointer.c: New file. * scaffold/tests/7i-struct-struct-simple.c: New file. * scaffold/tests/7k-for-each-elem-simple.c: New file. * scaffold/tests/7l-struct-any-size-array-simple.c: New file. * scaffold/tests/7o-struct-pre-post-simple.c: New file. * scaffold/tests/7q-bit-field-simple.c: New file. * scaffold/tests/90-strspn.c: New file. * scaffold/tests/06-call-string.c.: Rename from 31-eputs.c. * scaffold/tests/7t-function-destruct.c: Rename from 48-function-destruct.c. * scaffold/tests/48-global-static.c: Rename from 49-global-static.c. * scaffold/tests/55-char-array.c:renamed: Rename from 4a-char-array.c. * scaffold/tests/51-itoa.c:r Rename from 52-itoa.c. * include/signal.h:(struct sigaction):
2018-08-15 16:26:55 +00:00
#elif __x86_64__
if (strcmp (buf, "18446744073709551615"))
return 9;
#endif
2018-06-02 09:41:06 +00:00
sprintf (buf, ">>%.5s<<\n", "hello, world");
eputs ("buf="); eputs (buf);
if (strcmp (buf, ">>hello<<\n"))
return 10;
sprintf (buf, ">>%.*s<<\n", 5, "hello, world");
eputs ("buf="); eputs (buf);
if (strcmp (buf, ">>hello<<\n"))
return 11;
sprintf (buf, ">>%.*s<<\n", 20, "hello, world");
eputs ("buf="); eputs (buf);
if (strcmp (buf, ">>hello, world<<\n"))
return 12;
sprintf (buf, ">>%.*s<<\n", 10, "foo");
eputs ("buf="); eputs (buf);
if (strcmp (buf, ">>foo<<\n"))
return 13;
sprintf (buf, ">>%*s<<\n", 10, "bar");
eputs ("buf="); eputs (buf);
if (strcmp (buf, ">> bar<<\n"))
return 14;
sprintf (buf, ">>%-*s<<\n", 10, "baz");
eputs ("buf="); eputs (buf);
if (strcmp (buf, ">>baz <<\n"))
return 15;
sprintf (buf, ">>%ld<<\n", 12);
eputs ("buf="); eputs (buf);
if (strcmp (buf, ">>12<<\n"))
return 16;
sprintf (buf, ">>%o<<\n", 12);
eputs ("buf="); eputs (buf);
if (strcmp (buf, ">>14<<\n"))
return 17;
sprintf (buf, ">>%x<<\n", 12);
eputs ("buf="); eputs (buf);
if (strcmp (buf, ">>c<<\n"))
return 18;
sprintf (buf, ">>%X<<\n", 12);
eputs ("buf="); eputs (buf);
if (strcmp (buf, ">>C<<\n"))
return 19;
int n;
#if !__x86_64__
fprintf (stderr, "foo bar\n%n", &n);
if (n != 8)
return 20;
#endif
sprintf (buf, "foo%nbar\n", &n);
eputs ("buf="); eputs (buf); eputs ("\n");
if (strcmp (buf, "foobar\n"))
return 21;
if (n != 3)
return 22;
#if !__x86_64__
fprintf (stdout, "%12.8d\n", 12345);
#endif
sprintf (buf, "%12.8d\n", 12345);
eputs ("buf="); eputs (buf); eputs ("\n");
if (strcmp (buf, " 00012345\n"))
return 23;
return 0;
}