• #### Re: is there a better way to code this ?

From gah4@21:1/5 to Lynn McGuire on Sun Jun 12 16:05:48 2022
On Sunday, June 12, 2022 at 3:46:32 PM UTC-7, Lynn McGuire wrote:
So, is there a better way to code this ?

C CHECK THE COMMANDS WHICH SHOULD HAVE EQUAL SIGN
C 10 - no equal sign required
C 11 - equal sign required
C
LEQUL=.TRUE.
IF (ICEP .GT. 100) GO TO 1002
C ICEP = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
GO TO( 10, 11, 11, 10, 10, 11, 11, 11, 10, 11, 10, 11, 11, 10, 10,
C ICEP = 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
* 10, 10, 11, 11, 11, 10, 10, 10, 10, 11, 10, 11, 11, 11, 11,
C ICEP = 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
* 11, 10, 11, 11, 11, 11, 11, 11, 11, 11, 10, 10, 10, 10, 11,
C ICEP = 46 47 48 79 50
* 10, 11, 11, 11, 11,
C ICEP = 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
* 10, 10, 11, 11, 10, 11, 11, 10, 11, 11, 10, 11, 10, 11, 11,
C ICEP = 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
* 11, 10, 10, 11, 10, 11, 11, 10, 11, 11, 11, 11, 11, 11, 11,
C ICEP 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
* 11, 11, 10, 10, 11, 11, 11, 11, 11, 10, 10, 10, 10, 11, 11,
C ICEP 96 97 98 99 100
* 11, 10, 10, 11, 11), icep
1002 IF (ICEP .GT. 200) GO TO 1004
NN = ICEP - 100
C ICEP = 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
GO TO( 11, 10, 10, 10, 11, 11, 11, 10, 10, 10, 10, 10, 10, 10, 10,
C ICEP 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
* 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
C ICEP 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
* 11, 11, 11, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11,
C ICEP 146 147 148 149 150
* 11, 10, 11, 11, 11,
C ICEP = 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165
* 10, 11, 11, 11, 11, 11, 11, 11, 11, 10, 11, 11, 11, 10, 11,
C ICEP 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180
* 11, 10, 10, 10, 10, 10, 10, 10, 11, 10, 11, 11, 11, 10, 11,
C ICEP 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195
* 11, 11, 11, 11, 10, 10, 10, 10, 10, 10, 11, 11, 11, 10, 11,
C 196 197 198 199 200
* 11, 11, 11, 11, 10), NN
1004 IF (ICEP .GT. 300) goto 1006
NN = ICEP - 200
C ICEP = 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215
GO TO( 11, 10, 11, 11, 11, 11, 10, 11, 11, 11, 10, 10, 11, 11, 10,
C 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230
* 11, 11, 11, 11, 10, 10, 10, 10, 11, 10, 10, 10, 10, 11, 11,
C 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245
* 11, 11, 11, 11, 11, 10, 11, 10, 10, 10, 11, 11, 11, 11, 10,
C 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260
* 11, 11, 11, 10, 11, 11, 10, 10, 10, 11, 11, 11, 11, 11, 11,
C 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275
* 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 10, 11,
C 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290
* 10, 11, 10, 10, 10, 10, 10, 11, 11, 10, 11, 11, 11, 10, 11,
C 291 292 293 294 295 296 297 298 299 300
* 11, 11, 11, 10, 10, 10, 10, 10, 10, 10), NN
1006 IF (ICEP .GT. gen_maxcep) GO TO 1111
NN = ICEP - 300
C 301 302 303 304 305 306 307 308 309 310
GO TO ( 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
C 311 312 313 314 315 316 317 318 319 320
* 11, 11, 11, 11, 11, 10, 10, 10, 10, 10,
C 321 322 323 324 325 326 327 328 329 330
* 10, 10, 10, 10, 10, 10, 10, 10, 11, 11,
C 331 332 333 334 335 336 337 338 339 340
* 10, 10, 11, 11, 11, 11, 10, 10, 10, 10,
C 341 342 343 344 345 346 347 348 349 350
* 11, 11, 11, 11, 10, 11, 11, 11, 10, 10 ), NN

Thanks,
Lynn

Since there are only two places to go, a look-up table
and then a two-way branch would do it.

You could even us the same values as array initializers
instead, and then make the branch based on 10 or 11.

It is probably about the same in speed.

--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)
• From Lynn McGuire@21:1/5 to All on Sun Jun 12 17:46:26 2022
So, is there a better way to code this ?

C CHECK THE COMMANDS WHICH SHOULD HAVE EQUAL SIGN
C 10 - no equal sign required
C 11 - equal sign required
C
LEQUL=.TRUE.
IF (ICEP .GT. 100) GO TO 1002
C ICEP = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
GO TO( 10, 11, 11, 10, 10, 11, 11, 11, 10, 11, 10, 11, 11, 10, 10,
C ICEP = 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
* 10, 10, 11, 11, 11, 10, 10, 10, 10, 11, 10, 11, 11, 11, 11,
C ICEP = 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
* 11, 10, 11, 11, 11, 11, 11, 11, 11, 11, 10, 10, 10, 10, 11,
C ICEP = 46 47 48 79 50
* 10, 11, 11, 11, 11,
C ICEP = 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
* 10, 10, 11, 11, 10, 11, 11, 10, 11, 11, 10, 11, 10, 11, 11,
C ICEP = 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
* 11, 10, 10, 11, 10, 11, 11, 10, 11, 11, 11, 11, 11, 11, 11,
C ICEP 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
* 11, 11, 10, 10, 11, 11, 11, 11, 11, 10, 10, 10, 10, 11, 11,
C ICEP 96 97 98 99 100
* 11, 10, 10, 11, 11), icep
1002 IF (ICEP .GT. 200) GO TO 1004
NN = ICEP - 100
C ICEP = 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
GO TO( 11, 10, 10, 10, 11, 11, 11, 10, 10, 10, 10, 10, 10, 10, 10,
C ICEP 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
* 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
C ICEP 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
* 11, 11, 11, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11,
C ICEP 146 147 148 149 150
* 11, 10, 11, 11, 11,
C ICEP = 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165
* 10, 11, 11, 11, 11, 11, 11, 11, 11, 10, 11, 11, 11, 10, 11,
C ICEP 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180
* 11, 10, 10, 10, 10, 10, 10, 10, 11, 10, 11, 11, 11, 10, 11,
C ICEP 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195
* 11, 11, 11, 11, 10, 10, 10, 10, 10, 10, 11, 11, 11, 10, 11,
C 196 197 198 199 200
* 11, 11, 11, 11, 10), NN
1004 IF (ICEP .GT. 300) goto 1006
NN = ICEP - 200
C ICEP = 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215
GO TO( 11, 10, 11, 11, 11, 11, 10, 11, 11, 11, 10, 10, 11, 11, 10,
C 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230
* 11, 11, 11, 11, 10, 10, 10, 10, 11, 10, 10, 10, 10, 11, 11,
C 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245
* 11, 11, 11, 11, 11, 10, 11, 10, 10, 10, 11, 11, 11, 11, 10,
C 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260
* 11, 11, 11, 10, 11, 11, 10, 10, 10, 11, 11, 11, 11, 11, 11,
C 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275
* 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 10, 11,
C 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290
* 10, 11, 10, 10, 10, 10, 10, 11, 11, 10, 11, 11, 11, 10, 11,
C 291 292 293 294 295 296 297 298 299 300
* 11, 11, 11, 10, 10, 10, 10, 10, 10, 10), NN
1006 IF (ICEP .GT. gen_maxcep) GO TO 1111
NN = ICEP - 300
C 301 302 303 304 305 306 307 308 309 310
GO TO ( 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
C 311 312 313 314 315 316 317 318 319 320
* 11, 11, 11, 11, 11, 10, 10, 10, 10, 10,
C 321 322 323 324 325 326 327 328 329 330
* 10, 10, 10, 10, 10, 10, 10, 10, 11, 11,
C 331 332 333 334 335 336 337 338 339 340
* 10, 10, 11, 11, 11, 11, 10, 10, 10, 10,
C 341 342 343 344 345 346 347 348 349 350
* 11, 11, 11, 11, 10, 11, 11, 11, 10, 10 ), NN

Thanks,
Lynn

--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)
• From gah4@21:1/5 to All on Sun Jun 12 19:07:08 2022
C CHECK THE COMMANDS WHICH SHOULD HAVE EQUAL SIGN
C 10 - no equal sign required
C 11 - equal sign required

integer needs(35)
data needs/
C ICEP = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
* 10, 11, 11, 10, 10, 11, 11, 11, 10, 11, 10, 11, 11, 10, 10,
C ICEP = 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
* 10, 10, 11, 11, 11, 10, 10, 10, 10, 11, 10, 11, 11, 11, 11,
C ICEP = 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
* 11, 10, 11, 11, 11, 11, 11, 11, 11, 11, 10, 10, 10, 10, 11,
C ICEP = 46 47 48 79 50
* 10, 11, 11, 11, 11,
C ICEP = 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
* 10, 10, 11, 11, 10, 11, 11, 10, 11, 11, 10, 11, 10, 11, 11,
C ICEP = 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
* 11, 10, 10, 11, 10, 11, 11, 10, 11, 11, 11, 11, 11, 11, 11,
C ICEP 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
* 11, 11, 10, 10, 11, 11, 11, 11, 11, 10, 10, 10, 10, 11, 11,
C ICEP 96 97 98 99 100
* 11, 10, 10, 11, 11,
C ICEP = 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
* 11, 10, 10, 10, 11, 11, 11, 10, 10, 10, 10, 10, 10, 10, 10,
C ICEP 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
* 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
C ICEP 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
* 11, 11, 11, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11,
C ICEP 146 147 148 149 150
* 11, 10, 11, 11, 11,
C ICEP = 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165
* 10, 11, 11, 11, 11, 11, 11, 11, 11, 10, 11, 11, 11, 10, 11,
C ICEP 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180
* 11, 10, 10, 10, 10, 10, 10, 10, 11, 10, 11, 11, 11, 10, 11,
C ICEP 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195
* 11, 11, 11, 11, 10, 10, 10, 10, 10, 10, 11, 11, 11, 10, 11,
C 196 197 198 199 200
* 11, 11, 11, 11, 10,
C ICEP = 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215
* 11, 10, 11, 11, 11, 11, 10, 11, 11, 11, 10, 10, 11, 11, 10,
C 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230
* 11, 11, 11, 11, 10, 10, 10, 10, 11, 10, 10, 10, 10, 11, 11,
C 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245
* 11, 11, 11, 11, 11, 10, 11, 10, 10, 10, 11, 11, 11, 11, 10,
C 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260
* 11, 11, 11, 10, 11, 11, 10, 10, 10, 11, 11, 11, 11, 11, 11,
C 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275
* 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 10, 11,
C 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290
* 10, 11, 10, 10, 10, 10, 10, 11, 11, 10, 11, 11, 11, 10, 11,
C 291 292 293 294 295 296 297 298 299 300
* 11, 11, 11, 10, 10, 10, 10, 10, 10, 10,
C 301 302 303 304 305 306 307 308 309 310
* 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
C 311 312 313 314 315 316 317 318 319 320
* 11, 11, 11, 11, 11, 10, 10, 10, 10, 10,
C 321 322 323 324 325 326 327 328 329 330
* 10, 10, 10, 10, 10, 10, 10, 10, 11, 11,
C 331 332 333 334 335 336 337 338 339 340
* 10, 10, 11, 11, 11, 11, 10, 10, 10, 10,
C 341 342 343 344 345 346 347 348 349 350
* 11, 11, 11, 11, 10, 11, 11, 11, 10, 10 /

--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)
• From gah4@21:1/5 to All on Sun Jun 12 19:06:17 2022
C CHECK THE COMMANDS WHICH SHOULD HAVE EQUAL SIGN
C 10 - no equal sign required
C 11 - equal sign required

integer needs(350)
data needs/
C ICEP = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
* 10, 11, 11, 10, 10, 11, 11, 11, 10, 11, 10, 11, 11, 10, 10,
C ICEP = 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
* 10, 10, 11, 11, 11, 10, 10, 10, 10, 11, 10, 11, 11, 11, 11,
C ICEP = 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
* 11, 10, 11, 11, 11, 11, 11, 11, 11, 11, 10, 10, 10, 10, 11,
C ICEP = 46 47 48 79 50
* 10, 11, 11, 11, 11,
C ICEP = 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
* 10, 10, 11, 11, 10, 11, 11, 10, 11, 11, 10, 11, 10, 11, 11,
C ICEP = 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
* 11, 10, 10, 11, 10, 11, 11, 10, 11, 11, 11, 11, 11, 11, 11,
C ICEP 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
* 11, 11, 10, 10, 11, 11, 11, 11, 11, 10, 10, 10, 10, 11, 11,
C ICEP 96 97 98 99 100
* 11, 10, 10, 11, 11,
C ICEP = 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
* 11, 10, 10, 10, 11, 11, 11, 10, 10, 10, 10, 10, 10, 10, 10,
C ICEP 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
* 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
C ICEP 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
* 11, 11, 11, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11,
C ICEP 146 147 148 149 150
* 11, 10, 11, 11, 11,
C ICEP = 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165
* 10, 11, 11, 11, 11, 11, 11, 11, 11, 10, 11, 11, 11, 10, 11,
C ICEP 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180
* 11, 10, 10, 10, 10, 10, 10, 10, 11, 10, 11, 11, 11, 10, 11,
C ICEP 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195
* 11, 11, 11, 11, 10, 10, 10, 10, 10, 10, 11, 11, 11, 10, 11,
C 196 197 198 199 200
* 11, 11, 11, 11, 10,
C ICEP = 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215
* 11, 10, 11, 11, 11, 11, 10, 11, 11, 11, 10, 10, 11, 11, 10,
C 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230
* 11, 11, 11, 11, 10, 10, 10, 10, 11, 10, 10, 10, 10, 11, 11,
C 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245
* 11, 11, 11, 11, 11, 10, 11, 10, 10, 10, 11, 11, 11, 11, 10,
C 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260
* 11, 11, 11, 10, 11, 11, 10, 10, 10, 11, 11, 11, 11, 11, 11,
C 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275
* 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 10, 11,
C 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290
* 10, 11, 10, 10, 10, 10, 10, 11, 11, 10, 11, 11, 11, 10, 11,
C 291 292 293 294 295 296 297 298 299 300
* 11, 11, 11, 10, 10, 10, 10, 10, 10, 10,
C 301 302 303 304 305 306 307 308 309 310
* 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
C 311 312 313 314 315 316 317 318 319 320
* 11, 11, 11, 11, 11, 10, 10, 10, 10, 10,
C 321 322 323 324 325 326 327 328 329 330
* 10, 10, 10, 10, 10, 10, 10, 10, 11, 11,
C 331 332 333 334 335 336 337 338 339 340
* 10, 10, 11, 11, 11, 11, 10, 10, 10, 10,
C 341 342 343 344 345 346 347 348 349 350
* 11, 11, 11, 11, 10, 11, 11, 11, 10, 10 /

--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)
• From pmk@21:1/5 to Lynn McGuire on Sun Jun 12 18:40:14 2022
integer, parameter :: cmdsNeedingEq(*) = [2,3, 6, 7, 8, 10, 12, 13, &
! und so weiter...
346, 347, 348 ]
integer, parameter :: gen_maxcep = 350
logical, parameter :: cmdNeedsEq(*) = [(any(j==cmdsNeedingEq),j=1,gen_maxcep)] ! ...
lequl = .false. ! unless I have reversed the logic
if (icep >= 1 .and. icep <= gen_maxcep) lequl = cmdNeedsEq(icep)

On Sunday, June 12, 2022 at 3:46:32 PM UTC-7, Lynn McGuire wrote:
So, is there a better way to code this ?

C CHECK THE COMMANDS WHICH SHOULD HAVE EQUAL SIGN
C 10 - no equal sign required
C 11 - equal sign required
C
LEQUL=.TRUE.
IF (ICEP .GT. 100) GO TO 1002
C ICEP = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
GO TO( 10, 11, 11, 10, 10, 11, 11, 11, 10, 11, 10, 11, 11, 10, 10,
C ICEP = 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
* 10, 10, 11, 11, 11, 10, 10, 10, 10, 11, 10, 11, 11, 11, 11,
C ICEP = 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
* 11, 10, 11, 11, 11, 11, 11, 11, 11, 11, 10, 10, 10, 10, 11,
C ICEP = 46 47 48 79 50
* 10, 11, 11, 11, 11,
C ICEP = 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
* 10, 10, 11, 11, 10, 11, 11, 10, 11, 11, 10, 11, 10, 11, 11,
C ICEP = 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
* 11, 10, 10, 11, 10, 11, 11, 10, 11, 11, 11, 11, 11, 11, 11,
C ICEP 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
* 11, 11, 10, 10, 11, 11, 11, 11, 11, 10, 10, 10, 10, 11, 11,
C ICEP 96 97 98 99 100
* 11, 10, 10, 11, 11), icep
1002 IF (ICEP .GT. 200) GO TO 1004
NN = ICEP - 100
C ICEP = 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
GO TO( 11, 10, 10, 10, 11, 11, 11, 10, 10, 10, 10, 10, 10, 10, 10,
C ICEP 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
* 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
C ICEP 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
* 11, 11, 11, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11,
C ICEP 146 147 148 149 150
* 11, 10, 11, 11, 11,
C ICEP = 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165
* 10, 11, 11, 11, 11, 11, 11, 11, 11, 10, 11, 11, 11, 10, 11,
C ICEP 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180
* 11, 10, 10, 10, 10, 10, 10, 10, 11, 10, 11, 11, 11, 10, 11,
C ICEP 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195
* 11, 11, 11, 11, 10, 10, 10, 10, 10, 10, 11, 11, 11, 10, 11,
C 196 197 198 199 200
* 11, 11, 11, 11, 10), NN
1004 IF (ICEP .GT. 300) goto 1006
NN = ICEP - 200
C ICEP = 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215
GO TO( 11, 10, 11, 11, 11, 11, 10, 11, 11, 11, 10, 10, 11, 11, 10,
C 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230
* 11, 11, 11, 11, 10, 10, 10, 10, 11, 10, 10, 10, 10, 11, 11,
C 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245
* 11, 11, 11, 11, 11, 10, 11, 10, 10, 10, 11, 11, 11, 11, 10,
C 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260
* 11, 11, 11, 10, 11, 11, 10, 10, 10, 11, 11, 11, 11, 11, 11,
C 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275
* 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 10, 11,
C 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290
* 10, 11, 10, 10, 10, 10, 10, 11, 11, 10, 11, 11, 11, 10, 11,
C 291 292 293 294 295 296 297 298 299 300
* 11, 11, 11, 10, 10, 10, 10, 10, 10, 10), NN
1006 IF (ICEP .GT. gen_maxcep) GO TO 1111
NN = ICEP - 300
C 301 302 303 304 305 306 307 308 309 310
GO TO ( 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
C 311 312 313 314 315 316 317 318 319 320
* 11, 11, 11, 11, 11, 10, 10, 10, 10, 10,
C 321 322 323 324 325 326 327 328 329 330
* 10, 10, 10, 10, 10, 10, 10, 10, 11, 11,
C 331 332 333 334 335 336 337 338 339 340
* 10, 10, 11, 11, 11, 11, 10, 10, 10, 10,
C 341 342 343 344 345 346 347 348 349 350
* 11, 11, 11, 11, 10, 11, 11, 11, 10, 10 ), NN

Thanks,
Lynn

--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)
• From Lynn McGuire@21:1/5 to All on Mon Jun 13 15:23:18 2022
On 6/12/2022 9:06 PM, gah4 wrote:
C CHECK THE COMMANDS WHICH SHOULD HAVE EQUAL SIGN
C 10 - no equal sign required
C 11 - equal sign required

integer needs(350)
data needs/
C ICEP = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
* 10, 11, 11, 10, 10, 11, 11, 11, 10, 11, 10, 11, 11, 10, 10,
C ICEP = 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
* 10, 10, 11, 11, 11, 10, 10, 10, 10, 11, 10, 11, 11, 11, 11,
C ICEP = 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
* 11, 10, 11, 11, 11, 11, 11, 11, 11, 11, 10, 10, 10, 10, 11,
C ICEP = 46 47 48 79 50
* 10, 11, 11, 11, 11,
C ICEP = 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
* 10, 10, 11, 11, 10, 11, 11, 10, 11, 11, 10, 11, 10, 11, 11,
C ICEP = 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
* 11, 10, 10, 11, 10, 11, 11, 10, 11, 11, 11, 11, 11, 11, 11,
C ICEP 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
* 11, 11, 10, 10, 11, 11, 11, 11, 11, 10, 10, 10, 10, 11, 11,
C ICEP 96 97 98 99 100
* 11, 10, 10, 11, 11,
C ICEP = 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
* 11, 10, 10, 10, 11, 11, 11, 10, 10, 10, 10, 10, 10, 10, 10,
C ICEP 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
* 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
C ICEP 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
* 11, 11, 11, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11,
C ICEP 146 147 148 149 150
* 11, 10, 11, 11, 11,
C ICEP = 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165
* 10, 11, 11, 11, 11, 11, 11, 11, 11, 10, 11, 11, 11, 10, 11,
C ICEP 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180
* 11, 10, 10, 10, 10, 10, 10, 10, 11, 10, 11, 11, 11, 10, 11,
C ICEP 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195
* 11, 11, 11, 11, 10, 10, 10, 10, 10, 10, 11, 11, 11, 10, 11,
C 196 197 198 199 200
* 11, 11, 11, 11, 10,
C ICEP = 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215
* 11, 10, 11, 11, 11, 11, 10, 11, 11, 11, 10, 10, 11, 11, 10,
C 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230
* 11, 11, 11, 11, 10, 10, 10, 10, 11, 10, 10, 10, 10, 11, 11,
C 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245
* 11, 11, 11, 11, 11, 10, 11, 10, 10, 10, 11, 11, 11, 11, 10,
C 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260
* 11, 11, 11, 10, 11, 11, 10, 10, 10, 11, 11, 11, 11, 11, 11,
C 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275
* 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 10, 11,
C 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290
* 10, 11, 10, 10, 10, 10, 10, 11, 11, 10, 11, 11, 11, 10, 11,
C 291 292 293 294 295 296 297 298 299 300
* 11, 11, 11, 10, 10, 10, 10, 10, 10, 10,
C 301 302 303 304 305 306 307 308 309 310
* 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
C 311 312 313 314 315 316 317 318 319 320
* 11, 11, 11, 11, 11, 10, 10, 10, 10, 10,
C 321 322 323 324 325 326 327 328 329 330
* 10, 10, 10, 10, 10, 10, 10, 10, 11, 11,
C 331 332 333 334 335 336 337 338 339 340
* 10, 10, 11, 11, 11, 11, 10, 10, 10, 10,
C 341 342 343 344 345 346 347 348 349 350
* 11, 11, 11, 11, 10, 11, 11, 11, 10, 10 /

Does regular Fortran allow 35 lines of continuation lines in a data
statement ?

Thanks,
Lynn

--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)
• From jfh@21:1/5 to Lynn McGuire on Mon Jun 13 14:08:46 2022
On Tuesday, June 14, 2022 at 8:23:22 AM UTC+12, Lynn McGuire wrote:
On 6/12/2022 9:06 PM, gah4 wrote:
C CHECK THE COMMANDS WHICH SHOULD HAVE EQUAL SIGN
C 10 - no equal sign required
C 11 - equal sign required

integer needs(350)
data needs/
C ICEP = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
* 10, 11, 11, 10, 10, 11, 11, 11, 10, 11, 10, 11, 11, 10, 10,
C ICEP = 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
* 10, 10, 11, 11, 11, 10, 10, 10, 10, 11, 10, 11, 11, 11, 11,
C ICEP = 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
* 11, 10, 11, 11, 11, 11, 11, 11, 11, 11, 10, 10, 10, 10, 11,
C ICEP = 46 47 48 79 50
* 10, 11, 11, 11, 11,
C ICEP = 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
* 10, 10, 11, 11, 10, 11, 11, 10, 11, 11, 10, 11, 10, 11, 11,
C ICEP = 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
* 11, 10, 10, 11, 10, 11, 11, 10, 11, 11, 11, 11, 11, 11, 11,
C ICEP 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
* 11, 11, 10, 10, 11, 11, 11, 11, 11, 10, 10, 10, 10, 11, 11,
C ICEP 96 97 98 99 100
* 11, 10, 10, 11, 11,
C ICEP = 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
* 11, 10, 10, 10, 11, 11, 11, 10, 10, 10, 10, 10, 10, 10, 10,
C ICEP 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
* 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
C ICEP 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
* 11, 11, 11, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11,
C ICEP 146 147 148 149 150
* 11, 10, 11, 11, 11,
C ICEP = 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165
* 10, 11, 11, 11, 11, 11, 11, 11, 11, 10, 11, 11, 11, 10, 11,
C ICEP 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180
* 11, 10, 10, 10, 10, 10, 10, 10, 11, 10, 11, 11, 11, 10, 11,
C ICEP 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195
* 11, 11, 11, 11, 10, 10, 10, 10, 10, 10, 11, 11, 11, 10, 11,
C 196 197 198 199 200
* 11, 11, 11, 11, 10,
C ICEP = 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215
* 11, 10, 11, 11, 11, 11, 10, 11, 11, 11, 10, 10, 11, 11, 10,
C 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230
* 11, 11, 11, 11, 10, 10, 10, 10, 11, 10, 10, 10, 10, 11, 11,
C 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245
* 11, 11, 11, 11, 11, 10, 11, 10, 10, 10, 11, 11, 11, 11, 10,
C 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260
* 11, 11, 11, 10, 11, 11, 10, 10, 10, 11, 11, 11, 11, 11, 11,
C 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275
* 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 10, 11,
C 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290
* 10, 11, 10, 10, 10, 10, 10, 11, 11, 10, 11, 11, 11, 10, 11,
C 291 292 293 294 295 296 297 298 299 300
* 11, 11, 11, 10, 10, 10, 10, 10, 10, 10,
C 301 302 303 304 305 306 307 308 309 310
* 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
C 311 312 313 314 315 316 317 318 319 320
* 11, 11, 11, 11, 11, 10, 10, 10, 10, 10,
C 321 322 323 324 325 326 327 328 329 330
* 10, 10, 10, 10, 10, 10, 10, 10, 11, 11,
C 331 332 333 334 335 336 337 338 339 340
* 10, 10, 11, 11, 11, 11, 10, 10, 10, 10,
C 341 342 343 344 345 346 347 348 349 350
* 11, 11, 11, 11, 10, 11, 11, 11, 10, 10 /
Does regular Fortran allow 35 lines of continuation lines in a data
statement ?

Thanks,
Lynn

Depends on what you mean by regular Fortran. In f2003 and later the limit is 255, but in f95 it's 39 in free form, 19 in fixed form.

--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)
• From Lynn McGuire@21:1/5 to jfh on Mon Jun 13 18:29:14 2022
On 6/13/2022 4:08 PM, jfh wrote:
On Tuesday, June 14, 2022 at 8:23:22 AM UTC+12, Lynn McGuire wrote:
On 6/12/2022 9:06 PM, gah4 wrote:
C CHECK THE COMMANDS WHICH SHOULD HAVE EQUAL SIGN
C 10 - no equal sign required
C 11 - equal sign required

integer needs(350)
data needs/
C ICEP = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
* 10, 11, 11, 10, 10, 11, 11, 11, 10, 11, 10, 11, 11, 10, 10,
C ICEP = 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
* 10, 10, 11, 11, 11, 10, 10, 10, 10, 11, 10, 11, 11, 11, 11,
C ICEP = 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
* 11, 10, 11, 11, 11, 11, 11, 11, 11, 11, 10, 10, 10, 10, 11,
C ICEP = 46 47 48 79 50
* 10, 11, 11, 11, 11,
C ICEP = 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
* 10, 10, 11, 11, 10, 11, 11, 10, 11, 11, 10, 11, 10, 11, 11,
C ICEP = 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
* 11, 10, 10, 11, 10, 11, 11, 10, 11, 11, 11, 11, 11, 11, 11,
C ICEP 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
* 11, 11, 10, 10, 11, 11, 11, 11, 11, 10, 10, 10, 10, 11, 11,
C ICEP 96 97 98 99 100
* 11, 10, 10, 11, 11,
C ICEP = 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
* 11, 10, 10, 10, 11, 11, 11, 10, 10, 10, 10, 10, 10, 10, 10,
C ICEP 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
* 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
C ICEP 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
* 11, 11, 11, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11,
C ICEP 146 147 148 149 150
* 11, 10, 11, 11, 11,
C ICEP = 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165
* 10, 11, 11, 11, 11, 11, 11, 11, 11, 10, 11, 11, 11, 10, 11,
C ICEP 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180
* 11, 10, 10, 10, 10, 10, 10, 10, 11, 10, 11, 11, 11, 10, 11,
C ICEP 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195
* 11, 11, 11, 11, 10, 10, 10, 10, 10, 10, 11, 11, 11, 10, 11,
C 196 197 198 199 200
* 11, 11, 11, 11, 10,
C ICEP = 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215
* 11, 10, 11, 11, 11, 11, 10, 11, 11, 11, 10, 10, 11, 11, 10,
C 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230
* 11, 11, 11, 11, 10, 10, 10, 10, 11, 10, 10, 10, 10, 11, 11,
C 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245
* 11, 11, 11, 11, 11, 10, 11, 10, 10, 10, 11, 11, 11, 11, 10,
C 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260
* 11, 11, 11, 10, 11, 11, 10, 10, 10, 11, 11, 11, 11, 11, 11,
C 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275
* 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 10, 11,
C 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290
* 10, 11, 10, 10, 10, 10, 10, 11, 11, 10, 11, 11, 11, 10, 11,
C 291 292 293 294 295 296 297 298 299 300
* 11, 11, 11, 10, 10, 10, 10, 10, 10, 10,
C 301 302 303 304 305 306 307 308 309 310
* 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
C 311 312 313 314 315 316 317 318 319 320
* 11, 11, 11, 11, 11, 10, 10, 10, 10, 10,
C 321 322 323 324 325 326 327 328 329 330
* 10, 10, 10, 10, 10, 10, 10, 10, 11, 11,
C 331 332 333 334 335 336 337 338 339 340
* 10, 10, 11, 11, 11, 11, 10, 10, 10, 10,
C 341 342 343 344 345 346 347 348 349 350
* 11, 11, 11, 11, 10, 11, 11, 11, 10, 10 /
Does regular Fortran allow 35 lines of continuation lines in a data
statement ?

Thanks,
Lynn

Depends on what you mean by regular Fortran. In f2003 and later the limit is 255, but in f95 it's 39 in free form, 19 in fixed form.

I meant Standard Fortran.

Thanks !

Lynn

--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)
• From gah4@21:1/5 to Lynn McGuire on Mon Jun 13 16:28:41 2022
On Monday, June 13, 2022 at 1:23:22 PM UTC-7, Lynn McGuire wrote:
On 6/12/2022 9:06 PM, gah4 wrote:
C CHECK THE COMMANDS WHICH SHOULD HAVE EQUAL SIGN
C 10 - no equal sign required
C 11 - equal sign required

integer needs(350)
data needs/
C ICEP = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
* 10, 11, 11, 10, 10, 11, 11, 11, 10, 11, 10, 11, 11, 10, 10,

(snip)

* 11, 11, 11, 11, 10, 11, 11, 11, 10, 10 /\
Does regular Fortran allow 35 lines of continuation lines in a data
statement ?

I don't think it is less than for a computed GOTO statement.

As well as I remember, some compilers have a larger limit for DATA,
as it is useful for initializing large arrays.

--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)
• From gah4@21:1/5 to Lynn McGuire on Mon Jun 13 17:19:50 2022
On Monday, June 13, 2022 at 4:29:18 PM UTC-7, Lynn McGuire wrote:

(snip)

Depends on what you mean by regular Fortran. In f2003 and later the limit is 255, but in f95 it's 39 in free form, 19 in fixed form.
I meant Standard Fortran.

66, 77, 90, 95, 2008, 2013, or 2018?

There is a famous quote:

"The nice thing about standards is that we have so many to choose from."

--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)
• From Lynn McGuire@21:1/5 to All on Tue Jun 14 14:34:25 2022
On 6/13/2022 7:19 PM, gah4 wrote:
On Monday, June 13, 2022 at 4:29:18 PM UTC-7, Lynn McGuire wrote:

(snip)

Depends on what you mean by regular Fortran. In f2003 and later the limit is 255, but in f95 it's 39 in free form, 19 in fixed form.
I meant Standard Fortran.

66, 77, 90, 95, 2008, 2013, or 2018?

There is a famous quote:

"The nice thing about standards is that we have so many to choose from."

Heh.

F77 apparently allowed 19 continuation lines. Open Watcom Fortran 77 is extended to allow up to 61 continuation lines.

Lynn

--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)
• From gah4@21:1/5 to Lynn McGuire on Tue Jun 14 13:22:25 2022
On Tuesday, June 14, 2022 at 12:34:32 PM UTC-7, Lynn McGuire wrote:

(snip)

F77 apparently allowed 19 continuation lines. Open Watcom Fortran 77 is extended to allow up to 61 continuation lines.

When I wrote above about how many lines of computed GOTO, I had forgotten
that you split that one up.

You could split up the DATA with EQUIVALENCE and two or three or four arrays.

I thought that was a good way, as it keeps your comments (which don't count
for continuation lines), but also the numbers. So no transcribing mistakes. (Not that you ever do that.)

And yes the Watcom compiler is my favorite Fortran 77 compiler.
(Well, maybe VS Fortran, but I don't have one of those.)

--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)
• From Lynn McGuire@21:1/5 to All on Tue Jun 14 17:18:11 2022
On 6/14/2022 3:22 PM, gah4 wrote:
On Tuesday, June 14, 2022 at 12:34:32 PM UTC-7, Lynn McGuire wrote:

(snip)

F77 apparently allowed 19 continuation lines. Open Watcom Fortran 77 is
extended to allow up to 61 continuation lines.

When I wrote above about how many lines of computed GOTO, I had forgotten that you split that one up.

You could split up the DATA with EQUIVALENCE and two or three or four arrays.

I thought that was a good way, as it keeps your comments (which don't count for continuation lines), but also the numbers. So no transcribing mistakes. (Not that you ever do that.)

And yes the Watcom compiler is my favorite Fortran 77 compiler.
(Well, maybe VS Fortran, but I don't have one of those.)

I also have this computed goto that is going be even harder:

IF (ICEP .EQ. -1) GO TO 562
IF (ICEP .GT. 100) GO TO 283
C ICEP 1 2 3 4 5 6 7 8 9 10
GO TO (900 ,510 ,510 ,580 ,564 ,900 ,636 ,518 ,564 ,514 ,
C ICEP 11 12 13 14 15 16 17 18 19 20
* 564 ,530 ,677 ,580 ,564 ,564 ,580 ,668 ,900 ,668 ,
C 21 22 23 24 25 26 27 28 29 30
* 564 ,580 ,900 ,580 ,562 ,564 ,620 ,513 ,510 ,900 ,
C 31 32 33 34 35 36 37 38 39 40
* 900 ,562 ,514 ,514 ,668 ,514 ,520 ,550 ,604 ,615 ,
C 41 42 43 44 45 46 47 48 49 50
* 564 ,580 ,580 ,403 ,550 ,580 ,514 ,900 ,900 ,521,
C 51 52 53 54 55 56 57 58 59 60
* 564 ,580 ,514 ,668 ,565 ,530 ,530 ,5520, 668 ,517 ,
C 61 62 63 64 65 66 67 68 69 70
* 580 , 668, 580 ,900 ,510 ,519 ,580 ,564 ,550 ,564 ,
C 71 72 73 74 75 76 77 78 79 80
* 500 ,530 ,561 ,510 ,560 ,554 ,530 ,439 ,439 ,604 ,
C 81 82 83 84 85 86 87 88 89 90
* 689 ,510 ,900 ,564 ,689 ,689 ,570 ,668 ,668 ,580 ,
C 91 92 93 94 95 96 97 98 99 100
* 580 ,580 ,580 ,651 ,650 ,651 ,564 ,900 ,522 ,530 ), icep
283 IF(ICEP.GT. 200) GO TO 285
NN = ICEP - 100
C ICEP 101 102 103 104 105 106 107 108 109 110
GO TO (530 ,900 ,511 ,511 ,511 ,674 ,675 ,553 ,553 ,553 ,
C 111 112 113 114 115 116 117 118 119 120
* 553 ,553 ,553 ,553 ,564 ,580 ,551 ,516 ,580 ,580 ,
C 121 122 123 124 125 126 127 128 129 130
* 515 ,564 ,580 ,553 ,564 ,580 ,564 ,580 ,551 ,551 ,
C 131 132 133 134 135 136 137 138 139 140
* 668 ,653 ,653 ,900 ,565 ,568 ,552 ,565 ,571 ,551 ,
C 141 142 143 144 145 146 147 148 149 150
* 553 ,900 ,673 ,900 ,677 ,692 ,680 ,6842,6842,6842,
C 151 152 153 154 155 156 157 158 159 160
* 680 ,760 ,900 ,900 ,751 ,6829,6829,6829,6829,6829,
C 161 162 163 164 165 166 167 168 169 170
* 900 ,900 ,900 ,5630, 16500, 16500, 6829,565 ,569 ,5620,
C 171 172 173 174 175 176 177 178 179 180
* 563 ,564 ,564 ,752 ,753 ,653 ,900 ,900 ,17900, 900,
C 181 182 183 184 185 186 187 188 189 190
* 761 ,762 ,763 ,6840,5525,5631,5662,5663,5664,5665,
C 191 192 193 194 195 196 197 198 199 200
* 5666, 774, 774,5632, 523, 653,6843, 900,6845,6200), NN
285 if (icep .gt. 300) goto 287
NN = ICEP - 200
C ICEP 201 202 203 204 205 206 207 208 209 210
GO TO (6846,6847,6848,6849,6850,6851,6852,6844,6854,6855,
C 211 212 213 214 215 216 217 218 219 220
* 5632,565 , 440, 598,6010, 441, 442, 514, 530, 5633,
C 221 222 223 224 225 226 227 228 229 230
* 580, 564, 553,5634, 580, 564, 580, 564,6361, 596,
C 231 232 233 234 235 236 237 238 239 240
* 597,6364, 900, 900, 900, 553,6020, 580, 564, 553,
C 241 242 243 244 245 246 247 248 249, 250,
* 5635,4389,6030,6030,6040, 692, 692,6100, 5526,900,
C 251 252 253 254 255 256 257 258 259 260
* 510, 580, 564, 553,1255,1256,1257,1258,1259,1260,
C 261 262 263 264 265 266 267 268
* 2261,2262, 1760, 900, 653, 1264, 12641, 12642,
C 269 270 271 272 273 274 275 276
* 12643, 27000, 27100, 27200, 27300, 514, 530, 514,
C 277 278 279 280 281 282 283 284 285
* 530, 5301, 5302, 5303, 5304, 6461, 5560, 12644, 6461,
C 286 287 288 289 290 291 292 293 294
* 28600, 28700, 28800, 28900, 29000, 692, 692, 900, 29400,
C 295 296 297 298 299 300
* 29500, 29600, 29700, 29800, 29900, 30000), nn
287 if (icep .gt. gen_maxcep) goto 289
NN = ICEP - 300
C 301 302 303 304 305 306 307 308
go to (30100, 30200, 30300, 30400, 30500, 30600, 30700, 30800,
C 309 310 311 312 313 314 315 316
* 30900, 31000, 31100, 31200, 31300, 31400, 31500, 31600,
C 317 318 319 320 321 322 323 324
* 31700, 31800, 31900, 32000, 32100, 32200, 32300, 32400,
C 325 326 327 328 329 330 331 332
* 32500, 32600, 32700, 32800, 32900, 33000, 900, 900,
C 333 334 335 336 337 338 339 340
* 33300, 33400, 33500, 33600, 33700, 33800, 33900, 34000,
C 341 342 343 344 345 346 347 348
* 34100, 34200, 34300, 34400, 34500, 34600, 34700, 34800,
C 349 350 351 352 353 354 355 356
* 34900, 35000, 35100, 35200), NN

289 call scrwri (' ')
write (screenbuffer, 99902) icep
99902 format ('ERROR: icep', i4, ' command not handled (ingen2)')
call scrwri (screenbuffer)
call scrwri (' ')
setstp = .true.
GOTO 900

Lynn

--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)
• From Lynn McGuire@21:1/5 to All on Tue Jun 14 17:15:22 2022
On 6/14/2022 3:22 PM, gah4 wrote:
On Tuesday, June 14, 2022 at 12:34:32 PM UTC-7, Lynn McGuire wrote:

(snip)

F77 apparently allowed 19 continuation lines. Open Watcom Fortran 77 is
extended to allow up to 61 continuation lines.

When I wrote above about how many lines of computed GOTO, I had forgotten that you split that one up.

You could split up the DATA with EQUIVALENCE and two or three or four arrays.

I thought that was a good way, as it keeps your comments (which don't count for continuation lines), but also the numbers. So no transcribing mistakes. (Not that you ever do that.)

And yes the Watcom compiler is my favorite Fortran 77 compiler.
(Well, maybe VS Fortran, but I don't have one of those.)

I am slowly porting to Intel Fortran on Windows. I have got to go 64
bit. I may have to turn off the automatic module creation for now to
speed up my port. 5,000 subroutines is a lot of arguments to fix to
meet the exact type used.

Lynn

--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)
• From Gary Scott@21:1/5 to All on Tue Jun 14 18:56:07 2022
On 6/14/2022 3:22 PM, gah4 wrote:
On Tuesday, June 14, 2022 at 12:34:32 PM UTC-7, Lynn McGuire wrote:

(snip)

F77 apparently allowed 19 continuation lines. Open Watcom Fortran 77 is
extended to allow up to 61 continuation lines.

When I wrote above about how many lines of computed GOTO, I had forgotten that you split that one up.

You could split up the DATA with EQUIVALENCE and two or three or four arrays.

I thought that was a good way, as it keeps your comments (which don't count for continuation lines), but also the numbers. So no transcribing mistakes. (Not that you ever do that.)

And yes the Watcom compiler is my favorite Fortran 77 compiler.
(Well, maybe VS Fortran, but I don't have one of those.)

VS Fortran was one of my favs. I wrote lots of tools including one
giant interactive graphics editing program that rivaled out Mentor
Graphics workstations. Of course you had to have a graphics capable
high function terminal (3270PC AT/GX) for it to work well, but lesser
capable graphics terminals also worked where I could think of a workaround.

--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)
• From gah4@21:1/5 to Lynn McGuire on Tue Jun 14 19:45:38 2022
On Tuesday, June 14, 2022 at 3:18:15 PM UTC-7, Lynn McGuire wrote:

(snip)

I also have this computed goto that is going be even harder:

IF (ICEP .EQ. -1) GO TO 562
IF (ICEP .GT. 100) GO TO 283
C ICEP 1 2 3 4 5 6 7 8 9 10
GO TO (900 ,510 ,510 ,580 ,564 ,900 ,636 ,518 ,564 ,514 ,
C ICEP 11 12 13 14 15 16 17 18 19 20
* 564 ,530 ,677 ,580 ,564 ,564 ,580 ,668 ,900 ,668 ,
C 21 22 23 24 25 26 27 28 29 30
* 564 ,580 ,900 ,580 ,562 ,564 ,620 ,513 ,510 ,900 ,
C 31 32 33 34 35 36 37 38 39 40
* 900 ,562 ,514 ,514 ,668 ,514 ,520 ,550 ,604 ,615 ,

(snip)

OK, this one has 190 different places to go.

Are these places more complicated than assigning some value,
or something else that can be done using lookup table data?

This is sort of close to the point that you could use a look up
table and 190 way computed GOTO statement. I might suggest
that when it is less than about 1/3 of the choices.

Using AWK:

/^[^C]/ {
gsub("[^0-9]"," ")
if(NF<4) next
for(i=1; i<=NF; i++) x[\$i]++
}

END {
j=l=0
for(k in x) j++
for(k in x) l += x[k]
print j,"of",l
}

--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)
• From Lynn McGuire@21:1/5 to All on Tue Jun 14 23:28:12 2022
On 6/14/2022 9:45 PM, gah4 wrote:
On Tuesday, June 14, 2022 at 3:18:15 PM UTC-7, Lynn McGuire wrote:

(snip)

I also have this computed goto that is going be even harder:

IF (ICEP .EQ. -1) GO TO 562
IF (ICEP .GT. 100) GO TO 283
C ICEP 1 2 3 4 5 6 7 8 9 10
GO TO (900 ,510 ,510 ,580 ,564 ,900 ,636 ,518 ,564 ,514 ,
C ICEP 11 12 13 14 15 16 17 18 19 20
* 564 ,530 ,677 ,580 ,564 ,564 ,580 ,668 ,900 ,668 ,
C 21 22 23 24 25 26 27 28 29 30
* 564 ,580 ,900 ,580 ,562 ,564 ,620 ,513 ,510 ,900 ,
C 31 32 33 34 35 36 37 38 39 40
* 900 ,562 ,514 ,514 ,668 ,514 ,520 ,550 ,604 ,615 ,

(snip)

OK, this one has 190 different places to go.

Are these places more complicated than assigning some value,
or something else that can be done using lookup table data?

This is sort of close to the point that you could use a look up
table and 190 way computed GOTO statement. I might suggest
that when it is less than about 1/3 of the choices.

Using AWK:

/^[^C]/ {
gsub("[^0-9]"," ")
if(NF<4) next
for(i=1; i<=NF; i++) x[\$i]++
}

END {
j=l=0
for(k in x) j++
for(k in x) l += x[k]
print j,"of",l
}

It is truly spaghetti code. A value assignment and hundreds of gotos.
It has grown like topsy over the years. Probably a SELECT would work well.

Lynn

--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)
• From Ev. Drikos@21:1/5 to Lynn McGuire on Wed Jun 15 13:04:13 2022
On 13/06/2022 01:46, Lynn McGuire wrote:
So, is there a better way to code this ?

Better no, maybe more compact. If performance is an
issue one can declare ie the string as a parameter.

---------------- icep.f90 -----------------------------
! CHECK THE COMMANDS WHICH SHOULD HAVE EQUAL SIGN
! 10 - no equal sign required
! 11 - equal sign required

interface
function atoi(in) bind(c)
use, intrinsic :: iso_c_binding
integer(c_int) :: atoi
character(c_char) :: in(*)
end function
end interface

character(350) :: go
character :: ch
integer :: icep = 314 !ie
integer :: nn

!234567890123456789012345678901234567890123456789012345678901234567890xx
go(001:052)='1212121212121212121212121212121212121212121121212112'
go(053:104)='1212121212121212121212121212121212121212121121212112'
go(105:156)='1212121212121212121212121212121212121212121121212112'
go(157:208)='1212121212121212121212121212121212121212121121212112'
go(209:260)='1212121212121212121212121212121212121212121121212112'
go(261:312)='1212121212121212121212121212121212121212121121212112'
go(313:350)='12121212121212121212121212121212121212'

ch=go(icep:icep)
nn=atoi(ch)

print *, 'ch=', ch
print *, 'nn=', nn
print *, 'go=', go

goto(10,11) nn

10 print *, '10', 'go=', go(icep:icep)
goto 999
11 print *, '11', 'go=', go(icep:icep)
goto 999
999 end

--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)
• From Robin Vowels@21:1/5 to Lynn McGuire on Wed Jun 15 05:24:52 2022
On Monday, June 13, 2022 at 8:46:32 AM UTC+10, Lynn McGuire wrote:
So, is there a better way to code this ?
.
Yes, in PL/I you need to write only GO TO LAB(NN);
.
C CHECK THE COMMANDS WHICH SHOULD HAVE EQUAL SIGN
C 10 - no equal sign required
C 11 - equal sign required
C
LEQUL=.TRUE.
IF (ICEP .GT. 100) GO TO 1002
C ICEP = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
GO TO( 10, 11, 11, 10, 10, 11, 11, 11, 10, 11, 10, 11, 11, 10, 10,
C ICEP = 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
* 10, 10, 11, 11, 11, 10, 10, 10, 10, 11, 10, 11, 11, 11, 11,
C ICEP = 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
* 11, 10, 11, 11, 11, 11, 11, 11, 11, 11, 10, 10, 10, 10, 11,
C ICEP = 46 47 48 79 50
* 10, 11, 11, 11, 11,
C ICEP = 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
* 10, 10, 11, 11, 10, 11, 11, 10, 11, 11, 10, 11, 10, 11, 11,
C ICEP = 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
* 11, 10, 10, 11, 10, 11, 11, 10, 11, 11, 11, 11, 11, 11, 11,
C ICEP 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
* 11, 11, 10, 10, 11, 11, 11, 11, 11, 10, 10, 10, 10, 11, 11,
C ICEP 96 97 98 99 100
* 11, 10, 10, 11, 11), icep
1002 IF (ICEP .GT. 200) GO TO 1004
NN = ICEP - 100
C ICEP = 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
GO TO( 11, 10, 10, 10, 11, 11, 11, 10, 10, 10, 10, 10, 10, 10, 10,
C ICEP 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
* 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
C ICEP 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
* 11, 11, 11, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11,
C ICEP 146 147 148 149 150
* 11, 10, 11, 11, 11,
C ICEP = 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165
* 10, 11, 11, 11, 11, 11, 11, 11, 11, 10, 11, 11, 11, 10, 11,
C ICEP 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180
* 11, 10, 10, 10, 10, 10, 10, 10, 11, 10, 11, 11, 11, 10, 11,
C ICEP 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195
* 11, 11, 11, 11, 10, 10, 10, 10, 10, 10, 11, 11, 11, 10, 11,
C 196 197 198 199 200
* 11, 11, 11, 11, 10), NN
1004 IF (ICEP .GT. 300) goto 1006
NN = ICEP - 200
C ICEP = 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215
GO TO( 11, 10, 11, 11, 11, 11, 10, 11, 11, 11, 10, 10, 11, 11, 10,
C 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230
* 11, 11, 11, 11, 10, 10, 10, 10, 11, 10, 10, 10, 10, 11, 11,
C 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245
* 11, 11, 11, 11, 11, 10, 11, 10, 10, 10, 11, 11, 11, 11, 10,
C 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260
* 11, 11, 11, 10, 11, 11, 10, 10, 10, 11, 11, 11, 11, 11, 11,
C 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275
* 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 10, 11,
C 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290
* 10, 11, 10, 10, 10, 10, 10, 11, 11, 10, 11, 11, 11, 10, 11,
C 291 292 293 294 295 296 297 298 299 300
* 11, 11, 11, 10, 10, 10, 10, 10, 10, 10), NN
1006 IF (ICEP .GT. gen_maxcep) GO TO 1111
NN = ICEP - 300
C 301 302 303 304 305 306 307 308 309 310
GO TO ( 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
C 311 312 313 314 315 316 317 318 319 320
* 11, 11, 11, 11, 11, 10, 10, 10, 10, 10,
C 321 322 323 324 325 326 327 328 329 330
* 10, 10, 10, 10, 10, 10, 10, 10, 11, 11,
C 331 332 333 334 335 336 337 338 339 340
* 10, 10, 11, 11, 11, 11, 10, 10, 10, 10,
C 341 342 343 344 345 346 347 348 349 350
* 11, 11, 11, 11, 10, 11, 11, 11, 10, 10 ), NN

--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)
• From John@21:1/5 to All on Wed Jun 15 21:33:40 2022
Well, for the first one for maintainability (and not wanting to even mention ASSIGN statements) and primarily for human intelligibility I might go with a way that worked even pre-f90;. It would probably be more efficient if populated with logicals but
this format has a few advantages when a human has to manually
maintain the information

program testit
implicit none
integer :: nn
integer,parameter :: EQUALS(*)=[&
+1, -2, -3, +4, +5, -6, -7, -8, +9, -10, &
+11, -12, -13, +14, +15, +16, +17, -18, -19, -20, &
+21, +22, +23, +24, -25, +26, -27, -28, -29, -30, &
-31, +32, -33, -34, -35, -36, -37, -38, -39, -40, &
+41, +42, +43, +44, -45, +46, -47, -48, -49, -50, &
+51, +52, -53, -54, +55, -56, -57, +58, -59, -60, &
+61, -62, +63, -64, -65, -66, +67, +68, -69, +70, &
-71, -72, +73, -74, -75, -76, -77, -78, -79, -80, &
-81, -82, +83, +84, -85, -86, -87, -88, -89, +90, &
+91, +92, +93, -94, -95, -96, +97, +98, -99, -100, &
-101, +102, +103, +104, -105, -106, -107, +108, +109, +110, &
+111, +112, +113, +114, +115, +116, +117, +118, +119, +120, &
+121, +122, +123, +124, +125, +126, +127, +128, +129, +130, &
-131, -132, -133, +134, +135, +136, +137, +138, +139, +140, &
+141, -142, -143, -144, -145, -146, +147, -148, -149, -150, &
+151, -152, -153, -154, -155, -156, -157, -158, -159, +160, &
-161, -162, -163, +164, -165, -166, +167, +168, +169, +170, &
+171, +172, +173, -174, +175, -176, -177, -178, +179, -180, &
-181, -182, -183, -184, +185, +186, +187, +188, +189, +190, &
-191, -192, -193, +194, -195, -196, -197, -198, -199, +200, &
-201, +202, -203, -204, -205, -206, +207, -208, -209, -210, &
+211, +212, -213, -214, +215, -216, -217, -218, -219, +220, &
+221, +222, +223, -224, +225, +226, +227, +228, -229, -230, &
-231, -232, -233, -234, -235, +236, -237, +238, +239, +240, &
-241, -242, -243, -244, +245, -246, -247, -248, +249, -250, &
-251, +252, +253, +254, -255, -256, -257, -258, -259, -260, &
-261, -262, -263, -264, -265, -266, -267, -268, -269, -270, &
-271, -272, -273, +274, -275, +276, -277, +278, +279, +280, &
+281, +282, -283, -284, +285, -286, -287, -288, +289, -290, &
-291, -292, -293, +294, +295, +296, +297, +298, +299, +300, &
-301, -302, -303, -304, -305, -306, -307, -308, -309, -310, &
-311, -312, -313, -314, -315, +316, +317, +318, +319, +320, &
+321, +322, +323, +324, +325, +326, +327, +328, -329, -330, &
+331, +332, -333, -334, -335, -336, +337, +338, +339, +340, &
-341, -342, -343, -344, +345, -346, -347, -348, +349, +350]
! CHECK THE COMMANDS WHICH SHOULD HAVE EQUAL SIGN
! + no equal sign required
! - equal sign required
write(*,*)size(equals)==350
do nn=1,size(equals)
if(equals(nn)>0)then
write(*,*)nn,'equal sign required'
else
write(*,*)nn,'equal sign not required'
endif
enddo
end program testit

--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)
• From Robin Vowels@21:1/5 to John on Fri Jun 17 00:43:29 2022
On Thursday, June 16, 2022 at 2:33:44 PM UTC+10, John wrote:
Well, for the first one for maintainability (and not wanting to even mention ASSIGN statements) and primarily for human intelligibility I might go with a way that worked even pre-f90;. It would probably be more efficient if populated with logicals but
this format has a few advantages when a human has to manually
maintain the information
.
GO TO LAB(NN);
is still simpler in PL/I.
.
program testit
implicit none
integer :: nn
integer,parameter :: EQUALS(*)=[&
+1, -2, -3, +4, +5, -6, -7, -8, +9, -10, &
+11, -12, -13, +14, +15, +16, +17, -18, -19, -20, &
+21, +22, +23, +24, -25, +26, -27, -28, -29, -30, &
-31, +32, -33, -34, -35, -36, -37, -38, -39, -40, &
+41, +42, +43, +44, -45, +46, -47, -48, -49, -50, &
+51, +52, -53, -54, +55, -56, -57, +58, -59, -60, &
+61, -62, +63, -64, -65, -66, +67, +68, -69, +70, &
-71, -72, +73, -74, -75, -76, -77, -78, -79, -80, &
-81, -82, +83, +84, -85, -86, -87, -88, -89, +90, &
+91, +92, +93, -94, -95, -96, +97, +98, -99, -100, &
-101, +102, +103, +104, -105, -106, -107, +108, +109, +110, &
+111, +112, +113, +114, +115, +116, +117, +118, +119, +120, &
+121, +122, +123, +124, +125, +126, +127, +128, +129, +130, &
-131, -132, -133, +134, +135, +136, +137, +138, +139, +140, &
+141, -142, -143, -144, -145, -146, +147, -148, -149, -150, &
+151, -152, -153, -154, -155, -156, -157, -158, -159, +160, &
-161, -162, -163, +164, -165, -166, +167, +168, +169, +170, &
+171, +172, +173, -174, +175, -176, -177, -178, +179, -180, &
-181, -182, -183, -184, +185, +186, +187, +188, +189, +190, &
-191, -192, -193, +194, -195, -196, -197, -198, -199, +200, &
-201, +202, -203, -204, -205, -206, +207, -208, -209, -210, &
+211, +212, -213, -214, +215, -216, -217, -218, -219, +220, &
+221, +222, +223, -224, +225, +226, +227, +228, -229, -230, &
-231, -232, -233, -234, -235, +236, -237, +238, +239, +240, &
-241, -242, -243, -244, +245, -246, -247, -248, +249, -250, &
-251, +252, +253, +254, -255, -256, -257, -258, -259, -260, &
-261, -262, -263, -264, -265, -266, -267, -268, -269, -270, &
-271, -272, -273, +274, -275, +276, -277, +278, +279, +280, &
+281, +282, -283, -284, +285, -286, -287, -288, +289, -290, &
-291, -292, -293, +294, +295, +296, +297, +298, +299, +300, &
-301, -302, -303, -304, -305, -306, -307, -308, -309, -310, &
-311, -312, -313, -314, -315, +316, +317, +318, +319, +320, &
+321, +322, +323, +324, +325, +326, +327, +328, -329, -330, &
+331, +332, -333, -334, -335, -336, +337, +338, +339, +340, &
-341, -342, -343, -344, +345, -346, -347, -348, +349, +350]
! CHECK THE COMMANDS WHICH SHOULD HAVE EQUAL SIGN
! + no equal sign required
! - equal sign required
write(*,*)size(equals)==350
do nn=1,size(equals)
if(equals(nn)>0)then
write(*,*)nn,'equal sign required'
else
write(*,*)nn,'equal sign not required'
endif
enddo
end program testit

