Commit graph

245 commits

Author SHA1 Message Date
Jan Nieuwenhuizen 72cb975213
GNU Mes.
Throughout, make these changes

   Copyright headers: GNU Mes
   First mention of name: GNU Mes
   Website: https://www.gnu.org/software/mes
   Git:     git://git.savannah.gnu.org/mes.git
2018-07-22 14:24:36 +02:00
Jan Nieuwenhuizen 87269a16f6
core: Document number->string INT-MIN failure with gcc-x86.
* src/mes.c (scm_symbol_arch, scm_symbol_compiler): New symbol.
  (mes_symbols, bload_env): Add them.
  (scm_symbol_gnuc, scm_symbol_mesc): Remove.
* scaffold/mini-mes.c: Likewise.
* module/mes/mes-0.scm (%arch, %compiler): New public variable.
* tests/srfi-13.test: Expect number->string INT-MIN to fail for
  gcc-x86.
* HACKING (Bugs): Add it.
2018-07-21 15:20:01 +02:00
Jan Nieuwenhuizen 3429f103a4
scaffold: Add proper includes.
* scaffold/argv.c: Add proper includes.
* scaffold/malloc.c: Likewise.
* scaffold/micro-mes.c: Likewise.
* scaffold/mini-mes.c: Likewise.
* scaffold/tiny-mes.c: Likewise.
2018-07-21 10:47:05 +02:00
Jan Nieuwenhuizen 542289a3c6
build: Separate Mes and Guile modules.
* scaffold/gc.scm: Move from guile/gc.scm.
* guile/: Remove.
* module/language/paren.mes: Remove.
* mes/module/mes/base.mes: Move from module/mes/.
* mes/module/mes/boot-0.scm: Likewise.
* mes/module/mes/boot-00.scm: Likewise.
* mes/module/mes/boot-01.scm: Likewise.
* mes/module/mes/boot-02.scm: Likewise.
* mes/module/mes/catch.mes: Likewise.
* mes/module/mes/display.mes: Likewise.
* mes/module/mes/fluids.mes: Likewise.
* mes/module/mes/getopt-long.mes: Likewise.
* mes/module/mes/guile.mes: Likewise.
* mes/module/mes/lalr.mes: Likewise.
* mes/module/mes/lalr.scm: Likewise.
* mes/module/mes/let.mes: Likewise.
* mes/module/mes/match.mes: Likewise.
* mes/module/mes/match.scm: Likewise.
* mes/module/mes/mescc.mes: Likewise.
* mes/module/mes/misc.mes: Likewise.
* mes/module/mes/module.mes: Likewise.
* mes/module/mes/optargs.mes: Likewise.
* mes/module/mes/optargs.scm: Likewise.
* mes/module/mes/peg.mes: Likewise.
* mes/module/mes/peg/cache.scm: Likewise.
* mes/module/mes/peg/codegen.scm: Likewise.
* mes/module/mes/peg/simplify-tree.scm: Likewise.
* mes/module/mes/peg/string-peg.scm: Likewise.
* mes/module/mes/peg/using-parsers.scm: Likewise.
* mes/module/mes/pmatch.mes: Likewise.
* mes/module/mes/pmatch.scm: Likewise.
* mes/module/mes/posix.mes: Likewise.
* mes/module/mes/pretty-print.mes: Likewise.
* mes/module/mes/pretty-print.scm: Likewise.
* mes/module/mes/psyntax-0.mes: Likewise.
* mes/module/mes/psyntax-1.mes: Likewise.
* mes/module/mes/psyntax.mes: Likewise.
* mes/module/mes/psyntax.pp: Likewise.
* mes/module/mes/psyntax.ss: Likewise.
* mes/module/mes/quasiquote.mes: Likewise.
* mes/module/mes/quasisyntax.mes: Likewise.
* mes/module/mes/quasisyntax.scm: Likewise.
* mes/module/mes/repl.mes: Likewise.
* mes/module/mes/scm.mes: Likewise.
* mes/module/mes/syntax.mes: Likewise.
* mes/module/mes/syntax.scm: Likewise.
* mes/module/mes/test.mes: Likewise.
* mes/module/mes/tiny-0.mes: Likewise.
* mes/module/mes/type-0.mes: Likewise.
* mes/module/mescc/M1.mes: Likewise.
* mes/module/mescc/as.mes: Likewise.
* mes/module/mescc/bytevectors.mes: Likewise.
* mes/module/mescc/compile.mes: Likewise.
* mes/module/mescc/i386/as.mes: Likewise.
* mes/module/mescc/info.mes: Likewise.
* mes/module/mescc/mescc.mes: Likewise.
* mes/module/mescc/preprocess.mes: Likewise.
* mes/module/nyacc/lalr.mes: Likewise.
* mes/module/nyacc/lang/c99/cpp.mes: Likewise.
* mes/module/nyacc/lang/c99/parser.mes: Likewise.
* mes/module/nyacc/lang/c99/pprint.mes: Likewise.
* mes/module/nyacc/lang/calc/parser.mes: Likewise.
* mes/module/nyacc/lang/util.mes: Likewise.
* mes/module/nyacc/lex.mes: Likewise.
* mes/module/nyacc/parse.mes: Likewise.
* mes/module/nyacc/util.mes: Likewise.
* mes/module/rnrs/arithmetic/bitwise.mes: Likewise.
* mes/module/srfi/srfi-0.mes: Likewise.
* mes/module/srfi/srfi-1.mes: Likewise.
* mes/module/srfi/srfi-1.scm: Likewise.
* mes/module/srfi/srfi-13.mes: Likewise.
* mes/module/srfi/srfi-14.mes: Likewise.
* mes/module/srfi/srfi-16.mes: Likewise.
* mes/module/srfi/srfi-16.scm: Likewise.
* mes/module/srfi/srfi-26.mes: Likewise.
* mes/module/srfi/srfi-26.scm: Likewise.
* mes/module/srfi/srfi-43.mes: Likewise.
* mes/module/srfi/srfi-8.mes: Likewise.
* mes/module/srfi/srfi-9.mes: Likewise.
* mes/module/srfi/srfi-9/gnu.mes: Likewise.
* mes/module/sxml/xpath.mes: Likewise.
* mes/module/sxml/xpath.scm: Likewise.
* module/mes/mes-0.scm: Likewise.
* build-aux/build-guile.sh: Update for new layout.
* build-aux/build-mes.sh: Likewise.
* build-aux/check-boot.sh: Likewise.
* build-aux/check-mescc.sh: Likewise.
* install.sh: Likewise.
* scaffold/boot/51-module.scm: Likewise.
* scaffold/boot/52-define-module.scm: Likewise.
* scripts/mescc: Likewise.
* src/mes.c: Likewise.
* tests/base.test-guile: Likewise.
* tests/boot.test: Likewise.
* tests/srfi-9.test: Likewise.
* mes/include: New symlink.
* mes/lib: New symlink.
* AUTHORS: Update file names.
2018-07-21 07:15:52 +02:00
Jan Nieuwenhuizen c0af8a1452
doc: Release update.
* BOOTSTRAP: Update.
* HACKING: Update.
* INSTALL: Update.
* NEWS: Update.
* README: Update.
* scaffold/tests/23-pointer.c: Add (janneke) to copyright line.
* doc/images/gcc-mesboot-graph.png: Update.
* doc/mes.texi (The Mes Bootstrap Process): Describe update.
2018-07-12 22:30:01 +02:00
Jan Nieuwenhuizen 50d7036e03
mescc: Support binutils 2.10.1: strrchr: Stop at start of string.
* lib/libc+tcc.c (strrchr): Stop at start of string.
* scaffold/tests/88-strrchr.c: Test it.
* build-aux/check-mescc.sh (tests): Run it.
2018-06-24 17:25:46 +02:00
Jan Nieuwenhuizen 2551eef953
mescc: Support binutils 2.14: vfprint, vsprintf: %12.10d.
* lib/libc+tcc.c (vfprintf, vsprintf): Handle %12.10d.
* scaffold/tests/70-printf.c: Test it.
2018-06-21 00:27:49 +02:00
Jan Nieuwenhuizen 7a42e5e6b0
mescc: Add another fopen test.
* scaffold/tests/98-fopen.c: New file.
* build-aux/check-mescc.sh (tests): Add it.
* AUTHORS: Mention it.
2018-06-16 16:12:51 +02:00
Jan Nieuwenhuizen 584482fb79
mescc: Add fopen test.
* scaffold/tests/97-fopen.c: New file.
* build-aux/check-mescc.sh (tests): Run it.
* include/unistd.h (link): Declare.
2018-06-16 15:18:27 +02:00
Jan Nieuwenhuizen cc466662b9
mescc: Support gcc-3.2: Implement integer strto*.
* lib/libc+tcc.c (strtoll, strtoul): Call strtoul.
2018-06-06 22:39:57 +02:00
Jan Nieuwenhuizen 04302b3fe4
mescc: Support gcc-3.2: Add getpid, signal.
* lib/linux+gnu.c (getpid, signal): New function.
* include/signal.h: Declare signal.
* include/unistd.h: Declare getpid.
* scaffold/tests/95-signal.c: Test it.
* build-aux/check-mescc.sh (tests): Run it.
2018-06-06 22:14:35 +02:00
Jan Nieuwenhuizen 7c4a6a88ed
mescc: Support gcc-3.4.0: *printf: Support `%n'.
* lib/libc+tcc.c (vfprintf, vsprintf): Support `%n'.  For Gcc 3.4.0.
* scaffold/tests/70-printf.c: Test it.
2018-06-06 19:29:32 +02:00
Jan Nieuwenhuizen f60cac6e1d
mescc: Support gcc-3.4.0: unsetenv.
* lib/gcc.c (unsetenv): New function.
2018-06-06 19:43:32 +02:00
Jan Nieuwenhuizen 635dfd03a2
mescc: Support glibc-1.06.4.
* lib/glibc.c: New file.
* lib/libc+gnu.c: Include it.
2018-06-03 18:54:26 +02:00
Jan Nieuwenhuizen de964f3e1f
mescc: Support gcc-2.6.3.
* TODO
2018-06-02 11:41:06 +02:00
Jan Nieuwenhuizen f1efaa0e93
mescc: Support binutils-2.5.1.
* include/stdint.h: #undef types before typedef'ing them.
* include/sys/types.h: Likewise.
* include/string.h (NULL): New define.
* include/stdio.h (BUFSIZ): New define.
2018-05-30 21:55:39 +02:00
Jan Nieuwenhuizen c3f27804f6
tests: Remove tinycc-imported non-free grep test.
* scaffold/tinycc/46_grep.c: Remove.
* scaffold/tinycc/46_grep.expect: Remove.
2018-06-01 15:35:05 +02:00
Jan Nieuwenhuizen a3a3654d54
mescc: Implement fflush, sscanf, vsscanf.
* lib/libc+tcc.c (vsscanf): New function.
  (sscanf): Use it.
  (fflush): Remove stub notice; we have no buffering.
* include/stdarg.h: Declare it.
* scaffold/tests/87-sscanf.c: Test it.
* build-aux/check-mescc.sh (tests): Run it.
2018-05-30 21:49:40 +02:00
Jan Nieuwenhuizen 272b522962
build: Use arch-dir.
* lib/x86-mes: Move from stage0.
* build-aux/build-cc.sh: Create libraries in lib/gcc.  Update users.
* build-aux/build-mes.sh: Create libraries in lib/x86-mes.  Update users.
* build-aux/build-mes-gcc.sh: Rename from build-mlibc.sh.  Create
  libraries in lib/x86-mes-gcc.  Update callers.
* build-aux/cc-mes-gcc.sh: Rename from cc-mlibc.sh.  Update callers.
2018-05-29 20:07:46 +02:00
Jan Nieuwenhuizen 2cda87257a
mlibc: Cleanup. 2018-05-29 18:15:22 +02:00
Jan Nieuwenhuizen 948fbf9743
mescc: Tinycc support: strncpy.
* lib/libc+tcc.c (strncpy): New function.
* scaffold/tests/86-strncpy.c: Test it.
* build-aux/check-mescc.sh (tests): Run it.
* build-aux/cc-mlibc.sh (LIBC): Acknowlegde.
* build-aux/test.sh (LIBC): Export it.
2018-05-20 10:55:44 +02:00
Jan Nieuwenhuizen def730d74a
mescc: Tinycc support: Structured type with char or short on heap.
* module/language/c99/compiler.mes (int->bv): New function.
  (init->data): Use it.  Add parameter.  Update callers.
  (array-init->data): Add type parmeter.
  (array-init-element->data): Likewise.
