impc:ti:register-new-builtin   scheme


Defined in:  https://github.com/digego/extempore/tree/v0.8.9/runtime/llvmti.xtm

Implementation

;; this is never called in regular compilation! the builtin cache is
;; populated by hand (see above) and is mostly here for documentation
;; (especially for language builtins)
(define impc:ti:register-new-builtin
  (lambda (builtin-name type-str docstring args)
    ;; check arg types
    (if (not (and (or (string? builtin-name) (begin (println 'bad 'builtin-name: builtin-name) #f))
                  (or (string? type-str) (begin (println 'bad 'type: type-str) #f))
                  (or (string? docstring) (begin (println 'bad 'docstring: docstring)))
                  (or (list? args) (begin (println 'bad 'args: args) #f))))
        (impc:compiler:print-compiler-error "couldn't register new builtin")
        (if (impc:ti:builtin-exists? builtin-name)
            (impc:compiler:print-already-bound-error builtin-name (impc:ti:get-builtin-type builtin-name))
            ;; create a new entry
            (begin
              (set! *impc:ti:builtin-cache*
                    (cons (cons builtin-name (vector type-str docstring args))
                          *impc:ti:builtin-cache*))
              (car *impc:ti:builtin-cache*))))))


Back to Index