--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)
• From Lynn McGuire@21:1/5 to Robin Vowels on Sat Jun 18 15:05:10 2022
On 6/17/2022 2:43 AM, Robin Vowels wrote:
On Thursday, June 16, 2022 at 2:33:44 PM UTC+10, John wrote:
Well, for the first one for maintainability (and not wanting to even mention ASSIGN statements) and primarily for human intelligibility I might go with a way that worked even pre-f90;. It would probably be more efficient if populated with logicals but
this format has a few advantages when a human has to manually
maintain the information
.
GO TO LAB(NN);
is still simpler in PL/I.
.
program testit
implicit none
integer :: nn
integer,parameter :: EQUALS(*)=[&
+1, -2, -3, +4, +5, -6, -7, -8, +9, -10, &
+11, -12, -13, +14, +15, +16, +17, -18, -19, -20, &
+21, +22, +23, +24, -25, +26, -27, -28, -29, -30, &
-31, +32, -33, -34, -35, -36, -37, -38, -39, -40, &
+41, +42, +43, +44, -45, +46, -47, -48, -49, -50, &
+51, +52, -53, -54, +55, -56, -57, +58, -59, -60, &
+61, -62, +63, -64, -65, -66, +67, +68, -69, +70, &
-71, -72, +73, -74, -75, -76, -77, -78, -79, -80, &
-81, -82, +83, +84, -85, -86, -87, -88, -89, +90, &
+91, +92, +93, -94, -95, -96, +97, +98, -99, -100, &
-101, +102, +103, +104, -105, -106, -107, +108, +109, +110, &
+111, +112, +113, +114, +115, +116, +117, +118, +119, +120, &
+121, +122, +123, +124, +125, +126, +127, +128, +129, +130, &
-131, -132, -133, +134, +135, +136, +137, +138, +139, +140, &
+141, -142, -143, -144, -145, -146, +147, -148, -149, -150, &
+151, -152, -153, -154, -155, -156, -157, -158, -159, +160, &
-161, -162, -163, +164, -165, -166, +167, +168, +169, +170, &
+171, +172, +173, -174, +175, -176, -177, -178, +179, -180, &
-181, -182, -183, -184, +185, +186, +187, +188, +189, +190, &
-191, -192, -193, +194, -195, -196, -197, -198, -199, +200, &
-201, +202, -203, -204, -205, -206, +207, -208, -209, -210, &
+211, +212, -213, -214, +215, -216, -217, -218, -219, +220, &
+221, +222, +223, -224, +225, +226, +227, +228, -229, -230, &
-231, -232, -233, -234, -235, +236, -237, +238, +239, +240, &
-241, -242, -243, -244, +245, -246, -247, -248, +249, -250, &
-251, +252, +253, +254, -255, -256, -257, -258, -259, -260, &
-261, -262, -263, -264, -265, -266, -267, -268, -269, -270, &
-271, -272, -273, +274, -275, +276, -277, +278, +279, +280, &
+281, +282, -283, -284, +285, -286, -287, -288, +289, -290, &
-291, -292, -293, +294, +295, +296, +297, +298, +299, +300, &
-301, -302, -303, -304, -305, -306, -307, -308, -309, -310, &
-311, -312, -313, -314, -315, +316, +317, +318, +319, +320, &
+321, +322, +323, +324, +325, +326, +327, +328, -329, -330, &
+331, +332, -333, -334, -335, -336, +337, +338, +339, +340, &
-341, -342, -343, -344, +345, -346, -347, -348, +349, +350]
! CHECK THE COMMANDS WHICH SHOULD HAVE EQUAL SIGN
! + no equal sign required
! - equal sign required
write(*,*)size(equals)==350
do nn=1,size(equals)
if(equals(nn)>0)then
write(*,*)nn,'equal sign required'
else
write(*,*)nn,'equal sign not required'
endif
enddo
end program testit