* module/mes/bytevectors.mes (bytevector-u8-set!): New function.
* module/mes/bytevectors.scm (mes): Export it.
* module/mes/as.mes (int->bv8): New function.
2018-05-19 14:53:05 +02:00
Jan Nieuwenhuizen 1dedd0ebca
mescc: Fix itoa.
* lib/libc.c (itoa): Use function-static buffer.  Increase to 12 to
  handle INT_MIN.
  (itoab): Likewise.
2018-05-20 08:33:06 +02:00
Jan Nieuwenhuizen 03ba0e18df
mescc: Tinycc support: Export nested struct definitions.
* module/language/c99/compiler.mes (struct-field): Support nested,
  named and anonymous enums.
  (field->info): New function.
  (type->info): Use it to reap nestedly defined enums, structs, unions.
  (decl->info): Likewise.
* scaffold/tests/t.c: Test it.
2018-05-19 20:49:56 +02:00
Jan Nieuwenhuizen b4d1c40aa8
mescc: Tinycc support: Unsigned comparison.
* stage0/x86.M1 (ja32, jae32, jb32, jbe32): New macro.
* module/mes/as-i386.mes (i386:jump-a, i386:jump-ae, i386:jump-b,
  i386:jump-be): Use it in new function.
* module/mes/as-i386.scm: Export them.
* module/language/c99/compiler.mes (test-jump-label->info): Use them to
  support unsigned comparison.
