Ratforプリプロセッサー -- コード生成 "while" ― 2017年06月24日 18:26
while文にであったら、whileの条件を取り出して、ラベルL、L+1を 作りだし、
continue L if ( .not. (条件)) goto L+1を出力します。そして、whileの終わりに達したら、
goto L L+1 continueを出力します。ここで、ラベルL+1は、breakに出会ったときの行き先になります。また、ラベルLは、 nextに出会った時の行き先になります。 具体的には、whilec()でwhile文のはじめを生成します。
whilec()のRatofor版は以下の通り。
# whilec.r4 -- generate code for beginning of while subroutine whilec(lab) integer lab call outcon(0) lab = labgen(2) call outnum(lab) call ifgo(lab+1) return end
WATCOM Fortran77版は以下の通り。
c whilec.f -- generate code for beginning of while subroutine whilec(lab) integer lab call outcon(0) lab = labgen(2) call outnum(lab) call ifgo(lab+1) return end
whileの終わりは、whiles()でコードを生成します。
whiles()のRatofor版は以下の通り。
# whiles.r4 -- generate code for end of while subroutine whiles(lab) integer lab call outgo(lab) call outcon(lab+1) return end
WATCOM Fortran77版は以下の通り。
c whiles.f -- generate code for end of while subroutine whiles(lab) integer lab call outgo(lab) call outcon(lab+1) return end
最近のコメント