So ? We are not talking about PL/I.

Lynn

--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)
• From Lynn McGuire@21:1/5 to All on Sat Jun 18 15:10:34 2022
On 6/12/2022 9:06 PM, gah4 wrote:
C CHECK THE COMMANDS WHICH SHOULD HAVE EQUAL SIGN
C 10 - no equal sign required
C 11 - equal sign required

integer needs(350)
data needs/
C ICEP = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
* 10, 11, 11, 10, 10, 11, 11, 11, 10, 11, 10, 11, 11, 10, 10,
C ICEP = 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
* 10, 10, 11, 11, 11, 10, 10, 10, 10, 11, 10, 11, 11, 11, 11,
C ICEP = 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
* 11, 10, 11, 11, 11, 11, 11, 11, 11, 11, 10, 10, 10, 10, 11,
C ICEP = 46 47 48 79 50
* 10, 11, 11, 11, 11,
C ICEP = 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
* 10, 10, 11, 11, 10, 11, 11, 10, 11, 11, 10, 11, 10, 11, 11,
C ICEP = 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
* 11, 10, 10, 11, 10, 11, 11, 10, 11, 11, 11, 11, 11, 11, 11,
C ICEP 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
* 11, 11, 10, 10, 11, 11, 11, 11, 11, 10, 10, 10, 10, 11, 11,
C ICEP 96 97 98 99 100
* 11, 10, 10, 11, 11,
C ICEP = 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
* 11, 10, 10, 10, 11, 11, 11, 10, 10, 10, 10, 10, 10, 10, 10,
C ICEP 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
* 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
C ICEP 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
* 11, 11, 11, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11,
C ICEP 146 147 148 149 150
* 11, 10, 11, 11, 11,
C ICEP = 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165
* 10, 11, 11, 11, 11, 11, 11, 11, 11, 10, 11, 11, 11, 10, 11,
C ICEP 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180
* 11, 10, 10, 10, 10, 10, 10, 10, 11, 10, 11, 11, 11, 10, 11,
C ICEP 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195
* 11, 11, 11, 11, 10, 10, 10, 10, 10, 10, 11, 11, 11, 10, 11,
C 196 197 198 199 200
* 11, 11, 11, 11, 10,
C ICEP = 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215
* 11, 10, 11, 11, 11, 11, 10, 11, 11, 11, 10, 10, 11, 11, 10,
C 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230
* 11, 11, 11, 11, 10, 10, 10, 10, 11, 10, 10, 10, 10, 11, 11,
C 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245
* 11, 11, 11, 11, 11, 10, 11, 10, 10, 10, 11, 11, 11, 11, 10,
C 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260
* 11, 11, 11, 10, 11, 11, 10, 10, 10, 11, 11, 11, 11, 11, 11,
C 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275
* 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 10, 11,
C 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290
* 10, 11, 10, 10, 10, 10, 10, 11, 11, 10, 11, 11, 11, 10, 11,
C 291 292 293 294 295 296 297 298 299 300
* 11, 11, 11, 10, 10, 10, 10, 10, 10, 10,
C 301 302 303 304 305 306 307 308 309 310
* 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
C 311 312 313 314 315 316 317 318 319 320
* 11, 11, 11, 11, 11, 10, 10, 10, 10, 10,
C 321 322 323 324 325 326 327 328 329 330
* 10, 10, 10, 10, 10, 10, 10, 10, 11, 11,
C 331 332 333 334 335 336 337 338 339 340
* 10, 10, 11, 11, 11, 11, 10, 10, 10, 10,
C 341 342 343 344 345 346 347 348 349 350
* 11, 11, 11, 11, 10, 11, 11, 11, 10, 10 /

I have to admit, this is my favorite. Especially if I could put the
data statement in the middle of the code.

One of my favorite things about C++ is that I can declare variables all
over the place. With an average of 2,000 lines of code per subroutine,
it would be nice to locate the variable declarations at their usage.

Lynn

--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)
• From Robin Vowels@21:1/5 to Lynn McGuire on Tue Jun 21 05:28:35 2022
On Wednesday, June 15, 2022 at 5:34:32 AM UTC+10, Lynn McGuire wrote:
On 6/13/2022 7:19 PM, gah4 wrote:
On Monday, June 13, 2022 at 4:29:18 PM UTC-7, Lynn McGuire wrote:

(snip)

Depends on what you mean by regular Fortran. In f2003 and later the limit is 255, but in f95 it's 39 in free form, 19 in fixed form.
I meant Standard Fortran.

66, 77, 90, 95, 2008, 2013, or 2018?

There is a famous quote:

"The nice thing about standards is that we have so many to choose from."
Heh.

F77 apparently allowed 19 continuation lines.
.
The standard required a minimum of 19 continuation lines.
.
Open Watcom Fortran 77 is
extended to allow up to 61 continuation lines.
.
Any compiler can exceed the minimum of 19.