* scaffold/tests/7s-unsigned-compare.c: Test it.
* build-aux/check-mescc.sh (tests): Run it.
2018-05-19 11:41:53 +02:00
Jan Nieuwenhuizen 4faeece057
mescc: Tinycc support: Char and short sign extend.
* module/mes/as-i386.mes (i386:accu*n->local, i386:byte-accu->local+n,
  i386:word-accu->local+n): Remove.
  (i386:byte-accu, i386:signed-byte-accu, i386:word-accu,
  i386:signed-word-accu): New function.
* module/mes/as-i386.scm: Export them.
* module/language/c99/compiler.mes (accu->local+n-text): Simplify.
  (mem->accu, convert-accu): New function.
  (expr->accu): Use them.
* stage0/x86.M1 (mov____%al,0x32(%ebp), mov____%al,0x8(%ebp),
  mov____%ax,0x32(%ebp), mov____%ax,0x8(%ebp), movzbl_0x32(%ebp),%eax,
  movzbl_0x8(%ebp),%eax, movzwl_0x32(%ebp),%eax,
  movzwl_0x8(%ebp),%eax): Deprecate.
* scaffold/tests/7r-sign-extend.c: Test it.
* build-aux/check-mescc.sh (tests): Run it.
2018-05-18 23:58:10 +02:00
Jan Nieuwenhuizen 7dfc88e22c
mescc: Tinycc support: Switch with heterogeneous body, non-last default.
* module/language/c99/compiler.mes (switch->info): New function.
  (ast->info): Use it for switch.
  (clause->info, statements->clauses): Remove.
* scaffold/tests/44-switch.c (default_first): Test it.
2018-05-17 07:40:01 +02:00
Jan Nieuwenhuizen 345d0d8413
mescc: Tinycc support: Compound strings as function argument.
* module/language/c99/compiler.mes (expr->accu): Handle compound
  strings as function argument.
* module/mes/M1.mes (object->M1): Call error when string not found.
* scaffold/tests/t.c: Test it.
2018-05-14 22:37:53 +02:00
Jan Nieuwenhuizen 209f9cc599
mescc: Tinycc support: Update some tests. 2018-05-14 21:18:08 +02:00
Jan Nieuwenhuizen 010ab2032f
mescc: Tinycc support: Fix sizeof interesting expressions.
* module/language/c99/compiler.mes (ast->type): Return type for
  sizeof-expr, sizeof-type.
* scaffold/tests/85-sizeof.c: Test it.
2018-05-14 20:14:42 +02:00
Jan Nieuwenhuizen 0f87473105
mescc: Tinycc support: Support bit-fields.
* module/language/c99/compiler.mes (struct->fields): Support bit-fields.
  (ast->type):
  (field-field):
  (field-offset):
  (expr->accu*):
  (expr->accu):
  (struct-field):
  (->size):
* module/language/c99/info.scm (<bit-field>): New type.
* stage0/x86.M1 (and____$i32,%eax, and____(%edx),%eax,
  mov____(%edx),%eax, or____(%edx),%eax): New macro.
* module/mes/as-i386.mes (i386:base-mem->accu): Use
  it.
  (i386:accu-and, i386:accu-and-base-mem, i386:accu-or-base-mem): New
  function.
* module/mes/as-i386.scm: Export them.
* scaffold/tests/7q-bit-field.c: Test it.
* build-aux/check-mescc.sh (tests): Run it.
2018-05-13 17:05:28 +02:00
Jan Nieuwenhuizen dae4a30417
mescc: Tinycc support: Anonymous string array.
* module/language/c99/compiler.mes (global->info): Anonymous string
  array.
  (local->info): Likewise.
  (array-init->string): Support array of char.
  (init-local): Likewise.
  (->size): Fix for array.
