diff --git a/eli/README b/eli/README index 00fe0703..40d94be9 100644 --- a/eli/README +++ b/eli/README @@ -5,6 +5,7 @@ Usage: Copy sc-mode.el and tcell-mode.el to your emacs library path and add the following code into your .emacs file. +(require 'cl) (require 'tcell-mode) ; recursively requires sc-mode (add-to-list 'auto-mode-alist (cons "\\.sc$" 'sc-mode)) (add-to-list 'auto-mode-alist (cons "\\.tcell$" 'tcell-mode)) diff --git a/eli/sc-mode.el b/eli/sc-mode.el index e57fcfa9..26aee77a 100644 --- a/eli/sc-mode.el +++ b/eli/sc-mode.el @@ -125,9 +125,11 @@ (define-derived-mode sc-mode lisp-mode "SC" - (setf (car font-lock-defaults) - (list 'sc-font-lock-keywords - 'sc-font-lock-keywords-1 'sc-font-lock-keywords-2)) + (setq font-lock-defaults + (cons + (list 'sc-font-lock-keywords + 'sc-font-lock-keywords-1 'sc-font-lock-keywords-2) + (cdr font-lock-defaults))) (let ((tag 'lisp-indent-function)) ;; SC constructs (put 'def tag 2) diff --git a/eli/tcell-mode.el b/eli/tcell-mode.el index 644f49cc..6ba829f3 100644 --- a/eli/tcell-mode.el +++ b/eli/tcell-mode.el @@ -107,7 +107,9 @@ ;; pseudo variables (,(concat "\\<" (regexp-opt - '("PROBABILITY" "WDATA" "WORKER-ID" "this") t) + '("PROBABILITY" "WDATA" "WORKER-ID" "EXITING" + "EXITING-NORMAL" "EXITING-EXCEPTION" "EXITING-CANCEL" "EXITING-SPAWN" + "this") t) "\\(\\.\\sw+\\)?\\>") (1 tcell-variable-name-face)) )))) @@ -120,9 +122,11 @@ "Default expressions to highlight in Tascell mode.") (define-derived-mode tcell-mode sc-mode "Tascell" - (setf (car font-lock-defaults) - (list 'tcell-font-lock-keywords - 'tcell-font-lock-keywords-1 'tcell-font-lock-keywords-2)) + (setq font-lock-defaults + (cons + (list 'tcell-font-lock-keywords + 'tcell-font-lock-keywords-1 'tcell-font-lock-keywords-2) + (cdr font-lock-defaults))) (let ((tag 'lisp-indent-function)) ;; Tascell constructs (put 'do-two tag 2) diff --git a/src/c2sc-lex.lsp b/src/c2sc-lex.lsp index 1fb7244a..bd63260e 100644 --- a/src/c2sc-lex.lsp +++ b/src/c2sc-lex.lsp @@ -288,7 +288,7 @@ (defun lex-prev-token () *prev-token*) (defun lex-colon-follows () *colon-follows*) -;; 字句解析の親分 +;; 絖ヨВ荀 (defun lex-get-token (&aux (le *lex-env*) (line nil)) (the lex-env *lex-env*) (unless (setq line (skip-whitespace le (lex-env-lptr le))) diff --git a/src/c2sc-parser.lsp b/src/c2sc-parser.lsp index 36f4aa64..8717a02b 100644 --- a/src/c2sc-parser.lsp +++ b/src/c2sc-parser.lsp @@ -67,14 +67,14 @@ ;;; whether c2sc::piece-c2sc is being processed (defvar *parsing-piece* nil) -;;; c2sc-getline 中に preprocessing directive が現れたらここに溜めておく。 +;;; c2sc-getline 筝 preprocessing directive 憗羣 ;;; %defmacro, %defconstant, %undef ;;; --> *scpp-macro-buffer* -;;; --> translation-unit の末尾につなげる -;;; それ以外 +;;; --> translation-unit 絨障ゃ +;;; 篁ュ ;;; --> *scpp-directive-buffer* -;;; --> *directive-emit-functions* に指定されている関数の返り値の頭に -;;; つなげて一緒に吐き出す +;;; --> *directive-emit-functions* 絎∽違菴ゃ +;;; ゃ筝膩冴 (defvar *scpp-directive-buffer* nil) (defvar *scpp-macro-buffer* nil) (defparameter *directive-emit-functions* '(declaration statement)) @@ -298,7 +298,7 @@ ;;;; -;; get-gensymid で mark をつけたところの identifier を決定する +;; get-gensymid mark ゃ identifier 羆阪 (defun decide-unidentified (sc-program) (let ((dec-id (memoize #'(lambda (usym) @@ -319,7 +319,7 @@ (ragrs *required-aggregates*)) (if (and (eq t rvars) (eq t ragrs)) sc-program (loop for df in sc-program - when (or (atom df) (not (defsymbol-p (car df))) ; 宣言・定義以外 + when (or (atom df) (not (defsymbol-p (car df))) ; 絎h糸臂篁ュ (if (consp (second df)) (if (member (car (second df)) ~(struct union enum)) (aggregate-required-p (second (second df))) @@ -330,8 +330,8 @@ (defun defsymbol-p (sym) (rule:declaration-tag? sym :sc2c)) -;; 無名のstructなどは,SCでは無名にできないので, -;; mark をつけておいて,後で identifier を決定する +;; ≦struct鐚SCс≦сэ +;; mark ゃ,緇 identifier 羆阪 (defvar *gensym-num*) (defun get-gensymid () (prog1 @@ -1658,9 +1658,9 @@ (aif (read-line stream nil) (if (eql #\$ (string-ref it 0)) (progn - ;; S-expression としてreadして、、、 + ;; S-expression read (handle-c2sc-directive (string-left-ntrim it)) - ;; あらためて次の行を読む + ;; 罨<茵茯 (c2sc-getline stream)) (funcall (if *want-debugging-output* #'print #'identity) (string+ it #.(format nil "~%")))) @@ -1706,8 +1706,8 @@ (otherwise (push directive *scpp-directive-buffer*)))))) -;; *directive-emit-functions* の関数(構文単位)処理後, -;; *scpp-direcive-buffer*にたまったプリプロセッサ指令を吐き出す +;; *directive-emit-functions* ∽逸罕篏鐚緇鐚 +;; *scpp-direcive-buffer*障c祉究篁ゃ冴 (dolist (de-func *directive-emit-functions*) (let ((orig-func (symbol-function de-func))) (setf (symbol-function de-func) @@ -1718,12 +1718,12 @@ (nconc emit-directive (apply orig-func args))))))) -;;; %defconstant-cexp 中のCコードの断片を可能ならSC化 +;;; %defconstant-cexp 筝C潟若純SC (defun defconstant-cexp-c2sc (defconstant-exp-directive) (assert (eq '%defconstant-cexp (car defconstant-exp-directive))) (let* ((const-name (second defconstant-exp-directive)) (piece-c-code (third defconstant-exp-directive)) - ;; C の "~" は "~~" になっているので + ;; C "~" "~~" c (formatted-c-code #|(format nil|# piece-c-code #|)|#)) (if (not (macro-required-p const-name)) nil (progn @@ -1742,8 +1742,8 @@ (format *error-output* "==> ~%")) `(sc::c-exp ,piece-c-code)) )))))) -;;; defmacro における c-code の "$$" の部分を引数名に置き換える -;;; 返り値は +;;; defmacro c-code "$$" 綣医臀 +;;; 菴ゃ ;;; (values `(c-exp ...) ;;; ) (defun replace-arguments (piece-c-code arg-list) @@ -1770,7 +1770,7 @@ (values `(cl:list 'sc::c-exp ,cexpstr ,@arg-list) formatted-c-code) ))) -;; マクロ本体を backquote-macro に変換 +;; 篏 backquote-macro 紊 (defun to-eval-macroarg (scized-defmacro macro-arg-list) (if (atom scized-defmacro) (if (member scized-defmacro macro-arg-list) @@ -1779,7 +1779,7 @@ `(cl:list ,@(mapcar (suffixed-func #'to-eval-macroarg macro-arg-list) scized-defmacro)))) -;;; %defmacro-cexp 中のCコードの断片を可能ならSC化 +;;; %defmacro-cexp 筝C潟若純SC (defun defmacro-cexp-c2sc (defmacro-exp-directive) (assert (eq '%defmacro-cexp (car defmacro-exp-directive))) (destructuring-bind (macro-name piece-c-code arg-list) @@ -1807,7 +1807,7 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; 環境を整えてinitiatorから構文解析開始 +;; 医眼initiator罕茹f紮 ;; input : input-stream or string (defun parser-main (input &key @@ -1879,8 +1879,8 @@ fixed-typename-entries (mapcar #'make-typename-entry typename-list) ))))) -;; 同じ変換結果を削除する. -;; 複数の候補の原因が型変数(or not)の場合,その変数名を特定する. +;; 紊腟ゃ鐚 +;; 茲違茖紊(or not)翫鐚紊医劫鐚 (defun remove-duplicate-candidates (all-candidates) (let ((ret (list))) ;; ( ) (dolist (cand all-candidates) @@ -1889,7 +1889,7 @@ (intersection (second (car it)) (second cand)) (intersection (third (car it)) (third cand)) )) (push cand ret))) - ;; 候補の違いに影響してない変数名を除く + ;; 茖綵演帥紊医ゃ (mapc #'(lambda (get-place &aux (get-placea (compose #'car get-place))) (dolist (tn (funcall get-placea (first ret))) @@ -1902,7 +1902,7 @@ (list #'cdr #'cddr)) ret)) -;; tried-functionで指定された全ての場所からparsingを試みる +;; tried-functionф絎贋parsing荅帥 (defun try-all-parsing (istring &key (tried-function *tried-function*)) (check-type istring string) (let* ((all-candidates) ; list of ( ) @@ -2031,8 +2031,8 @@ ;;; (c2sc "csample/c_parser.c") -;;; 対話環境での利用向けpiece-c2sc -;;; sc:: などの情報を除いてすっきり出力 +;;; 絲乗援医сpiece-c2sc +;;; sc:: 宴ゃc阪 (defun pcsc (x &rest try) (unless try (setq try *tried-function*)) (immigrate-package (piece-c2sc x :tried-function try) *package*)) diff --git a/src/c2scpp/src/set_mcpp.sh b/src/c2scpp/src/set_mcpp.sh old mode 100755 new mode 100644 diff --git a/src/c2scpp/src/unset_mcpp.sh b/src/c2scpp/src/unset_mcpp.sh old mode 100755 new mode 100644 diff --git a/src/c2scpp/tests/after_test.sh b/src/c2scpp/tests/after_test.sh old mode 100755 new mode 100644 diff --git a/src/c2scpp/tests/set_test.sh b/src/c2scpp/tests/set_test.sh old mode 100755 new mode 100644 diff --git a/src/init.lsp b/src/init.lsp index 5af69d7b..9d0fba34 100644 --- a/src/init.lsp +++ b/src/init.lsp @@ -33,11 +33,11 @@ ;;; Implementation-dependent settings #+cmu (setq ext:*gc-verbose* nil) -#+clisp (progn (setq custom:*default-file-encoding* charset:euc-jp) +#+clisp (progn (setq custom:*default-file-encoding* charset:utf-8) (unuse-package :ext)) #+allegro (progn (setq comp:*cltl1-compile-file-toplevel-compatibility-p* t) (require :osi)) -#+(and allegro mswindows) (setq *locale* (find-locale "japan.EUC")) +#+(and allegro mswindows) (setq *locale* (find-locale "ja_JP.utf8")) ;; #+(and composer allegro) (wt:start-composer) ;;; Printer settings diff --git a/src/rule/hoist.rule b/src/rule/hoist.rule index 392bb723..b62d982d 100644 --- a/src/rule/hoist.rule +++ b/src/rule/hoist.rule @@ -63,7 +63,7 @@ (return-from remove-const (remove-const (car x)))) (mapcar #'remove-const x)) -;; declaration, block-item の返り値を宣言部とbody部に分ける +;; declaration, block-item 菴ゃ絎hbody (defun split-decl-and-body (x) (list (apply #'append (mapcar #'first x)) (remove nil (mapcar #'second x)))) @@ -80,9 +80,9 @@ (hst:with-hoist-env (call-next-rule) )) ) -;;; 以下, declaration, block-item の返り値は、 -;;; (<関数本体の先頭に出すS式のリスト> -;;; <元の場所に残すS式>) +;;; 篁ヤ, declaration, block-item 菴ゃ +;;; (<∽井篏冴S綣鴻> +;;; <贋罧S綣>) ;;; declaration (defrule inlined-declaration hoist @@ -153,12 +153,12 @@ (defrule struct-declaration hoist (otherwise - (hst:with-new-func ; ダミーの関数を置いて,add-declされた宣言を捕まえる + (hst:with-new-func ; 若∽違臀鐚add-decl絎h障 (with1 ret (call-next-rule) ~(%splice ,.(hst:finfo-flush-decls) ,ret) ))) ) -;;; 配列初期化子で参照される最大のindex数 +;;; 絖ус紊сindex (defrule max-referred-index hoist (#?(array ,@inits) (with1 cnt 0 @@ -170,7 +170,7 @@ (defrule referred-index hoist ;; initializer with designator (#?((aref-this ,@exp-list) ,init) - (eval (car exp-list)) ) ; 添字がLispで評価できる式であることを仮定 + (eval (car exp-list)) ) ; 羞糸Lispц箴<с綣с篁絎 (#?((aref ,desig ,@exp-list) ,init) (referred-index ~(,desig ,init))) ;; initializer without designator diff --git a/src/rule/hsc-defs.lsp b/src/rule/hsc-defs.lsp index 8bee0598..9e47e700 100644 --- a/src/rule/hsc-defs.lsp +++ b/src/rule/hsc-defs.lsp @@ -51,8 +51,8 @@ ;;; function information (defstruct finfo variables ; list of ( . ) - tmp-variables ; 追加された一時変数 list of ( . ) - (function-head t) ; 関数の先頭のブロック通過時にnilにする + tmp-variables ; 菴遵筝紊 list of ( . ) + (function-head t) ; ∽違nil main-p ) @@ -100,12 +100,12 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; struct information (defstruct sinfo - id ; 元の構造体名 + id ; 罕篏 members ; list of ( . ) - hsc-sid ; 変換後の構造体名 - data-sid ; データ部の構造体名(今の実装ではidと同一) - smap-id ; マップ配列の変数名 - sdesc-id ; 構造体ごとのdesc情報を保持する変数名 + hsc-sid ; 紊緇罕篏 + data-sid ; 若翠罕篏鐚篁絎茖сid筝鐚 + smap-id ; 紊医 + sdesc-id ; 罕篏desc宴篆紊医 ) (defun sinfo-asize (&optional (sinfo *sinfo*)) @@ -121,18 +121,18 @@ ;; make expression for aligned size -;; sinfo追加 +;; sinfo菴遵 (defun add-sinfo (&optional (sinfo *sinfo*)) (push sinfo *sinfo-list*)) -;; sinfoをidで検索 +;; sinfoidф膣 (defun find-sinfo (id) (find id *sinfo-list* :key #'sinfo-id)) (defun add-member (id type &optional (sinfo *sinfo*)) (push (cons id type) (sinfo-members sinfo))) -;; オブジェクト内の参照の位置を示す配列式 +;; 吾сс篏臀腓冴綣 (defun make-struct-map (&optional (sinfo *sinfo*)) (let ((vars (sinfo-members sinfo)) (hsc-sid (sinfo-hsc-sid sinfo)) @@ -152,7 +152,7 @@ ,member-id))) ) -;; オブジェクト情報構造体式を作る +;; 吾с掩篏綣篏 (defun make-descriptor (&optional (sinfo *sinfo*)) (let ((hsc-sid (sinfo-hsc-sid sinfo)) (smap-id (sinfo-smap-id sinfo))) diff --git a/src/rule/hsc.rule b/src/rule/hsc.rule index e19fc723..570c04e3 100644 --- a/src/rule/hsc.rule +++ b/src/rule/hsc.rule @@ -24,10 +24,10 @@ ;;; OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF ;;; SUCH DAMAGE. -;;; HSC -> LW-SC (要hoisting, type, temp) +;;; HSC -> LW-SC 鐚荀hoisting, type, temp鐚 -;; 未対応 -;; ・構造体がメンバとして構造体を持つ場合 +;; 絲上 +;; 紙篏<潟罕篏ゅ翫 (scr:require "HSC-DEFS") @@ -60,7 +60,7 @@ (#?(,scs[storage-class-specifier] (,fname ,@arg-list) (,fntag[function-tag] ,rtype ,@type-list {,va-arg[vaarg-tag]}) ,@body) - (if (or (cid-p fname) (cid-p fntag)) (list x) ; csym::なら何もしない + (if (or (cid-p fname) (cid-p fntag)) (list x) ; csym::篏 (let* ((hsc:*finfo* (hsc:make-finfo :main-p (eq fname ~hsc-main))) (vaarg-ret (if-pattern-variable va-arg (list (get-retval va-arg)))) (rtype-ret (type-expression! rtype)) @@ -86,12 +86,12 @@ (let ((sbody-ret (mapcar #'struct-declaration sbody))) (list 'splice - ~(def (struct ,data-sid) ,@sbody-ret) ; 元の構造体情報 + ~(def (struct ,data-sid) ,@sbody-ret) ; 罕篏 ~(def (struct ,hsc-sid) ; --> {, , _data} (def d desc-t) (def data (struct ,data-sid))) - ~(def ,smap-id (array size-t) ,(hsc:make-struct-map)) ; オブジェクト中の参照の位置 - ~(def ,sdesc-id descriptor ,(hsc:make-descriptor)) ; 構造体固有の情報(descriptor) + ~(def ,smap-id (array size-t) ,(hsc:make-struct-map)) ; 吾с筝с篏臀 + ~(def ,sdesc-id descriptor ,(hsc:make-descriptor)) ; 罕篏堺(descriptor) ))))) ;; union (not featured) (#?(def (union ,sid) ,@sbody) @@ -106,7 +106,7 @@ ~(,scs ,id ,texp-ret 0))) ;; variable (otherwise) (#?(,scs[storage-class-specifier] ,id[identifier] ,texp {,init}) - ;;ptrならmove対象としてリストに加える。csym::がついていたらmove対象から外す。 + ;;ptrmove絲乗院鴻csym::ゃmove絲乗院紊 (if (cid-p id) x (let* ((texp-ret (type-expression texp)) (init-ret (if-pattern-variable init (list (initializer init)) @@ -115,7 +115,7 @@ ~(,scs ,id ,texp-ret ,@init-ret)))) ) -;; メンバを*sinfo*に登録 +;; <潟*sinfo*脂 (defrule struct-declaration hsc (#?(def ,id ,texp) (let ((texp-ret (type-expression texp))) @@ -123,9 +123,9 @@ ~(def ,id ,texp-ret)))) ;; type-expression -;; * fn型に第一引数 (入れ子関数sht型)追加 +;; * fn膃筝綣 (ャ絖∽sht)菴遵 ;; * array -> ptr -;; * 構造体名を変換 +;; * 罕篏紊 (defrule type-expression hsc (#?,atom[#'atom] x) @@ -145,7 +145,7 @@ (otherwise (mapcar #'type-expression x))) -;; texpが参照型かどうかの判定 +;; texpуゅ (defrule ref-type-p hsc ((#?(ptr ,texp) #?(array ,@rem)) @@ -153,7 +153,7 @@ (otherwise nil)) -;; 宣言の最後に一時変数の宣言および入れ子関数の追加 +;; 絎h緇筝紊違絎h喝ャ絖∽違菴遵 (defrule function-body hsc (#?({:attr ,f-attr} { ,r-decl[register-declarator] } ,@bi-list) @@ -163,16 +163,16 @@ (list (get-retval r-decl))))) (fhead (hsc:function-head-p)) (rembody bi-list) - (decls (loop for bi in bi-list ; body先頭の宣言部 + (decls (loop for bi in bi-list ; body絎h as ret = (inlined-declaration (car rembody)) until (eq 'rule::no-match ret) do (pop rembody) collect ret)) - (stats (mapcar #'statement! rembody))) ; 残りのstatement部 + (stats (mapcar #'statement! rembody))) ; 罧statement (nconc pre decls (when fhead - (nconc (hsc:make-add-decls) ; 一時変数の宣言 - (list (hsc:make-nestfunc)))) ; 入れ子関数定義 + (nconc (hsc:make-add-decls) ; 筝紊違絎h + (list (hsc:make-nestfunc)))) ; ャ絖∽医臂 stats))) ) @@ -232,22 +232,22 @@ (bit-or TYPE-STRUCT ; type-id (see "hsc.sh") (cast size-t ; descriptor (ptr ,(hsc:sinfo-sdesc-id sinfo))))) - ,init-ret) ; もともとのデータ + ,init-ret) ; 若 )))) ;; field reference - ;; (struct d data) に変わっているのでdata部を指すように変更 + ;; (struct d data) 紊cdata紊 (#?(the ,texp (fref ,exp ,@id-list)) - (let* ((exp-ret (expression! exp)) ; fref第一式 + (let* ((exp-ret (expression! exp)) ; fref膃筝綣 (exp-type (second exp-ret))) (aif (and (tagged-p ~struct exp-type) (hsc:find-sinfo (second exp-type))) ~(the ,texp (fref ,exp-ret data ,@id-list)) - (progn ; 未定義または構造体型でない + (progn ; 絎臂障罕篏с (warn "~S (type of ~S) is not defined as structure" exp-type (third exp)) ~(the ,texp (fref ,exp-ret ,@id-list)))))) - ;; array object: body部を参照するように変更 - ;; indexがない場合は,Cへの関数渡し用に,単にbodyを参照する + ;; array object: bodyс紊 + ;; index翫鐚C吾∽井検鐚bodyс (#?(the (array ,texp) (aref ,exp)) (let* ((texp-ret (type-expression! texp)) (exp-ret (expression! exp))) @@ -266,7 +266,7 @@ ;; function call (#?(the ,texp (call (the (ptr (,ftag ,@texp-list)) ,exp) ,@exp-list)) - (let ((exp-ret (expression! (second (third x)))) ; call第一式 + (let ((exp-ret (expression! (second (third x)))) ; call膃筝綣 (expl-ret (mapcar #'expression! exp-list))) (if (or (eq 'csym::fn ftag) (cid-p exp)) ~(the ,texp (call ,exp-ret ,@expl-ret)) diff --git a/src/rule/hsc.sc b/src/rule/hsc.sc index 26140fd1..df7c6ddf 100644 --- a/src/rule/hsc.sc +++ b/src/rule/hsc.sc @@ -39,7 +39,7 @@ (%include "rule/nestfunc-setrule.sh") (%include "hsc.sh") -;;; gc-initで無指定(=0)の場合に採用される値 +;;; gc-initх≧絎(=0)翫。 (%ifndef TOSIZE ((%defconstant TOSIZE (* 5 1024 1024))) ) ;; (%ifndef ROOTSIZEMAX @@ -51,7 +51,7 @@ (%ifndef GC-LIMITED-STACK-MAX ((%defconstant GC-LIMITED-STACK-MAX 32)) ) -;;; ポインタ判定 +;;; ゃ潟水ゅ (%defmacro MREF-AS (tp p) `(mref (cast (ptr ,tp) ,p))) @@ -111,7 +111,7 @@ (static-def new-memory-end (ptr char)) ;; Referred in move & gc-breadth-first -(static-def b (ptr char)) ; moveの次の移動先 +(static-def b (ptr char)) ; move罨<腱糸 ;; *link = move(*link); (def (csym::move vp) (csym::fn (ptr void) (ptr void)) @@ -128,7 +128,7 @@ ;; Object not located in From Space (if (not (IN-FROM p)) (return vp)) - ;; オブジェクトの先頭 (sizeof size-t)[byte] は + ;; 吾с (sizeof size-t)[byte] ;; fowarding pointer OR (bit-or least2bit-tag pointer-to-descriptor) (= tag (bit-and #b11 (MREF-AS size-t p))) (= fwp (cast (ptr void) @@ -137,7 +137,7 @@ (if (IN-TOSP fwp) (return fwp)) - ;; オブジェクトの先頭 sizeof(int) bytes --- (fref ,obj type) + ;; 吾с sizeof(int) bytes --- (fref ,obj type) ;; LSB==1: type-id ;; LSB==0: forwarding pointer (switch tag @@ -155,13 +155,13 @@ (default) (error "Illegal type ID!")) - (= np b) ; 移動先 - (= nb (+ np asize)) ; 次の移動先 + (= np b) ; 腱糸 + (= nb (+ np asize)) ; 罨<腱糸 (if (>= nb new-memory-end) (error "buffer overrun.")) (MEMCPY np p size) - (= b nb) ; 移動先を更新 - (= (FWPTR p) np) ; 跡地にfowarding pointer + (= b nb) ; 腱糸贋 + (= (FWPTR p) np) ; 莊≦違fowarding pointer (return np)) ;; BREADTH-FIRST-GC @@ -180,7 +180,7 @@ (if (fref params gcv) (csym::printf "BREADTH-FIRST-GC start~%")) (= b new-memory) (= s b) - (scan) ; stackから直接指されているobjをcopy + (scan) ; stack贋・objcopy (while (< s b) ; for each copied object (= tag (bit-and #b11 (MREF-AS size-t s))) (switch tag @@ -222,12 +222,12 @@ (csym::printf "GC complete (%d)~%" allocated-size)) ) -;; 性能測定用 +;; ц醇謙絎 (def gc-ttime double) (def tp1 (struct timeval)) (def tp2 (struct timeval)) -;; GC開始 +;; GC紮 (def (gc scan) (fn void sht) (csym::gettimeofday (ptr tp1) 0) (switch (fref params gctype) @@ -252,7 +252,7 @@ (if (== (fref params tosize) 0) (= (fref params tosize) TOSIZE)) (+= (fref params tosize) 3) (-= (fref params tosize) (bit-and (fref params tosize) 3)) - ; 下位2bitが00になるように繰り上げ + ; 筝篏2bit00膵違筝 (if (== (fref params stack-size) 0) (= (fref params stack-size) GC-STACK-SIZE)) (if (== (fref params limited-stack-max) 0) @@ -262,7 +262,7 @@ (fref params tosize) (fref params stack-size) (fref params limited-stack-max) ) - ;; heap領域の確保 + ;; heap腆坂 (= old-memory (csym::myalloc (fref params tosize))) (= old-memory-end (+ old-memory (fref params tosize))) (= new-memory (csym::myalloc (fref params tosize))) diff --git a/src/rule/hsc.sh b/src/rule/hsc.sh index 0b989daa..a46f3a4e 100644 --- a/src/rule/hsc.sh +++ b/src/rule/hsc.sh @@ -32,13 +32,13 @@ ;; (deftype size-t long) (deftype align-t double) -;;; (def d desc-t) の下位2ビットに埋め込む +;;; (def d desc-t) 筝篏2莨若 (%defconstant TYPE-STRUCT 0) (%defconstant TYPE-REF-ARRAY 1) (%defconstant TYPE-NONREF-ARRAY 3) -;;; 構造体の構造(hsc.ruleより) -;; ~(def (struct ,data-sid) ,@sbody-ret) ; 元の構造体情報は _data +;;; 罕篏罕鐚hsc.rule鐚 +;; ~(def (struct ,data-sid) ,@sbody-ret) ; 罕篏宴 _data ;; ~(def (struct ,sid) ; --> {, , _data} ;; (def d desc-t) ; (ptr (struct desc-struct)) ;; (def data (struct ,data-sid)) @@ -54,7 +54,7 @@ (deftype desc-t (ptr descriptor)) (def (struct array-object) - (decl d desc-t) ; 下位2bit以外はダミー + (decl d desc-t) ; 筝篏2bit篁ュ (decl length int) (decl el-size size-t) (decl size size-t) diff --git a/src/rule/labeled-break.rule b/src/rule/labeled-break.rule index 27dfdf3a..08870c50 100644 --- a/src/rule/labeled-break.rule +++ b/src/rule/labeled-break.rule @@ -22,10 +22,10 @@ ;;; OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF ;;; SUCH DAMAGE. -;;;;; Javaとかで使うlabelつきbreak,continueをSCでも使用できるようにする. -;;; *label-list* = list of ( -;;; -;;; ) +;;;;; Javaт戎labelゃbreak,continueSCс篏睡с鐚 +;;; *label-list* = list of ( +;;; +;;; ) (defvar *label-list*) diff --git a/src/rule/multithread-defs.lsp b/src/rule/multithread-defs.lsp index 94311437..b9245eeb 100644 --- a/src/rule/multithread-defs.lsp +++ b/src/rule/multithread-defs.lsp @@ -37,22 +37,22 @@ (defvar *current-func* nil) -;(<ラベル 変数><入れ子関数名><ローカル変数><スレッドの判断(生成か継続か)>) +;(< 紊><ャ絖∽医><若紊><鴻ゆ(膓膓)>) (defstruct finfo - ;; 関数名? <- 違った。たぶん李さんの勘違い - ;; 関数名として使うことにする + ;; ∽医? <- c吟 + ;; ∽医篏帥 id - ;; 返り値の型 + ;; 菴ゃ rettype - ;; 関数の先頭に追加する宣言のリスト + ;; ∽違菴遵絎h鴻 decl - ;; 計算がどこまで終わったかを示すラベル名のリスト + ;; 荐膊障хc腓冴鴻 ;; list of ( ) - ;; 出現順にpush + ;; 榊憥push label - ;; 入れ子関数の名前 + ;; ャ絖∽違 nfunc-id - ;; 次につけるlnの値? + ;; 罨<ゃln? ;; ln) ) @@ -84,7 +84,7 @@ (defun make-nestfunc-id (f-id) (generate-id (string+ (identifier f-id) "_c"))) -; block-item-listから先頭の宣言部分を取り出す +; block-item-list絎h冴 (defun separate-decl (bil &aux dcl-list oth-list) (dolist (bi bil (list (nreverse dcl-list) (nreverse oth-list))) (if (and (consp bi) @@ -92,7 +92,7 @@ (push bi dcl-list) (push bi oth-list)))) -;; 入れ子関数の定義を生成 +;; ャ絖∽違絎臂 (defun make-nestfunc (nf-body) #| (setq label-l (get-id-from-string (string+ "@L" (write-to-string ln)))) @@ -113,10 +113,10 @@ (return)) (return) - ;;<入れ子関数の文>部分 + ;;<ャ絖∽違> ,@nf-body - ;;関数の最後にreturnがない場合もちゃんと呼び出し元のスレッドを - ;;runnableにしてからスケジューラにreturn + ;;∽違緇return翫<若喝冴鴻 + ;;runnable鴻宴吾ャ若return (= (fref cp -> c) c_p) (= (fref cp -> stat) thr_runnable) (return)) diff --git a/src/rule/multithread-hoist.rule b/src/rule/multithread-hoist.rule index 0a31c2e1..5c2512d1 100644 --- a/src/rule/multithread-hoist.rule +++ b/src/rule/multithread-hoist.rule @@ -24,7 +24,7 @@ (define-ruleset multithread-hoist (hoist)) -;; マルチスレッド用プリミティブ +;; 鴻c (extendrule block-item multithread-hoist ((#?(thread-create ,@body) ) (let ((body-ret (function-body body))) diff --git a/src/rule/multithread-rename.rule b/src/rule/multithread-rename.rule index 5c082e59..40110086 100644 --- a/src/rule/multithread-rename.rule +++ b/src/rule/multithread-rename.rule @@ -24,7 +24,7 @@ (define-ruleset multithread-rename (rename)) -;; マルチスレッド用プリミティブ +;; 鴻c (extendrule block-item multithread-rename ((#?(thread-create ,@body) ) (ren:inc-block-level diff --git a/src/rule/multithread-sc1.rule b/src/rule/multithread-sc1.rule index e4602bfa..b3a065b7 100644 --- a/src/rule/multithread-sc1.rule +++ b/src/rule/multithread-sc1.rule @@ -24,7 +24,7 @@ (define-ruleset multithread-sc1 (sc1-to-sc0)) -;; マルチスレッド用プリミティブ +;; 鴻c (extendrule statement multithread-sc1 (#?(thread-create ,@body) ~(thread-create ,@(function-body body)) ) diff --git a/src/rule/multithread-temp.rule b/src/rule/multithread-temp.rule index 79be7802..5730fa3d 100644 --- a/src/rule/multithread-temp.rule +++ b/src/rule/multithread-temp.rule @@ -24,7 +24,7 @@ (define-ruleset multithread-temp (temp)) -;; マルチスレッド用プリミティブ +;; 鴻c (extendrule statement multithread-temp (#?(thread-create ,@body) ~(thread-create ,@(function-body body)) ) diff --git a/src/rule/multithread-type.rule b/src/rule/multithread-type.rule index 7f19d711..1f6ade48 100644 --- a/src/rule/multithread-type.rule +++ b/src/rule/multithread-type.rule @@ -24,7 +24,7 @@ (define-ruleset multithread-type (type-info)) -;;; マルチスレッド用プリミティブ +;;; 鴻c (extendrule statement multithread-type (#?(thread-create ,@body) (type:with-new-environment diff --git a/src/rule/multithread.rule b/src/rule/multithread.rule index 55abc024..1a1ee287 100755 --- a/src/rule/multithread.rule +++ b/src/rule/multithread.rule @@ -42,8 +42,8 @@ ;;;;;; declaration ;;;;;; -;; declaration, block-item, expression の返り値は -;;(<入れ子関数のitem-list> <元の関数のitem-list>) +;; declaration, block-item, expression 菴ゃ +;;(<ャ絖∽違item-list> <∽違item-list>) (extendrule inlined-declaration multithread ;; function ((#?(,scs[storage-class-specifier] (,func-id ,@arg-id[identifier]) @@ -69,7 +69,7 @@ ~(,scs (,func-id c-p ,@arg-id) (fn ,func-texp cont-f ,@arg-texp) ,@new-decl ,@add-decl ,def-nfunc ,@new-body) - ;;msc-main関数なら、main関数の定義を追加 + ;;msc-main∽違main∽違絎臂菴遵 (when (eq ~msc-main func-id) (list ~(%include "rule/multithread-main.sc"))))) )))) (otherwise @@ -154,7 +154,7 @@ ,@caller-resume (return)) ~((return ,return-exp)))))) ) - ;;; <--- マルチスレッド用プリミティブ + ;;; <--- 鴻c ((#?(thread-create ,@body)) (let* ((ln (1+ (length (mt:finfo-label mt:*current-func*)))) (label-l (generate-id (string+ "L" (write-to-string ln)))) @@ -214,13 +214,13 @@ ((#?(thread-resume ,exp)) (list (list ~(thr-resume ,exp)) (list ~(thr-resume ,exp))) ) - ;;; マルチスレッド用プリミティブ ---> + ;;; 鴻c ---> ;; expression-statement (otherwise (expression x)) ) -;;; thread-createの最初の宣言用 +;;; thread-create絎h (defrule mtcreate-decl multithread ((#?(,id[identifier] ,texp ,@init)) (mtcreate-decl (cons ~def x))) @@ -230,16 +230,16 @@ ;;;;;;;;;;; ;;; expression -;;; tmp.ruleの変換結果により、callは +;;; tmp.rule紊腟call ;;; (the void (call (the ,texp ,exp) ,@exp-list)) -;;; か、 +;;; ;;; (the ,texp (= (the ,texp ,id) (the ,texp (call (the ,texp ,exp) ,@exp-list))) -;;; のどちらかの形で現れるようになっている。 +;;; <綵≪х憗c (defrule expression multithread ;; function-call - ;; ・引数の値を保存 - ;; ・呼び出す関数のポインタも保存 + ;; 糸違ゃ篆絖 + ;; 糸若喝冴∽違ゃ潟帥篆絖 ((#? #1=(the ,texp (call (the (ptr (,fn-tag[function-tag] ,fexp1 ,@fexp)) ,exp-f) ,@arg-list)) #?(the ,texp0 (= (the ,texp1 ,id) #1#))) @@ -251,14 +251,14 @@ (renew-ln ~(= ln ,ln)) (label-stat ~(label ,label-l nil)) (tmp-id (if-pattern-variable id id nil)) - ;; 第1引数に入れ子関数へのポインタを追加 + ;; 膃1綣違ャ絖∽違吾ゃ潟帥菴遵 (call-exp ~(,exp-f ,nfunc-id ,@arg-list)) (new-exp (if-pattern-variable id ~(= ,id ,call-exp) call-exp))) (push (list label-l tmp-id) (mt:finfo-label mt:*current-func*)) (list (list renew-ln new-exp label-stat) (list renew-ln new-exp)) ))) - ;; その他の式,c-exp + ;; 篁綣鐚c-exp ((#?(the ,@rem)) (list (list x) (list x)) ) ((#?(c-exp ,@rem)) diff --git a/src/rule/multithread.sh b/src/rule/multithread.sh index eb16d27d..739ccdcc 100644 --- a/src/rule/multithread.sh +++ b/src/rule/multithread.sh @@ -32,28 +32,28 @@ (decl (struct _thstelm)) -;; 継続用入れ子関数の呼び出し理由 +;; 膓膓ャ絖∽違若喝冴 (deftype reason enum rsn-cont rsn-retval) -;; 継続用入れ子関数のポインタ +;; 膓膓ャ絖∽違ゃ潟 (deftype cont-f (ptr (NESTFUNC-TAG (ptr void) (ptr (struct _thstelm)) reason))) -;; スレッドの状態 +;; 鴻倶 (def (enum _stat) - ;; 停止中で,暗黙的継続も有効 + ;; 罩≫賢э藥膓膓 thr-new-suspended - ;; 実行可能で、暗黙的継続も有効 + ;; 絎茵純с藥膓膓 thr-new-runnable - ;; 停止中で、明示的継続のみ有効 + ;; 罩≫賢с腓榊膓膓炊 thr-suspended - ;; 実行可能で、明示的継続のみ有効 + ;; 絎茵純с腓榊膓膓炊 thr-runnable - ;; 明示的継続(cont-f c)は無効 + ;; 腓榊膓膓(cont-f c)≦ thr-scheduled) -;; スレッド管理用スタックの要素 +;; 鴻膊∞鴻帥荀膣 (def (struct _thstelm) (def c cont-f) (def stat (enum _stat))) @@ -63,24 +63,24 @@ (deftype thst-ptr (ptr (struct _thstelm))) (deftype cont thst-ptr) -;; スレッド管理用スタック +;; 鴻膊∞鴻帥 (def thst (array thstelm 65536)) -;; スレッド管理用スタックのトップ +;; 鴻膊∞鴻帥 (def thst-top thst-ptr thst) (deftype schdexit (ptr (NESTFUNC-TAG void))) -;; スケジューラの非局所脱出先 +;; 鴻宴吾ャ若絮怨阪 (def cur-schd-exit schdexit 0) (def cur-schd-thst-top thst-ptr thst) (def scheduling (fn void) (def L0 --label--) - ;;元のスケジューラの情報 + ;;鴻宴吾ャ若 (def prev-exit schdexit cur-schd-exit) (def prev-thst-top thst-ptr cur-schd-thst-top) - ;;このスケジュラの情報 + ;;鴻宴吾ャ (def mythst-top thst-ptr thst-top) (def nonlocalexit (NESTFUNC-TAG void) (goto L0)) @@ -89,15 +89,15 @@ (= cur-schd-thst-top (= thst-top mythst-top)) (while 1 (let ((cp thst-ptr)) - ;;ここで元のスケジューラへの非局所脱出を試みる + ;;у鴻宴吾ャ若吾絮怨冴荅帥 (for ((= cp prev-thst-top) (< cp mythst-top) (inc cp)) (if (!= (fref cp -> stat) thr-scheduled) (break)) - ;; 間が全て thr-scheduled なら + ;; thr-scheduled (if (== cp mythst-top) (if prev-exit (prev-exit))))) - ;; runnableなスレッドを探す + ;; runnable鴻「 (let ((cp thst-ptr) (cc cont-f)) (for ((= cp (- thst-top 1)) @@ -108,8 +108,8 @@ (break))) (if (< cp thst) (begin - ;; 見つからなかったときは他のプロセッサからの要求を処理すべし - ;; 今回は何もしない + ;; 荀ゃc篁祉泣荀羆鴻 + ;; 篁篏 (c-exp "fprintf(stderr, ~A)" "No Active thread!~%") (c-exp "exit(1)") )) @@ -118,12 +118,12 @@ (= (fref cp -> c) 0) (= (fref cp -> stat) thr-scheduled) (cc cp rsn-cont))) - ;;直下がnew-runnableならpopし、そちらに制御を移す + ;;岩new-runnablepop<九勝腱祉 (if (and (> thst-top thst) (== (fref (- thst-top 1) -> stat) thr-new-runnable)) (begin (dec thst-top) (break)))) - ;; 元のスケジューラの情報を戻す + ;; 鴻宴吾ャ若宴祉 (= cur-schd-exit prev-exit) (= cur-schd-thst-top prev-thst-top)) diff --git a/src/rule/nestfunc-defs.lsp b/src/rule/nestfunc-defs.lsp index 272cd88b..5b7cf794 100644 --- a/src/rule/nestfunc-defs.lsp +++ b/src/rule/nestfunc-defs.lsp @@ -52,51 +52,51 @@ (defstruct finfo - name ;関数名 - parent-func ;親関数のfinfo構造体(非nil iff 入れ子関数) - ret-type ;返り値の型 - argp ;argpの要/不要 (=入れ子関数呼び出しの有無) - ;; (<復帰位置を示すラベル名> . <フレーム復帰用コード>) のリスト(逆順) + name ;∽医 + parent-func ;荀∽違finfo罕篏鐚nil iff ャ絖∽逸 + ret-type ;菴ゃ + argp ;argp荀/筝荀 (=ャ絖∽医若喝冴) + ;; (<緇絽遺臀腓冴> . <若緇絽亥潟若>) 鴻() label-list ;; ( . ) - ;; frameには var-list #|と tmp-listの両方を|# 入れる - ;; (nf-list の orig-name も入れる) - ;; frame-save, frame-resume はvar-listのみ - ;; tmp-list は不要か? - var-list ;通常のローカル変数のリスト+関数のポインタ保存用 - tmp-list ;一時変数のリスト(call時の引数,入れ子関数ポインタ保存用) - nf-list ;定義された入れ子関数のリスト ( . ) - ;; 明示的スタックを参照するローカル変数.list of - ;; var-listと重複.入れ子関数は nf-listで管理するのでここには入れない - ;; search-ptr での収集方針により,var-listでないものも入り得る. + ;; frame var-list #| tmp-list筝≧鴻|# ャ + ;; 鐚nf-list orig-name ャ鐚 + ;; frame-save, frame-resume var-list + ;; tmp-list 筝荀鐚 + var-list ;絽吾若紊違鴻鐚∽違ゃ潟推絖 + tmp-list ;筝紊違鴻鐚call綣逸ャ絖∽違ゃ潟推絖鐚 + nf-list ;絎臂ャ絖∽違鴻 ( . ) + ;; 腓榊鴻帥с若紊逸list of + ;; var-list茲鐚ャ絖∽違 nf-listх∞сャ + ;; search-ptr с拷鐚var-listсャ緇鐚 estack-var - ;; staticで定義された変数 ( . ).var-listと重複. + ;; staticу臂紊 ( . )鐚var-list茲鐚 static-var - ;; 局所ラベルのリスト(def ,id __label__)で定義。入れ子関数脱出用 - ;; (<ラベル名> . <復帰コード>)。宣言と逆順 + ;; 絮鴻(def ,id __label__)у臂ャ絖∽域怨榊 + ;; (<> . <緇絽違潟若>)絎h local-label ) -;; フレーム構造体の管理 +;; 若罕篏膊∞ (defstruct frame-struct-info - name ; 構造体名 (SCのid) - func-name ; 対応する関数名 (SCのid) + name ; 罕篏 (SCid) + func-name ; 絲上∽医 (SCid) ) -;;; global関数名 +;;; global∽医 (defvar *global-funcs* '()) -;;; 関数フレームの構造体情報 -;;; ( <関数名(symbol)> . <構造体情報> ) のリスト -;;; <構造体情報> := ( <構造体名> ) +;;; ∽違若罕篏 +;;; ( <∽医(symbol)> . <罕篏> ) 鴻 +;;; <罕篏> := ( <罕篏> ) (defvar *frame-alist* '() ) -;;; 現在いる関数の情報 +;;; 憜∽違 (defvar *current-func* nil) (defvar *estack-size* 65536) (defvar *all-in-estack* nil) -;;;; 環境設定 +;;;; 医荐絎 (defmacro with-nestfunc-environment (&body body) `(let ((*global-funcs* '()) (*estack-size* (ruleset-param 'rule::estack-size)) @@ -106,7 +106,7 @@ ,@body)) -;;;; 関数 +;;;; ∽ (defun add-global-func (fid) (push fid *global-funcs*)) @@ -114,17 +114,17 @@ (defun global-func-p (fid) (member fid *global-funcs* :test #'eq)) -;;; マルチスレッド環境で,スタックの最初のフレームを判断する条件 +;;; 鴻医э鴻帥若ゆ>散 (defun thread-origin-p (finfo-or-fid) (let ((fid (if (symbolp finfo-or-fid) finfo-or-fid (finfo-name finfo-or-fid)))) (or (eq ~main fid) - (eq ~thread-origin fid)))) ; 不要か? + (eq ~thread-origin fid)))) ; 筝荀鐚 -;;; 関数名を*frame-alist*から探して関数フレームの構造体情報を得る。 -;;; 未登録の場合は登録して、登録した構造体情報を返す。 +;;; ∽医*frame-alist*「∽違若罕篏宴緇 +;;; 脂蚊翫脂蚊脂蚊罕篏宴菴 (defun get-frame (x) (let* ((asc (assoc x *frame-alist* :test #'eq))) (if asc @@ -135,34 +135,34 @@ (push (cons x frame-info) *frame-alist*) frame-info)))) -;;; 関数名=>関数のフレーム構造体名 +;;; ∽医=>∽違若罕篏 (defun get-frame-name (fname) (frame-struct-info-name (get-frame fname))) -;;; 現関数(親は含まない)のlocal-variableか? -;;; tmp-list内のもの,入れ子関数は検索対象ではない. +;;; 憥∽逸荀障鐚local-variable鐚 +;;; tmp-list鐚ャ絖∽違罎膣√乗院с鐚 (defun local-variable-p (id &optional (finfo *current-func*)) (and *current-func* (assoc id (finfo-var-list finfo) :test #'eq))) -;;; 現関数(親は含まない)の明示的スタックに値があるlocal-variableか? +;;; 憥∽逸荀障鐚腓榊鴻帥ゃlocal-variable鐚 (defun estack-variable-p (id &optional (finfo *current-func*) - (skip-lv-check nil)) ; local-variable-p のチェックを省略 + (skip-lv-check nil)) ; local-variable-p с (and (or skip-lv-check (local-variable-p id finfo)) (member id (finfo-estack-var finfo) :test #'eq))) -;;; 現関数(親は含まない)でstaticで定義されたlocal-variableか? -;;; そうなら,ext-idを返す. +;;; 憥∽逸荀障鐚staticу臂local-variable鐚 +;;; 鐚ext-id菴鐚 (defun static-variable-p (id &optional (finfo *current-func*) - (skip-lv-check nil)) ; local-variable-p のチェックを省略 + (skip-lv-check nil)) ; local-variable-p с (and (or skip-lv-check (local-variable-p id finfo)) (cdr (assoc id (finfo-static-var finfo) :test #'eq)))) -;;; 現関数(=0)からいくつ外の関数で定義された local-variable/nestfunc か? -;;; 見つからなければ -1 -;;; 第二返り値は local-varriable-> :var, nestfunc-> :nestfunc -;;; 第三返り値は 見つかった関数のfinfo -;;; 第四返り値は local-variable-p/nestfunc-extid の返り値 +;;; 憥∽(=0)ゅ∽違у臂 local-variable/nestfunc ? +;;; 荀ゃ -1 +;;; 膃篋菴ゃ local-varriable-> :var, nestfunc-> :nestfunc +;;; 膃筝菴ゃ 荀ゃc∽違finfo +;;; 膃菴ゃ local-variable-p/nestfunc-extid 菴 (defun howmany-outer (id &optional (finfo *current-func*)) (labels ((rec (curfunc acc) (acond @@ -175,7 +175,7 @@ (t (rec (finfo-parent-func curfunc) (1+ acc))) ))) (rec finfo 0))) -;;; 与えられた関数情報からフレーム構造体の定義を作る +;;; 筝∽井宴若罕篏絎臂篏 (defun make-frame-def (fi) (let* ((frm-info (get-frame (finfo-name fi))) (frame-name (frame-struct-info-name frm-info)) @@ -186,19 +186,19 @@ (member-defs (mapcar #'(lambda (x) ~(def ,(car x) ,(cdr x))) member-list))) ~(def (struct ,frame-name) - (def tmp-esp (ptr char)) ; これは、絶対に先頭 + (def tmp-esp (ptr char)) ; 腟九障 (def argp (ptr char)) (def call-id int) ,@member-defs))) -;;; 全ての関数フレーム構造体の宣言を作る +;;; ∽違若罕篏絎h篏 (defun make-all-frame-decls () - (nreverse ; nreverseは必須ではない + (nreverse ; nreverse綽с (loop for (fn-name . frm-info) in *frame-alist* collect (with1 frame-name (frame-struct-info-name frm-info) ~(decl (struct ,frame-name))))) ) -;;; トップレベルに追加する宣言の処理 +;;; 菴遵絎h (defvar *static-var-defs* ()) (defvar *frame-defs* ()) (defvar *nestfunc-defs* ()) @@ -221,7 +221,7 @@ (prog1 (nreverse *nestfunc-defs*) (setq *nestfunc-defs* ()))) -;;; ブロックの先頭に追加する宣言の処理 +;;; 菴遵絎h (defvar *additional-local-decls* ()) (defmacro with-new-block (&body body) `(let ((*additional-local-decls* ())) ,@body)) @@ -231,7 +231,7 @@ (prog1 (nreverse *additional-local-decls*) (setq *additional-local-decls* ()))) -;;; 各文の直前に追加する文の処理 +;;; 翫菴遵 (defvar *precedents* ()) (defmacro with-block-item (&body body) `(let ((*precedents* ())) ,@body)) @@ -241,37 +241,37 @@ (prog1 (nreverse *precedents*) (setq *precedents* ()))) -;;; 今トップレベルにいるかどうかの判定 +;;; 篁ゅ (defun top-level-p (&key (finfo *current-func*)) (not finfo)) -;;; --local-- で宣言された局所ラベルを追加 -;;; cons の cdr 部はフレーム復帰用コードで,後から追加 +;;; --local-- уh絮菴遵 +;;; cons cdr 若緇絽亥潟若э緇菴遵 (defun finfo-add-local-label (id &key (finfo *current-func*)) (push (cons id nil) (finfo-local-label finfo))) -;;; *current-func*に変数情報を追加して、declaration文を返す +;;; *current-func*紊井宴菴遵declaration菴 (defun finfo-add-local (id texp mode &key (init nil) (finfo *current-func*)) - ;; mode: :var or :temp + ;; mode鐚 :var or :temp (when finfo (case mode - ((:var) ; (estack-varでなければ)save/resume の対象 + ((:var) ; 鐚estack-varс逸save/resume 絲乗院 (when (let ((ttexp (remove-type-qualifier texp))) (or (and (listp ttexp) (eq ~array (car ttexp))) *all-in-estack*)) (pushnew id (finfo-estack-var finfo) :test #'eq)) (push (cons id texp) (finfo-var-list finfo))) - ((:tmp) ; save/resume の対象にならない + ((:tmp) ; save/resume 絲乗院 (push (cons id texp) (finfo-tmp-list finfo))) - ((:static) ; 外に出す.frameにも入れない. + ((:static) ; 紊冴鐚frameャ鐚 (let ((ext-id (generate-id (string+ (identifier0! id :sc2c) "_in_" (identifier0! (finfo-name finfo) :sc2c))))) (push (cons id texp) (finfo-var-list finfo)) (push (cons id ext-id) (finfo-static-var finfo)) - (setq id ext-id))) ; 名前を衝突しないように変更 - ((:system) ; 補助変数(特に副作用なし) + (setq id ext-id))) ; 茵腦紊 + ((:system) ; 茖紊逸鴻篏鐚 ) (otherwise (error "unexpected value of 'mode'(~s)" mode)))) @@ -279,22 +279,22 @@ ~(def ,id ,texp ,init) ~(def ,id ,texp))) -;;; *current-func* に入れ子関数情報を追加 +;;; *current-func* ャ絖∽井宴菴遵 (defun finfo-add-nestfunc (id extid &optional (finfo *current-func*)) (push (cons id extid) (finfo-nf-list finfo)) ) -;;; 次のcall-idの数字 +;;; 罨<call-id医 (defun finfo-next-call-id (&optional (finfo *current-func*)) (length (finfo-label-list finfo))) -;;; 復帰位置を示すラベルを追加.ラベル名を返す. +;;; 緇絽遺臀腓冴菴遵鐚菴鐚 (defun finfo-add-resume-label (&optional (finfo *current-func*) (base-name "L_CALL")) (with1 label-id (rule:generate-id base-name) (push (cons label-id nil) (finfo-label-list finfo)) label-id)) -;;; 与えられた関数情報から復帰処理を行うstatementを作る +;;; 筝∽井宴緇絽医茵statement篏 (defun make-resume (fi) (unless (or (finfo-label-list fi) (finfo-local-label fi)) @@ -303,10 +303,10 @@ (let ((reconst-impossible (or (eq ~main (finfo-name fi)) (finfo-parent-func fi) *all-in-estack*)) - ; スタックの積み直し中に成り得ない + ; 鴻帥腥睡眼筝緇 (case-goto (append - ;; 入れ子関数呼び出し終了後の復帰 + ;; ャ絖∽医若喝冴腟篋緇緇絽 (do ((ret nil) (k 0 (1+ k)) (lb (reverse (finfo-label-list fi)) (cdr lb))) @@ -315,7 +315,7 @@ ,@(cdar lb) (goto ,(caar lb))) ret)) - ;; gotoによる入れ子関数から親関数への脱出先 + ;; gotoャ絖∽違荀∽違吾怨阪 (do ((ret nil) (k -1 (1- k)) (lb (reverse (finfo-local-label fi)) (cdr lb))) @@ -341,7 +341,7 @@ ,@(when (finfo-label-list fi) ~( (goto ,(caar (last (finfo-label-list fi)))) ))))))) -;;; efp(xfp)の設定および espをフレームサイズ分移動させる +;;; efp(xfp)荐絎 esp若泣ゃ阪腱糸 (defun make-init-efp-esp (fi) (let ((frame-type ~(struct ,(get-frame-name (finfo-name fi))))) (list* @@ -352,17 +352,17 @@ (list ~(= (fref efp -> xfp) xfp) ))) )) -;;; parmp の初期値 +;;; parmp (defun make-parmp-init (&optional (all-in-estack *all-in-estack*)) ~(cast (ptr char) ,(if all-in-estack ~esp ~(bit-xor (cast size-t esp) esp-flag))) ) -;;; (*all-in-estack*時)引数の値をestackに保存 +;;; 鐚*all-in-estack*鐚綣違ゃestack篆絖 (defun save-args-into-estack (argid-list argtexp-list &optional (finfo *current-func*)) - ;; ちょっと手抜きで型情報 (the)なし + ;; <cу (the) (mapcar #'(lambda (id texp) (if (finfo-parent-func finfo) ~(= (fref efp -> ,id) (pop-arg ,texp parmp)) @@ -370,24 +370,24 @@ argid-list argtexp-list) ) -;;; 入れ子関数のid -> トップレベルに移した関数のid +;;; ャ絖∽違id -> 腱祉∽違id (defun make-extid (id &optional (pfinfo *current-func*)) (generate-id (string+ (identifier0! id :sc2c) "_in_" (identifier0! (finfo-name pfinfo) :sc2c))) ) -;;; idが現在の関数(親は除く)内で定義された入れ子関数か? -;;; もしそうなら,ext-name を返す +;;; id憜∽逸荀ゃ鐚у臂ャ絖∽違鐚 +;;; 鐚ext-name 菴 (defun nestfunc-extid (id &optional (finfo *current-func*)) (and *current-func* (cdr (assoc id (finfo-nf-list finfo) :test #'eq)))) -;;; 入れ子関数の参照 -> etackへの参照 -;;; (pfinfo: 親関数情報) +;;; ャ絖∽違 -> etack吾 +;;; 鐚pfinfo: 荀∽井縁 (defun nestfunc-in-estack (fid &optional (pfinfo *current-func*)) (declare (ignore pfinfo)) ~(ptr (fref efp -> ,fid))) -;;; 与えられた関数情報から入れ子関数を正規化するコードを作る +;;; 筝∽井宴ャ絖∽違罩h潟若篏 (defun make-normalize-nf (&optional (fi *current-func*)) (let ((nf-list (finfo-nf-list fi))) (apply #'nconc @@ -399,7 +399,7 @@ (cast (ptr void) efp)) )) nf-list)))) -;;; 与えられた関数情報からフレーム情報を保存するコードを作る +;;; 筝∽井宴若宴篆絖潟若篏 (defun make-frame-save (&optional (fi *current-func*)) (mapcar #'(lambda (x) @@ -409,7 +409,7 @@ (eq ~closure-t (cdr x)))) (finfo-var-list fi)))) -;;; 与えられた関数情報からフレーム情報を復活するコードを作る +;;; 筝∽井宴若宴緇羇祉潟若篏 (defun make-frame-resume (&optional (fi *current-func*)) (mapcar #'(lambda (x) @@ -419,7 +419,7 @@ (eq ~closure-t (cdr x)))) (finfo-var-list fi)))) -;;; 与えられた関数情報から関数中断用のreturnを生成するコードを作る +;;; 筝∽井宴∽遺賢return潟若篏 (defun make-suspend-return (&optional (fi *current-func*)) (cond ((finfo-parent-func fi) ;;~(return (fref efp -> tmp-esp))) @@ -429,11 +429,11 @@ (t ~(return (SPECIAL ,(finfo-ret-type *current-func*)))))) -;;; 与えられたラベル名が、親関数の局所ラベルとして定義されているか調べる。 -;;; 定義されていなければ,返り値はnil。定義されていれば、 -;;; (values <自分からみて何番目の親関数に定義されていたか> -;;; <その定義 (