--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)
• From Robin Vowels@21:1/5 to Lynn McGuire on Tue Jun 21 05:46:19 2022
On Sunday, June 19, 2022 at 6:05:16 AM UTC+10, Lynn McGuire wrote:
On 6/17/2022 2:43 AM, Robin Vowels wrote:
On Thursday, June 16, 2022 at 2:33:44 PM UTC+10, John wrote:
Well, for the first one for maintainability (and not wanting to even mention ASSIGN statements) and primarily for human intelligibility I might go with a way that worked even pre-f90;. It would probably be more efficient if populated with logicals
but this format has a few advantages when a human has to manually
maintain the information
.
GO TO LAB(NN);
is still simpler in PL/I.
.
program testit
implicit none
integer :: nn
integer,parameter :: EQUALS(*)=[&
+1, -2, -3, +4, +5, -6, -7, -8, +9, -10, &
+11, -12, -13, +14, +15, +16, +17, -18, -19, -20, &
+21, +22, +23, +24, -25, +26, -27, -28, -29, -30, &
-31, +32, -33, -34, -35, -36, -37, -38, -39, -40, &
+41, +42, +43, +44, -45, +46, -47, -48, -49, -50, &
+51, +52, -53, -54, +55, -56, -57, +58, -59, -60, &
+61, -62, +63, -64, -65, -66, +67, +68, -69, +70, &
-71, -72, +73, -74, -75, -76, -77, -78, -79, -80, &
-81, -82, +83, +84, -85, -86, -87, -88, -89, +90, &
+91, +92, +93, -94, -95, -96, +97, +98, -99, -100, &
-101, +102, +103, +104, -105, -106, -107, +108, +109, +110, &
+111, +112, +113, +114, +115, +116, +117, +118, +119, +120, &
+121, +122, +123, +124, +125, +126, +127, +128, +129, +130, &
-131, -132, -133, +134, +135, +136, +137, +138, +139, +140, &
+141, -142, -143, -144, -145, -146, +147, -148, -149, -150, &
+151, -152, -153, -154, -155, -156, -157, -158, -159, +160, &
-161, -162, -163, +164, -165, -166, +167, +168, +169, +170, &
+171, +172, +173, -174, +175, -176, -177, -178, +179, -180, &
-181, -182, -183, -184, +185, +186, +187, +188, +189, +190, &
-191, -192, -193, +194, -195, -196, -197, -198, -199, +200, &
-201, +202, -203, -204, -205, -206, +207, -208, -209, -210, &
+211, +212, -213, -214, +215, -216, -217, -218, -219, +220, &
+221, +222, +223, -224, +225, +226, +227, +228, -229, -230, &
-231, -232, -233, -234, -235, +236, -237, +238, +239, +240, &
-241, -242, -243, -244, +245, -246, -247, -248, +249, -250, &
-251, +252, +253, +254, -255, -256, -257, -258, -259, -260, &
-261, -262, -263, -264, -265, -266, -267, -268, -269, -270, &
-271, -272, -273, +274, -275, +276, -277, +278, +279, +280, &
+281, +282, -283, -284, +285, -286, -287, -288, +289, -290, &
-291, -292, -293, +294, +295, +296, +297, +298, +299, +300, &
-301, -302, -303, -304, -305, -306, -307, -308, -309, -310, &
-311, -312, -313, -314, -315, +316, +317, +318, +319, +320, &
+321, +322, +323, +324, +325, +326, +327, +328, -329, -330, &
+331, +332, -333, -334, -335, -336, +337, +338, +339, +340, &
-341, -342, -343, -344, +345, -346, -347, -348, +349, +350]
! CHECK THE COMMANDS WHICH SHOULD HAVE EQUAL SIGN
! + no equal sign required
! - equal sign required
write(*,*)size(equals)==350
do nn=1,size(equals)
if(equals(nn)>0)then
write(*,*)nn,'equal sign required'
else
write(*,*)nn,'equal sign not required'
endif
enddo
end program testit
.
So ? We are not talking about PL/I.
.
.
PL/I can considerably shorten F77 code.
This instance, where a trivial PL/I statement can replace some 30-40 lines of F77,
might be worthy of further examination.

--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)
• From David Jones@21:1/5 to John on Tue Jun 21 13:24:49 2022
John wrote:

Well, for the first one for maintainability (and not wanting to even
mention ASSIGN statements) and primarily for human intelligibility I
might go with a way that worked even pre-f90;.

I don't think we were told enough about the context of all this. If
this bit of code is gone through often in a single execution, it may
well be worth doing some initialisation computations that can sort out
both maintainability and readability as well as overall speed of
types, such as could be extended easily as necessary, and then go
through these lists automatically (once-only) to construct sufficient cross-referencing etc. so that you can readily know what needs to be
done whenever a decision is needed.

--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)
• From Lynn McGuire@21:1/5 to David Jones on Tue Jun 21 18:46:48 2022
On 6/21/2022 8:24 AM, David Jones wrote:
John wrote:

Well, for the first one for maintainability (and not wanting to even
mention ASSIGN statements) and primarily for human intelligibility I
might go with a way that worked even pre-f90;.

I don't think we were told enough about the context of all this. If
this bit of code is gone through often in a single execution, it may
well be worth doing some initialisation computations that can sort out
both maintainability and readability as well as overall speed of
types, such as could be extended easily as necessary, and then go
through these lists automatically (once-only) to construct sufficient cross-referencing etc. so that you can readily know what needs to be
done whenever a decision is needed.

This code is used in initialization during the processing of the input
commands for the model. There can be thousands of input commands.

I am planning on converting this code from F77 to C++ some day and
wondering how this code will move across.

Lynn

--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)
• From Lynn McGuire@21:1/5 to Robin Vowels on Tue Jun 21 18:44:46 2022
On 6/21/2022 7:46 AM, Robin Vowels wrote:
On Sunday, June 19, 2022 at 6:05:16 AM UTC+10, Lynn McGuire wrote:
On 6/17/2022 2:43 AM, Robin Vowels wrote:
On Thursday, June 16, 2022 at 2:33:44 PM UTC+10, John wrote:
Well, for the first one for maintainability (and not wanting to even mention ASSIGN statements) and primarily for human intelligibility I might go with a way that worked even pre-f90;. It would probably be more efficient if populated with logicals
but this format has a few advantages when a human has to manually
maintain the information
.
GO TO LAB(NN);
is still simpler in PL/I.
.
program testit
implicit none
integer :: nn
integer,parameter :: EQUALS(*)=[&
+1, -2, -3, +4, +5, -6, -7, -8, +9, -10, &
+11, -12, -13, +14, +15, +16, +17, -18, -19, -20, &
+21, +22, +23, +24, -25, +26, -27, -28, -29, -30, &
-31, +32, -33, -34, -35, -36, -37, -38, -39, -40, &
+41, +42, +43, +44, -45, +46, -47, -48, -49, -50, &
+51, +52, -53, -54, +55, -56, -57, +58, -59, -60, &
+61, -62, +63, -64, -65, -66, +67, +68, -69, +70, &
-71, -72, +73, -74, -75, -76, -77, -78, -79, -80, &
-81, -82, +83, +84, -85, -86, -87, -88, -89, +90, &
+91, +92, +93, -94, -95, -96, +97, +98, -99, -100, &
-101, +102, +103, +104, -105, -106, -107, +108, +109, +110, &
+111, +112, +113, +114, +115, +116, +117, +118, +119, +120, &
+121, +122, +123, +124, +125, +126, +127, +128, +129, +130, &
-131, -132, -133, +134, +135, +136, +137, +138, +139, +140, &
+141, -142, -143, -144, -145, -146, +147, -148, -149, -150, &
+151, -152, -153, -154, -155, -156, -157, -158, -159, +160, &
-161, -162, -163, +164, -165, -166, +167, +168, +169, +170, &
+171, +172, +173, -174, +175, -176, -177, -178, +179, -180, &
-181, -182, -183, -184, +185, +186, +187, +188, +189, +190, &
-191, -192, -193, +194, -195, -196, -197, -198, -199, +200, &
-201, +202, -203, -204, -205, -206, +207, -208, -209, -210, &
+211, +212, -213, -214, +215, -216, -217, -218, -219, +220, &
+221, +222, +223, -224, +225, +226, +227, +228, -229, -230, &
-231, -232, -233, -234, -235, +236, -237, +238, +239, +240, &
-241, -242, -243, -244, +245, -246, -247, -248, +249, -250, &
-251, +252, +253, +254, -255, -256, -257, -258, -259, -260, &
-261, -262, -263, -264, -265, -266, -267, -268, -269, -270, &
-271, -272, -273, +274, -275, +276, -277, +278, +279, +280, &
+281, +282, -283, -284, +285, -286, -287, -288, +289, -290, &
-291, -292, -293, +294, +295, +296, +297, +298, +299, +300, &
-301, -302, -303, -304, -305, -306, -307, -308, -309, -310, &
-311, -312, -313, -314, -315, +316, +317, +318, +319, +320, &
+321, +322, +323, +324, +325, +326, +327, +328, -329, -330, &
+331, +332, -333, -334, -335, -336, +337, +338, +339, +340, &
-341, -342, -343, -344, +345, -346, -347, -348, +349, +350]
! CHECK THE COMMANDS WHICH SHOULD HAVE EQUAL SIGN
! + no equal sign required
! - equal sign required
write(*,*)size(equals)==350
do nn=1,size(equals)
if(equals(nn)>0)then
write(*,*)nn,'equal sign required'
else
write(*,*)nn,'equal sign not required'
endif
enddo
end program testit
.
So ? We are not talking about PL/I.
.
Several languages have already been discussed in this thread, including PL/I. .
PL/I can considerably shorten F77 code.
This instance, where a trivial PL/I statement can replace some 30-40 lines of F77,
might be worthy of further examination.

In this case, the software program is 850,000 lines of F77, C and C++.
90% currently F77. Adding anything PL/1 is simply not an option.

Lynn

--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)
• From gah4@21:1/5 to Lynn McGuire on Tue Jun 21 18:21:42 2022
On Tuesday, June 21, 2022 at 4:44:51 PM UTC-7, Lynn McGuire wrote:

(snip)
In this case, the software program is 850,000 lines of F77, C and C++.
90% currently F77. Adding anything PL/1 is simply not an option.

PL/I has statement label variables, which in some cases make for
nicer or smaller code. For this problem, that doesn't help much.

One thing is that PL/I statement labels are alphanumeric,
(with initial letter) like variable names. Sometimes that makes
them more readable, if you give mnemonic names. If ...

It seems that Pascal uses numeric labels to discourage their use.
The WEB system used to write TeX has macros to give them names.

If it helped, you could use a macro system to rename your numeric
labels for readability. You might find that other parts could be made

--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)
• From p.kinsler@ic.ac.uk@21:1/5 to Lynn McGuire on Tue Jul 12 18:49:35 2022
Lynn McGuire <lynnmcguire5@gmail.com> wrote:
One of my favorite things about C++ is that I can declare variables all
over the place. With an average of 2,000 lines of code per subroutine,
it would be nice to locate the variable declarations at their usage.

I did that once with some C ... and it then ran about
ten times slower :-/

#Paul

--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)
• From Lynn McGuire@21:1/5 to p.kinsler@ic.ac.uk on Tue Jul 12 13:56:27 2022
On 7/12/2022 12:49 PM, p.kinsler@ic.ac.uk wrote:
Lynn McGuire <lynnmcguire5@gmail.com> wrote:
One of my favorite things about C++ is that I can declare variables all
over the place. With an average of 2,000 lines of code per subroutine,
it would be nice to locate the variable declarations at their usage.

I did that once with some C ... and it then ran about
ten times slower :-/

#Paul

That makes no sense whatsoever. I do not see that behavior in my
450,000 line C++ Windows user interface program.

Lynn