* scaffold/tests/4a-char-array.c: Test it.
* build-aux/check-mescc.sh (tests): Run it.
2018-05-12 12:03:01 +02:00
Jan Nieuwenhuizen e8969af4ca
mescc: Tinycc support: sizeof: Bugfix for c-array.
* module/language/c99/compiler.mes (->size): Bugfix for c-array.
* scaffold/tests/85-sizeof.c: Test it.
2018-05-12 11:25:35 +02:00
Jan Nieuwenhuizen ad9f171c49
mescc: Tinycc support: Implement ((struct foo*)p)->bar.
* module/language/c99/compiler.mes (expr->accu*):
* scaffold/tests/7p-struct-cast.c: Test it.
* build-aux/check-mescc.sh (tests): Run it.
2018-05-12 00:20:51 +02:00
Jan Nieuwenhuizen 057607ca0a
mescc: Tinycc support: Implement (foo--)->bar and permutations.
* module/language/c99/info.scm (clone): Add post field.
  (make): Handle post parameter.
* module/language/c99/compiler.mes (clone): Handle post parameter.
  (expr->accu*): Set it to support foo--/foo--.
  (expr->accu): Read it to support foo--/foo--.
* scaffold/tests/7o-struct-pre-post.c: Test it.
* build-aux/check-mescc.sh: Run it.
2018-05-13 13:50:32 +02:00
Jan Nieuwenhuizen ec13ccc19f
mescc: Tinycc support: Function variables. 2018-05-11 18:53:54 +02:00
Jan Nieuwenhuizen 8cc406c9ff
mescc: Tinycc support: Pointer typedefs. 2018-05-11 18:36:35 +02:00
Jan Nieuwenhuizen b42ecbd928
mescc: Tinycc support: Array typedefs. 2018-05-11 18:26:01 +02:00
Jan Nieuwenhuizen 6bcc9a91e3
mescc: Tinycc support: Sizeof struct destruct. 2018-05-11 17:13:07 +02:00
Jan Nieuwenhuizen 07e73b8f9a
mescc: Tinycc support: Anonymous union initialization. 2018-05-11 15:52:30 +02:00
Jan Nieuwenhuizen e3a8316184
mescc: Tinycc support: Fix for ?-operator. 2018-05-11 15:13:55 +02:00
Jan Nieuwenhuizen 70cb56025f
mescc: Tinycc support: Valued function assign. 2018-05-11 13:34:45 +02:00
Jan Nieuwenhuizen a1862f749f
mescc: Refactor type system: WIP
* module/language/c99/compiler.mes (): WIP
* module/language/c99/info.scm (): WIP
2018-05-10 12:40:07 +02:00
Jan Nieuwenhuizen b75dd7eca2
mescc: Refactor type system: introduce <array>, <pointer>, <var>.
* module/language/c99/info.scm (<array>, <pointer>, <var>): New type.
* module/language/c99/compiler.mes (ast-><type>): New function.
  (ast-type): Use it.
2018-05-09 21:31:23 +02:00
Jan Nieuwenhuizen c9ba7a619b
mescc: Refactor variable declaration.
* module/language/c99/compiler.mes (decl->info): Refactor.
2018-05-05 12:30:06 +02:00
Jan Nieuwenhuizen 1b8d59fd0f
mescc: Handle sizeof expression.
* module/language/c99/compiler.mes (expr->accu): Handle sizeof
  expression.
* scaffold/tests/85-sizeof.c: Test it.
2018-05-05 00:59:31 +02:00
Jan Nieuwenhuizen 2311b8bd20
mescc: Handle struct field lists.
* module/language/c99/compiler.mes (struct-field): Return list of
  fields.  Update callers.
* scaffold/tests/84-struct-field-list.c: Test it.
* build-aux/check-mescc.sh (tests): Add it.
2018-05-05 00:14:47 +02:00
Jan Nieuwenhuizen 13edbaf4d8
mescc: Support heterogeneous variable init.
* module/language/c99/compiler.mes (decl->info): Support heterogeneous
  variable init.
* scaffold/tests/83-heterogenoous-init.c: Test it.
* build-aux/check-mescc.sh (tests): Add it.
2018-05-04 22:38:01 +02:00
Jan Nieuwenhuizen 5fba6d1a70
mescc: Handle (Skip) global static.
* module/language/c99/compiler.mes (decl->info): Handle (Skip) global
  static.
* scaffold/tests/48-global-static.c: Test it.
2018-05-04 20:40:04 +02:00
Jan Nieuwenhuizen e53f55f002
mescc: Support functions in expression.
* module/language/c99/info.scm (<function>): New type.
* module/language/c99/compiler.mes (ast->type): Support function.
  (expr->type-size): Likewise.
  (expr->type): Likewise.
  (expr->accu*): Likewise.
  (function->info): Create <function>.
* module/mes/M1.mes (object->M1): Grok <function>.
* scaffold/tests/47-function-expression.c: Test it.
* build-aux/check-mescc.sh: Add it.
2018-05-04 13:58:27 +02:00