文書整形 -- 大域変数2016年11月09日 18:49

大域変数は、3つの名前付き領域からなる。

  • cparam -- 共通パラメーター
  • cpage -- ページパラメーター
  • cout -- 出力状況パラメーター

RATFORでは、以下の通り

# cparam.ri -- common parameter
      common /cparam/fill,lsval,inval,rmval,tival,ceval,ulval
      integer fill  # fill if YES; init = YES
      integer lsval # current line spacing; init = 1
      integer inval # current indent;  >=0; init = 0
      integer rmval # current right margin; init PAGEWIDTH
      integer tival # current temporary indent; init = 0
      integer ceval # number of lines to center; init = 0
      integer ulval # number of lines to underline; init = 0

# cpage.ri -- page paramete
      common /cpage/curpag,newpag,lineno,plval,
     $              m1val,m2val,m3val,m4val,
     $              bottom,header,footer
      character header(MAXLINE) ! top of page title; init = NEWLINE
      character footer(MAXLINE) ! bottom of pagetitle; init = NEWLINE

      integer curpag ! current output page number; init = 0
      integer newpag ! next output page number; init = 1
      integer lineno ! next line to be printed; init = 0
      integer plval  ! page length in lines; init = PAGELEN
      integer m1val  ! margin before and includeing header
      integer m2val  ! margin after header
      integer m3val  ! margin after last test line
      integer m4val  ! bottom margin, including footer
      integer bottom ! last live line on page, = plval - m3val - m4val

# cout.ri
      common /cout/outp,outw,outwds,outbuf
      character outbuf(MAXOUT) # lines to be filled collected here
      integer outp    # last character position in outbuf; init = 0
      integer outw    # width of test currency in outbuf; init = 0
      integer outwds  # number of words in outbuf; init = 0

WATCOM fortran 77では、以下の通り。

c cparam.fi -- common parameter
      common /cparam/fill,lsval,inval,rmval,tival,ceval,ulval
      integer fill  ! fill if YES; init = YES
      integer lsval ! current line spacing; init = 1
      integer inval ! current indent;  >=0; init = 0
      integer rmval ! current right margin; init PAGEWIDTH
      integer tival ! current temporary indent; init = 0
      integer ceval ! number of lines to center; init = 0
      integer ulval ! number of lines to underline; init = 0

c cpage.fi -- page paramete
      common /cpage/curpag,newpag,lineno,plval,
     $              m1val,m2val,m3val,m4val,
     $              bottom,header,footer
      integer*1 header(82) ! top of page title; init = NEWLINE MAXLINE(82)
      integer*1 footer(82) ! bottom of pagetitle; init = NEWLINE MAXLINE(82)

      integer curpag ! current output page number; init = 0
      integer newpag ! next output page number; init = 1
      integer lineno ! next line to be printed; init = 0
      integer plval  ! page length in lines; init = PAGELEN
      integer m1val  ! margin before and includeing header
      integer m2val  ! margin after header
      integer m3val  ! margin after last test line
      integer m4val  ! bottom margin, including footer
      integer bottom ! last live line on page, = plval - m3val - m4val

c cout.fi
      common /cout/outp,outw,outwds,outbuf
      integer*1 outbuf(242) ! lines to be filled collected here MAXOUT(242)
      integer outp   ! last character position in outbuf; init = 0
      integer outw   ! width of test currency in outbuf; init = 0
      integer outwds ! number of words in outbuf; init = 0