core: Remove string-append.

* string.c (string_append): Remove.
* module/mes/type-0.mes (string-append): New function.
* module/mes/base-0.mes: Include type-0 without using string-append.
This commit is contained in:
Jan Nieuwenhuizen 2016-12-23 20:56:37 +01:00
parent 9d3e079a6d
commit 745b58e419
4 changed files with 13 additions and 22 deletions

View file

@ -112,6 +112,13 @@
(list 'set-current-input-port (list open-input-file file)) (list 'set-current-input-port (list open-input-file file))
(list 'primitive-load) (list 'primitive-load)
(list 'set-current-input-port (list 'pop! '*input-ports*)))) (list 'set-current-input-port (list 'pop! '*input-ports*))))
(define include load)
(define-macro (include-from-path file)
(list 'load (list string-append "module/" file)))
(include "module/mes/type-0.mes")
(define (memq x lst) (define (memq x lst)
(if (null? lst) #f (if (null? lst) #f
(if (eq? x (car lst)) lst (if (eq? x (car lst)) lst
@ -148,11 +155,6 @@
;; (list newline (list current-error-port)) ;; (list newline (list current-error-port))
(list 'load (list string-append '*mes-prefix* (module->file module))))))) (list 'load (list string-append '*mes-prefix* (module->file module)))))))
(define include load)
(define-macro (include-from-path file)
(list 'load (list string-append "module/" file)))
(mes-use-module (mes type-0))
(mes-use-module (srfi srfi-0)) (mes-use-module (srfi srfi-0))
(mes-use-module (mes base)) (mes-use-module (mes base))
(mes-use-module (mes quasiquote)) (mes-use-module (mes quasiquote))

View file

@ -114,8 +114,11 @@
;;; core: accessors ;;; core: accessors
(define (string . lst)
(make-cell <cell:string> lst 0))
(define (string->list s) (define (string->list s)
(core:car s)) (core:car s))
(define (string . lst) (define (string-append . rest)
(make-cell <cell:string> lst 0)) (apply string (apply append (map1 string->list rest))))

View file

@ -1,6 +1,6 @@
#! /bin/sh #! /bin/sh
# -*-scheme-*- # -*-scheme-*-
MES_ARENA=${MES_ARENA-5000000} MES_ARENA=${MES_ARENA-10000000}
export MES_ARENA export MES_ARENA
prefix=module/ prefix=module/
cat $prefix/mes/base-0.mes $0 /dev/stdin | $(dirname $0)/mes $MES_FLAGS "$@" cat $prefix/mes/base-0.mes $0 /dev/stdin | $(dirname $0)/mes $MES_FLAGS "$@"

View file

@ -18,20 +18,6 @@
* along with Mes. If not, see <http://www.gnu.org/licenses/>. * along with Mes. If not, see <http://www.gnu.org/licenses/>.
*/ */
SCM
string_append (SCM x) ///((arity . n))
{
SCM p = cell_nil;
while (x != cell_nil)
{
SCM s = car (x);
assert (TYPE (s) == STRING);
p = append2 (p, STRING (s));
x = cdr (x);
}
return MAKE_STRING (p);
}
SCM SCM
list_to_string (SCM x) list_to_string (SCM x)
{ {