CONGEN  5.0
Configuration generation for SCATCI
congen_pagecontrol.f90
Go to the documentation of this file.
1 ! Copyright 2019
2 !
3 ! For a comprehensive list of the developers that contributed to these codes
4 ! see the UK-AMOR website.
5 !
6 ! This file is part of UKRmol-in (UKRmol+ suite).
7 !
8 ! UKRmol-in is free software: you can redistribute it and/or modify
9 ! it under the terms of the GNU General Public License as published by
10 ! the Free Software Foundation, either version 3 of the License, or
11 ! (at your option) any later version.
12 !
13 ! UKRmol-in is distributed in the hope that it will be useful,
14 ! but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ! GNU General Public License for more details.
17 !
18 ! You should have received a copy of the GNU General Public License
19 ! along with UKRmol-in (in source/COPYING). Alternatively, you can also visit
20 ! <https://www.gnu.org/licenses/>.
27 
28  implicit none
29 
30  ! subroutines used from other modules
31  public addl
32  public ctlpg1
33  public newpg
34  public space
35  public taddl
36  public taddl1
37 
38 contains
39 
49  subroutine addl (lines)
50 
51  use global_utils, only : getin
52  use congen_data, only : head, lppr, lppmax, npage, nftw
53 
54  integer, intent(in) :: lines
55 
56  lppr = lppr + lines
57 
58  if (lppr > lppmax) then
59  lppr = lines
60  npage = mod(npage + 1, 1000)
61 
62  ! JMC this is putting the max. 3-digit number npage into the last 3 elements of HEAD
63  call getin (npage, 3, head(size(head) - 2), 1)
64  write(nftw, '("1",132A1,/)') head
65  end if
66 
67  end subroutine addl
68 
69 
72  subroutine ctlpg1 (lpp, h1, nh1, h2, nh2)
73 
74  use congen_data, only : head, lppr, lppmax, npage
75 
76  integer :: lpp, nh1, nh2
77  character(len=1), dimension(nh1) :: h1
78  character(len=1), dimension(nh2) :: h2
79  intent (in) h1, h2, lpp, nh1, nh2
80 
81  character(len=1) :: blank = ' '
82  integer :: i, il, im, ip
83  character(len=1), dimension(4) :: page = (/ 'P', 'A', 'G', 'E' /)
84 
85  lppmax = lpp
86  if (lpp <= 0 .or. lpp > 60) lppmax = 60 ! JMC this line sets the default value for LPPMAX (see item LPP in the documentation)
87  lppr = lppmax
88  npage = 0
89  do i = 1, size(head)
90  head(i) = blank
91  end do
92 
93  im = min(nh1, 120)
94  head(1:im) = h1(1:im)
95 
96  if (im /= 120) then
97  il = im + 1
98  im = min(im + nh2, 120)
99  ip = 0
100  do i = il, im
101  ip = ip + 1
102  head(i) = h2(ip)
103  end do
104  end if
105 
106  im = size(head) - 8 ! JMC changing from 124, as the last 8 elements of HEAD will contain 'PAGE' then ' ' then a 3-digit number
107 
108  do i = 1, 4
109  im = im + 1
110  head(im) = page(i)
111  end do
112 
113  end subroutine ctlpg1
114 
115 
120  subroutine newpg
121 
122  use global_utils, only : getin
123  use congen_data, only : head, lppr, npage, nftw
124 
125  lppr = 0
126  npage = mod(npage + 1, 1000)
127 
128  ! JMC this is putting the max. 3-digit number npage into the last 3 elements of HEAD
129  call getin (npage, 3, head(size(head) - 2), 1)
130 
131  write(nftw, '("1",132A1,/)') head
132 
133  end subroutine newpg
134 
135 
143  subroutine space (lines)
144 
145  use congen_data, only : lppr, lppmax, nftw
146 
147  integer, intent(in) :: lines
148 
149  integer :: j
150 
151  lppr = lppr + lines
152 
153  if (lppr < lppmax) then
154  do j = 1, lines
155  write(nftw, '(" ")')
156  end do
157  end if
158 
159  end subroutine space
160 
161 
169  subroutine taddl (lines, lt)
170 
171  use congen_data, only : lppr, lppmax
172 
173  integer, intent(in) :: lines
174  integer, intent(out) :: lt
175 
176  lt = 0
177  if (lppr + lines <= lppmax) then
178  lppr = lppr + lines
179  lt = 1
180  end if
181 
182  end subroutine taddl
183 
184 
192  subroutine taddl1 (lines, lt)
193 
194  use congen_data, only : lppr, lppmax
195 
196  integer :: lines, lt
197  intent (in) lines
198  intent (out) lt
199 
200  lt = 0
201  if (lppr + lines > lppmax) return
202  lt = 1
203 
204  end subroutine taddl1
205 
206 
207 end module
congen_pagecontrol::ctlpg1
subroutine, public ctlpg1(lpp, h1, nh1, h2, nh2)
Controls page layout and counting.
Definition: congen_pagecontrol.f90:73
congen_pagecontrol
Page control.
Definition: congen_pagecontrol.f90:26
congen_data::lppmax
integer lppmax
Pagination limit - how many lines between two headers.
Definition: congen_data.f90:70
congen_data::lppr
integer lppr
Global output line counter – number of lines on current page.
Definition: congen_data.f90:71
congen_data::npage
integer npage
Page counter, currently limited to 3 digits (see congen_pagecontrol::addl).
Definition: congen_data.f90:72
congen_pagecontrol::taddl
subroutine, public taddl(lines, lt)
Add blank lines to output.
Definition: congen_pagecontrol.f90:170
congen_data::nftw
integer nftw
Unit number for printing; may be changed via the STATE namelist so not a parameter.
Definition: congen_data.f90:57
congen_pagecontrol::space
subroutine, public space(lines)
Add blank lines to output.
Definition: congen_pagecontrol.f90:144
congen_pagecontrol::taddl1
subroutine, public taddl1(lines, lt)
Check available lines.
Definition: congen_pagecontrol.f90:193
congen_data
Module containing parameters / data required throughout the CONGEN program.
Definition: congen_data.f90:32
congen_data::head
character(len=1), dimension(132) head
String with output page number and user-specific header text.
Definition: congen_data.f90:69
congen_pagecontrol::newpg
subroutine, public newpg
Start new page of output.
Definition: congen_pagecontrol.f90:121
congen_pagecontrol::addl
subroutine, public addl(lines)
Add blank lines to output.
Definition: congen_pagecontrol.f90:50