--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)
• From gah4@21:1/5 to p.ki...@ic.ac.uk on Tue Jul 12 12:05:08 2022
On Tuesday, July 12, 2022 at 10:54:05 AM UTC-7, p.ki...@ic.ac.uk wrote:
Lynn McGuire <lynnmc...@gmail.com> wrote:
One of my favorite things about C++ is that I can declare variables all over the place. With an average of 2,000 lines of code per subroutine,
it would be nice to locate the variable declarations at their usage.

I did that once with some C ... and it then ran about
ten times slower :-/

As well as I know it for C, I am less sure for C++, the allocation is the
same, independent of where the declarations are. It should not change
run time behavior.

I suppose that some optimizers might work different, depending on
such declarations, though that shouldn't actually happen.

Automatic variables are allocated on function entry.

--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)
• From Thomas Koenig@21:1/5 to gah4@u.washington.edu on Tue Jul 12 19:53:49 2022
gah4 <gah4@u.washington.edu> schrieb:
On Tuesday, July 12, 2022 at 10:54:05 AM UTC-7, p.ki...@ic.ac.uk wrote:
Lynn McGuire <lynnmc...@gmail.com> wrote:
One of my favorite things about C++ is that I can declare variables all
over the place. With an average of 2,000 lines of code per subroutine,
it would be nice to locate the variable declarations at their usage.

I did that once with some C ... and it then ran about
ten times slower :-/

As well as I know it for C, I am less sure for C++, the allocation is the same, independent of where the declarations are. It should not change
run time behavior.

I suppose that some optimizers might work different, depending on
such declarations, though that shouldn't actually happen.

Automatic variables are allocated on function entry.

Not necessarily - there is no need to reserve a stack slot
when the value is no longer needed.

Plus, sometimes it is cheaper to recompute than to spill
and reload, but that's one of the hardest decisions to
make in compilers :-)

--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)
• From jfh@21:1/5 to p.ki...@ic.ac.uk on Tue Jul 12 14:15:10 2022
On Wednesday, July 13, 2022 at 5:54:05 AM UTC+12, p.ki...@ic.ac.uk wrote:
Lynn McGuire <lynnmc...@gmail.com> wrote:
One of my favorite things about C++ is that I can declare variables all over the place. With an average of 2,000 lines of code per subroutine,
it would be nice to locate the variable declarations at their usage.
I did that once with some C ... and it then ran about
ten times slower :-/

#Paul
Declaring variables where used was one of my favourite things about Algol 68, long before C++ was invented. The block construct lets you do it in Fortran too.

--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)
• From gah4@21:1/5 to jfh on Tue Jul 12 15:01:48 2022
On Tuesday, July 12, 2022 at 2:15:13 PM UTC-7, jfh wrote:

(snip)

Declaring variables where used was one of my favourite things about Algol 68, long before C++ was invented. The block construct lets you do it in Fortran too.

Different question.

Blocks in ALGOL, BEGIN blocks in PL/I, and some others in other languages, allow for allocation of automatic variables.
(PL/I has DO blocks which are only for grouping, and not allocation or scoping.)

Actually, it might have changed over different versions of C, but at least for some there is no allocation.

--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)
• From Ron Shepard@21:1/5 to jfh on Wed Jul 13 01:18:17 2022
On 7/12/22 4:15 PM, jfh wrote:
Declaring variables where used was one of my favourite things about Algol 68, long before C++ was invented. The block construct lets you do it in Fortran too.

How exactly does this work in fortran. If you have a block with local variables, are they allocated afresh when the block is entered and
deallocated upon block exit, or are they just allocated once? What if
the block is within a loop?

\$.02 -Ron Shepard

--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)
• From pehache@21:1/5 to All on Wed Jul 13 11:33:50 2022
Le 13/07/2022 à 08:18, Ron Shepard a écrit :
On 7/12/22 4:15 PM, jfh wrote:
Declaring variables where used was one of my favourite things about
Algol 68, long before C++ was invented. The block construct lets you
do it in Fortran too.

How exactly does this work in fortran. If you have a block with local variables, are they allocated afresh when the block is entered and deallocated upon block exit, or are they just allocated once? What if
the block is within a loop?

I haven't checked, but to me a BLOCK is similar to a contained
subroutine, with the same rules concerning the variable that are
declared locally.

If the variable is "allocatable" it is automatically deallocated upon
exit of the the block.

If the variable is "save" then the compiler statically allocates it at
compile time.

For other cases it's up to the compiler to decide between a static
allocation at compile time or an automatic allocation on the stack at
runtime.

--
"...sois ouvert aux idées des autres pour peu qu'elles aillent dans le
même sens que les tiennes.", ST sur fr.bio.medecine
ST passe le mur du çon : <j3nn2hFmqj7U1@mid.individual.net>

--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)
• From Robin Vowels@21:1/5 to All on Wed Jul 13 06:14:21 2022
On Wednesday, July 13, 2022 at 8:01:51 AM UTC+10, gah4 wrote:
On Tuesday, July 12, 2022 at 2:15:13 PM UTC-7, jfh wrote:

(snip)
Declaring variables where used was one of my favourite things about Algol 68, long before C++ was invented. The block construct lets you do it in Fortran too.
Different question.

Blocks in ALGOL, BEGIN blocks in PL/I,
.
and PROCEDURE blocks in PL/I

and some others in other languages, allow for allocation of automatic variables.
(PL/I has DO blocks which are only for grouping, and not allocation or scoping.)
.
PL/I does not have DO blocks. PL/I has DO groups.

--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)
• From Thomas Koenig@21:1/5 to Ron Shepard on Wed Jul 13 16:51:43 2022
Ron Shepard <nospam@nowhere.org> schrieb:
On 7/12/22 4:15 PM, jfh wrote:
Declaring variables where used was one of my favourite things about Algol 68, long before C++ was invented. The block construct lets you do it in Fortran too.

How exactly does this work in fortran. If you have a block with local variables, are they allocated afresh when the block is entered and deallocated upon block exit, or are they just allocated once? What if
the block is within a loop?

The compiler will look at the lifetime of the variable and allocate
it on the stack or in a register accordingly. A modern compiler
will, when optimizing, reuse stack slots if possible, with or
without help from the programmer through BLOCK statements.

Compilers have gotten quite good :-)

Also, the intermediate form that compilers use these days,
single static assignment, makes this optimization necessary.
Basically, any assignment to any variable creates a new
variable, so something like

i = 42
j = 2
i = i + j
j = j + i

will be translated to

i_1 = 42
j_1 = 2
i_2 = i_1 + j_1
j_2 = j_1 + i_2

and the compiler will determine that i_1 is no longer
in use, and will drop it.

Anything I learned in my C-64 Basic days about re-using
variables to save space, I had to unlearn :-)

--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)
• From Thomas Koenig@21:1/5 to Lynn McGuire on Wed Jul 13 18:49:04 2022
Lynn McGuire <lynnmcguire5@gmail.com> schrieb:
On 7/13/2022 11:51 AM, Thomas Koenig wrote:
Ron Shepard <nospam@nowhere.org> schrieb:
On 7/12/22 4:15 PM, jfh wrote:
Declaring variables where used was one of my favourite things about Algol 68, long before C++ was invented. The block construct lets you do it in Fortran too.

How exactly does this work in fortran. If you have a block with local
variables, are they allocated afresh when the block is entered and
deallocated upon block exit, or are they just allocated once? What if
the block is within a loop?

The compiler will look at the lifetime of the variable and allocate
it on the stack or in a register accordingly. A modern compiler
will, when optimizing, reuse stack slots if possible, with or
without help from the programmer through BLOCK statements.

Compilers have gotten quite good :-)

Also, the intermediate form that compilers use these days,
single static assignment, makes this optimization necessary.
Basically, any assignment to any variable creates a new
variable, so something like

i = 42
j = 2
i = i + j
j = j + i

will be translated to

i_1 = 42
j_1 = 2
i_2 = i_1 + j_1
j_2 = j_1 + i_2

and the compiler will determine that i_1 is no longer
in use, and will drop it.

Anything I learned in my C-64 Basic days about re-using
variables to save space, I had to unlearn :-)

Yup, we are memory pigs nowadays. I only start to worry about variables being too large when I declare double precision arrays of more than a
million members. It is just not worth my time to optimize the usage.
And the old memory optimizations in our code are a total pain now.

The nice thing about modern compilers is that, while they use
a lot of memory and a lot of CPU time, they are quite good at
efficient optimization, and also at saving memory if you specify
the right options. Using a modern compiler, the code two codes
above will eventually be optimized into two assignments.

--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)
• From Lynn McGuire@21:1/5 to Thomas Koenig on Wed Jul 13 13:28:27 2022
On 7/13/2022 11:51 AM, Thomas Koenig wrote:
Ron Shepard <nospam@nowhere.org> schrieb:
On 7/12/22 4:15 PM, jfh wrote:
Declaring variables where used was one of my favourite things about Algol 68, long before C++ was invented. The block construct lets you do it in Fortran too.

How exactly does this work in fortran. If you have a block with local
variables, are they allocated afresh when the block is entered and
deallocated upon block exit, or are they just allocated once? What if
the block is within a loop?

The compiler will look at the lifetime of the variable and allocate
it on the stack or in a register accordingly. A modern compiler
will, when optimizing, reuse stack slots if possible, with or
without help from the programmer through BLOCK statements.

Compilers have gotten quite good :-)

Also, the intermediate form that compilers use these days,
single static assignment, makes this optimization necessary.
Basically, any assignment to any variable creates a new
variable, so something like

i = 42
j = 2
i = i + j
j = j + i

will be translated to

i_1 = 42
j_1 = 2
i_2 = i_1 + j_1
j_2 = j_1 + i_2

and the compiler will determine that i_1 is no longer
in use, and will drop it.

Anything I learned in my C-64 Basic days about re-using
variables to save space, I had to unlearn :-)

Yup, we are memory pigs nowadays. I only start to worry about variables
being too large when I declare double precision arrays of more than a
million members. It is just not worth my time to optimize the usage.
And the old memory optimizations in our code are a total pain now.

Lynn

--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)
• From James Van Buskirk@21:1/5 to Ron Shepard on Fri Jul 15 10:47:08 2022
"Ron Shepard" wrote in message news:JstzK.25578\$kY1.19305@fx06.iad...

On 7/12/22 4:15 PM, jfh wrote:
Declaring variables where used was one of my favourite things
about Algol 68, long before C++ was invented. The block construct
lets you do it in Fortran too.

How exactly does this work in fortran. If you have a block with local variables, are they allocated afresh when the block is entered and deallocated upon block exit, or are they just allocated once? What if
the block is within a loop?

In some instances allocation on entry and deallocation on exit will
definitely be required. Thus the simplest implementation would be
to always do so.

D:\gfortran\clf\blockloop>type blockloop.f90
program blockloop
implicit none
integer i
do i = 1, 15
BLOCK
character(i) fun
write(*,'(*(g0))') fun()
END BLOCK
end do
end program blockloop

function fun()
implicit none
character(*) fun
integer i
do i = 1, len(fun)
fun(i:i) = achar(iachar('0')+modulo(i,10))
end do
end function fun
D:\gfortran\clf\blockloop>gfortran blockloop.f90 -oblockloop

D:\gfortran\clf\blockloop>blockloop
1
12
123
1234
12345
123456
1234567
12345678
123456789
1234567890
12345678901
123456789012
1234567890123
12345678901234
123456789012345

--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)