Commit f1f12a12 authored by Niels Möller's avatar Niels Möller
Browse files

* src/scm/gaba.scm: Some more cleanup.

* src/scm/gaba.scm (append-deep): Deleted.
(type->category): Deleted.
(type->declaration): Deleted.
(type->mark): Deleted.
(type->free): Deleted.
(fix-method): Deleted.
(do-instance-struct): Deleted.
(do-struct): Deleted.
(do-mark-function): Deleted.
(do-free-function): Deleted.
(do-struct-mark-function): Deleted.
(do-struct-free-function): Deleted.
(do-class): Deleted.

Rev: src/scm/gaba.scm:1.11
parent 3e3c72a1
......@@ -45,17 +45,11 @@
(filter p (cdr list))))
(else (filter p (cdr list)))))
(define (implode list separator)
(cond ((null? list) '())
((null? (cdr list)) list)
(else `(,(car list) ,separator ,@(implode (cdr list) separator)))))
(define (list-prefix l n)
(if (zero? n) '()
(cons (car l) (list-prefix (cdr l) (- n 1)))))
(define (atom? o) (not (list? o)))
;; (define (atom? x) (or (symbol? x) (string? x)))
(define-syntax when
(syntax-rules ()
......@@ -135,21 +129,13 @@
(define (c-append . args)
(lambda (i) (apply out i args)))
(define (c-var name) name)
(define (c-string name)
;; FIXME: Could do quoting better
(c-append "\"" name "\""))
(define (c-statement expr)
(c-append expr ";"))
(define (c-address expr)
(c-append "&(" expr ")"))
(define (c-nl o)
(c-append o indent))
(define (c-list separator list)
(if (null? list) '()
(cons (car list)
......@@ -157,8 +143,6 @@
(c-append separator o))
(cdr list)))))
(define (c-list* separator . list) (c-list separator list))
(define (c-block statements)
(c-append "{" (map (lambda (s) (c-append indent s ";"))
statements)
......@@ -177,7 +161,7 @@
(c-append return indent name
"("
(if (null? args ) "void"
(c-list (c-nl ",") args))
(c-list (c-append "," indent) args))
")"))
(define (c-prototype* return name . args)
......@@ -230,24 +214,6 @@
";" indent))
#!
(define (type->init type expr)
(if (atom? type)
(type->init `(simple ,type) expr)
(case (car type)
((object string space pointer) (list expr "= NULL;\n"))
((bignum) (list "mpz_init(" expr ");\n"))
((array)
(let ((init-k (type->init (cadr type) (list "(" expr ")[k]"))))
(and init-k
(list "{\n unsigned k;\n"
" for (k=0; k<" (caddr type) "; k++)\n"
" " init-k
"}\n"))))
(else (error "make_class: type->init: Invalid type" type)))))
!#
(define var-name car)
(define var-type cdr)
......@@ -524,11 +490,8 @@
(struct-free-function name vars)
"#endif /* !GABA_DECLARE */\n\n")))
;;;; Expression compiler
;; Can't use load; it writes messages to stdout.
;;(load 'compiler)
;;;; Expression compiler
;; Constants is an alist of (name value call_1 call_2 ... call_n)
;; where value is a C expression representing the value. call_i is
......@@ -679,5 +642,3 @@
(unless (eof-object? exp)
(out 0 (process-input exp))
(main))))))
; (main)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment