Commit Graph

66 Commits

Author SHA1 Message Date
Jan Nieuwenhuizen dc24a7f76f
core: Add string ports.
* src/mes.c (type_t): Add TPORT.
  (scm_type_port): New symbol.
  (PORT): New macro.
  (MAKE_STRING_PORT): New macro.
  (eval_apply): Handle string ports in primitive-load.
  (mes_symbols): Add scm_type_port.
* src/posix.c (peekchar): Handle string ports.
  (readchar): New function.  Replace all getchar callers.
  (unreadchar): Likewise.
* module/mes/type-0 (port?): New function.
* module/mes/guile.mes (with-input-from-file): Rewrite.
  (open-input-string): Remove.
* module/mes/guile.scm (guile): Update cell types.
* src/gc.c (gc_loop): Support TPORT.
* src/lib.c (display_helper): Support TPORT.
* module/mes/display.mes (display): Support TPORT.
2018-04-29 17:48:38 +02:00
Jan Nieuwenhuizen 865e72ae8a
core: Fix compile warnings.
* src/posix.c: Include sys/stat.h.
  (chmod): Return cell_unspecified.
* include/stdlib.h: Typo.
2018-04-29 12:02:23 +02:00
Jan Nieuwenhuizen 2cc6f166db
core: Add chmod.
* src/posix.c (chmod_): New function.
2018-04-27 23:31:45 +02:00
Jan Nieuwenhuizen bb45012c39
mes: Add isatty?.
* src/posix.c (isatty_p): New function.
2018-04-22 11:48:38 +02:00
Jan Nieuwenhuizen ad135d3752 doc: Release udpate.
* HACKING: Update.
* INSTALL: Update.
* NEWS: Update.
* README: Update.
* doc/ANNOUNCE-0.12: New file.
* throughout: (janneke) coming out.
2017-11-21 19:22:26 +01:00
Jan Nieuwenhuizen 6932d83d82 mes: Add setenv.
* src/posix.c (setenv_): New function.
* tests/base.test ("setenv, getenv"): Test it.
2018-04-07 09:34:02 +02:00
Jan Nieuwenhuizen 35bb5869f9 mes: Cleanup formatting. 2018-04-05 21:35:31 +02:00
Jan Nieuwenhuizen 4c9690996c mes: Iterative recursive macro expand.
* src/mes.c (eval_apply): Iterative recursive macro expand.
* src/posix.c (set_current_input_port): Return previous port.
* module/mes/catch.mes (%eh): Use core:display.
* module/mes/display.mes (display-cut, display-cut2): Move macro
  definitions to toplevel.
2018-03-04 10:05:55 +01:00
Jan Nieuwenhuizen f077364bce mes: reader: reader_ prefix; read/write char/string in core.
* src/posix.c (peek_char, read_char, read_string, unread_char, write_char): New function.
* src/reader.c: Use reader_ prefix.

r#	bootstrappable.org
2018-01-06 07:58:23 +01:00
Jan Nieuwenhuizen 6af7556d51 mescc: C99 header files and declaraions.
* libc/include/assert.h (assert_fail):
* libc/include/stdio.h:
+int eputs (char const* s);
+int fputs (char const* s);
+int puts (char const* s);
+int putchar (int c);
+int fputc (int c, int fd);
+int getchar ();
* libc/include/stdlib.h:
+char* getenv (char const* s)
+int atoi (char const *s);
+int *malloc (size_t);
+int *realloc (int *p, int size);
* libc/include/unistd.h (access):
* src/lib.c (display_helper):
* src/mes.c (read_input_file_env):
* src/posix.c: Include unistd.h.
2017-05-23 07:16:08 +02:00
Jan Nieuwenhuizen 45ce77df85 core: Add current-output-port, open-output-file, set-current-output-port.
* libc/include/fcntl.h: Declare it.  Add some fcntl defines.
* libc/include/stdio.h: Remove fcntl defines, Declare g_stdout.
* module/language/c99/compiler.mes (c99-input->ast): Define O_WRONLY, O_RDWR.
* module/mes/guile.mes (with-output-to-file, with-output-to-port): New functions.
* src/posix.c (current_output_port, open_output_file,
  set_current_output_port): New functions.
