gencomp 確認 (3)
あっちに行ったりこっちに戻ったり。
ちょっと軽くメモ取りつつ。
(define (do-it src base)
(parameterize ((cgen-current-unit (get-unit src base))
(compile-module (make-module #f))
(compile-file-basename base)
(vm-eval-situation SCM_VM_COMPILING))parameterize ってなかなか凄そげ。詳細は略。cgen-current-unit は
次も
;; Set up initial environment
(eval '(define-macro (current-module)
`(find-module ',(with-module user (compile-module-name))))
(compile-module))スルー。無名モジュールな環境で eval している。current-module ってマクロを定義している模様。
;; Static stuff
(cgen-decl "#include <gauche/code.h>")
(cgen-decl "#include <gauche/macro.h>") ;;for MakeMacroTransformerOld. temporary.
(and-let* ((extm (ext-module-file)))
(insert-ext-initializer (port-name extm)))下準備と思われる。いっちゃん下のソレもとりあえずスルー。and-let* とか凄い卑怯だよな、と言いつつ (を
;; Main processing
(with-input-from-file src
(lambda ()
(emit-toplevel-executor
(reverse (port-fold compile-toplevel-form '() read)))))
;; Emitting
(cgen-emit-c (cgen-current-unit))))ここがキモと見て掘削開始。
続き
Shiro さんから 0.8.14 のコメントを、と助言頂く。確認してみましたが、コメント部分には修正は入っていない模様。
とりあえず色々見てて
;; [Building code] ;; 1. Create a unit and make it the current unit. ;; 2. Call node creation functions. The created nodes are ;; accumulated within the current unit. ;; 3. Call "emit" method on the unit, which generates a C file ;; and optionally a header file.
なカンジなのは段々見えつつあるんですが若干 (?) 具体的ではないです。(弱