コードの改修 -- ファイルのオープン(一部修正) ― 2017年08月10日 17:07
WATCOM fortran 77版Ratforプリプロセッサが、動き出しましたので、 実際に、Ratforで書かれたツールの動作テストを行っています。やはり、例外なく、 プログラムのミスで不具合が出ていますので、これを修正しながら、Ratfor版の ツールの完成を目指しています。
基本的なファイル操作fopen()に不具合がありましたので、改修したコードを 掲載します。
改修したRatfor版のfopen()は以下の通りです。
# fopen.r4 -- connect internal file despter and external file include ratfor.mac integer function fopen(uid,fn,act) integer act,uid character fn(ARB) [character]*MAXLINE cfn include files call is2cs(fn,cfn,MAXLINE) for (uid = 1; uid <= MAXFILES; uid = uid + 1) if (finuse(uid) == NOUSE) { if (act == READ) { open(unit=uid,file=cfn,action='[READ]',status='[OLD]',err=99) uid = uid finuse(uid) = INUSE flastcr(uid) = MAXLINE fbuf(uid,MAXLINE) = NEWLINE fnew(uid) = NO fmode(uid) = act } else if (act == WRITE) { open(unit=uid,file=cfn,action='[WRITE]',status='[UNKNOWN]',err=99) uid = uid finuse(uid) = INUSE flastcw(uid) = 0 fmode(uid) = act } else if (act == READWRITE) { open(unit=uid,file=cfn,action='[READWRITE]',status='[OLD]',err=99) uid = uid finuse(uid) = INUSE flastcr(uid) = MAXLINE flastcw(uid) = 0 fbuf(uid,MAXLINE) = NEWLINE fnew(uid) = NO fmode(uid) = act } else { # error uid = ERR fopen = ERR return } fopen = uid return } 99 continue uid = ERR fopen = ERR return end
WATCOM fotran77版のfopen()は以下の通りです。
c fopen.f -- connect internal file descripter and external file include ratfor.def integer function fopen(uid,fname,act) integer uid integer*1 act,fname(ARB) character*MAXLINE cfn include files.fi call is2cs(fname,cfn,MAXLINE) uid = 1 while (uid .le. MAXFILES) do if (finuse(uid) .eq. NOUSE) then if (act .eq. READ) then open(unit=uid,file=cfn,action='READ', 1 status='OLD',err=99) fopen = uid finuse(uid) = INUSE flastcr(uid) = MAXLINE fbuf(uid,MAXLINE) = NEWLINE fnew(uid) = NO fmode(uid) = act else if (act .eq. WRITE) then open(unit=uid,file=cfn,action='WRITE', 1 status='UNKNOWN',err=99) fopen = uid finuse(uid) = INUSE flastcw(uid) = 0 fmode(uid) = act else if (act .eq. READWRITE) then open(unit=uid,file=cfn,action='READWRITE', 1 status='OLD',err=99) fopen = uid finuse(uid) = INUSE flastcr(uid) = MAXLINE flastcw(uid) = 0 fbuf(uid,MAXLINE) = NEWLINE fnew(uid) = NO fmode(uid) = act else ! error uid = ERR fopen = uid end if return endif uid = uid + 1 end while 99 continue uid = ERR fopen = ERR return end
これ以外にも、単純なタイプミスも含めて、多くの修正点があります。 近くに、まとめてご紹介できるよう考えています。
コメント
_ How much does it cost to lengthen your legs? ― 2017年08月31日 20:47
_ choc ― 2018年04月30日 14:45
always i used to read smaller posts that also clear their motive,
and that is also happening with this post which I am reading now.
and that is also happening with this post which I am reading now.
_ choc ― 2018年05月03日 18:32
If some one wants to be updated with newest technologies after that
he must be go to see this website and be up to date all the time.
he must be go to see this website and be up to date all the time.
コメントをどうぞ
※メールアドレスとURLの入力は必須ではありません。 入力されたメールアドレスは記事に反映されず、ブログの管理者のみが参照できます。
トラックバック
このエントリのトラックバックURL: http://kida.asablo.jp/blog/2017/08/10/8644034/tb
been doing a little research on this. And he actually ordered me breakfast simply because I found it for him...
lol. So let me reword this.... Thank YOU for the meal!! But yeah,
thanks for spending the time to talk about this matter here on your web site.