* libc/mlibc.c (open): Add optional mode parameter.
* module/mes/libc-i386.mes (i386:open): Forward third parameter.
* scaffold/mini-mes.c (main): Init g_stdout.
* src/mes.c (main): Likewise.
2017-05-19 06:56:47 +02:00
Jan Nieuwenhuizen fe727301c5 mescc: Support regular C99 compile, headers + mlibc.
* libc/include/assert.h: New file.
* libc/include/ctype.h: New file.
* libc/include/errno.h: New file.
* libc/include/fcntl.h: New file.
* libc/include/limits.h: New file.
* libc/include/mlibc.h: New file.
* libc/include/stdio.h: New file.
* libc/include/stdlib: New file.
* libc/include/string.h: New file.
* libc/include/unistd.h: New file.
* libc/mlibc.c: Remove declarations.
* make/bin.make (INCLUDES): Factor out standard includes.
* make/bin-mlibc.make: New file.
* scaffold/scaffold.make: Use it.
* src/src.make: Use it.
* module/language/c99/compiler.mes (ast-info): Handle more function declarations.
* scaffold/cons-mes.c: Remove mlibc definitionsa and mlibc.c include.
  Instead include <mlibc.h>.
* scaffold/hello.c: Likewise.
* scaffold/m.c: Likewise.
* scaffold/malloc.c: Likewise.
* scaffold/micro-mes.c: Likewise.
* scaffold/mini-mes.c: Likewise.
* scaffold/t.c: Likewise.
* scaffold/tiny-mes.c: Likewise.
* src/gc.c: Likewise.
* src/lib.c: Likewise.
* src/math.c: Likewise.
* src/mes.c: Likewise.
* src/posix.c: Likewise.
* src/reader.c: Likewise.
2017-05-02 23:30:46 +02:00
Jan Nieuwenhuizen d9e5e2d21f doc: Release update.
* AUTHORS: Mention Nyacc and GuixSD.
* NEWS: Update.
* README: Update.
* doc/ANNOUNCE-0.5 New file.
* HACKING: Add pointers, update TODO/DONE.
2017-04-27 12:08:16 +02:00
Jan Nieuwenhuizen 996c449a81 mescc: Add getenv.
* module/mes/libc-i386.mes (i386:_start): Push environment pointer.
* module/mes/libc.mes (g_environment): New global.
  (_env): New function.
  (_start): Use it to set g_environment.
  (getenv): New function.
* lib/mlibc.c (strncmp): New function.
  (getenv): Implement.
* lib/mstart.c (_start): Set g_environment.
* module/mes/libc.mes (strncmp): New function.
  (libc): Add it.
* scaffold/t.c: (array_ref): Test it.
2017-04-17 02:24:20 +02:00
Jan Nieuwenhuizen 9918ffab92 Add access?
* libc/mlibc.c (access): New function.
* module/mes/libc-i386.mes (i386:access): New function.
  (i386:libc): Add it.
* src/posix.c (access_p): New function.
* module/mes/posix.mes: New file.
* module/mes/base-0.mes (mes): Include it.
* module/mes/read-0-32.mo: Regenerate.
2017-04-16 09:51:45 +02:00
Jan Nieuwenhuizen 38d30a3e42 build: Refactor.
* GNUmakefile (OUT,QUIET,SUBDIRS): New variables.
  include make/common.make
* .gitignore: Remove toplevel targets.
* build-aux/compile-all.scm: Import from GNU Guix.
* configure (gulp-pipe): Check exit status.  Actually test for CC,
  CC32.
* make/bin.make: New file.
* make/check.make: New file.
* make/clean.make: New file.
* make/common.make: New file.
* make/compile.make: New file.
* make/guile.make: New file.
* make/mescc-guile.make: New file.
* make/mescc-mes.make: New file.
* make/reset.make: New file.
* lib/mlibc.c: Rename from top.
* lib/start.c: Rename from top.
* module/module.make: New file.
* scaffold/scaffold.make: New file.
* scripts/scripts.make: New file.
* src/mes.c: Rename from top.
* src/src.make: New file.
* src/mes.c: Rename from top.
* src/gc..c: Rename from top.
* src/lib.c: Rename from top.
* src/posix.c: Rename from top.
* src/reader.c: Rename from top.
* src/vector.c: Rename from top.
* tests/tests.make: New file.
2017-04-12 21:27:59 +02:00