-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathstdlib_error.fypp.html
852 lines (809 loc) · 162 KB
/
stdlib_error.fypp.html
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
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
<!-- -*- mode: jinja2 -*- -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="A community driven standard library for (modern) Fortran">
<meta name="author" content="fortran-lang/stdlib contributors" >
<link rel="icon" href="../favicon.png">
<title>stdlib_error.fypp – Fortran-lang/stdlib</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<link href="../css/pygments.css" rel="stylesheet">
<link href="../css/font-awesome.min.css" rel="stylesheet">
<link href="../css/local.css" rel="stylesheet">
<link href="../tipuesearch/tipuesearch.css" rel="stylesheet">
<script src="https://code.jquery.com/jquery-3.7.1.min.js" integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=" crossorigin="anonymous"></script>
<script src="../js/svg-pan-zoom.min.js"></script>
</head>
<body>
<!-- Fixed navbar -->
<div class="container-fluid mb-sm-4 mb-xl-2">
<nav class="navbar navbar-expand-lg navbar-dark bg-dark fixed-top">
<div class="container">
<a class="navbar-brand" href="../index.html">Fortran-lang/stdlib </a>
<button type="button" class="navbar-toggler" data-bs-toggle="collapse" data-bs-target="#navbar"
aria-expanded="false" aria-controls="navbar" aria-label="Toggle navigation">
<span class="navbar-toggler-icon">
</button>
<div id="navbar" class="navbar-collapse collapse">
<ul class="navbar-nav">
<li class="nav-item"><a class="nav-link" href="../page/index.html">Contributing and specs</a></li>
<li class="nav-item">
<a class="nav-link" href="../lists/files.html">Source Files</a>
</li>
<li class="nav-item">
<a class="nav-link" href="../lists/modules.html">Modules</a>
</li>
<li class="nav-item">
<a class="nav-link" href="../lists/procedures.html">Procedures</a>
</li>
<li class="nav-item">
<a class="nav-link" href="../lists/absint.html">Abstract Interfaces</a>
</li>
<li class="nav-item">
<a class="nav-link" href="../lists/types.html">Derived Types</a>
</li>
</ul>
<div class="d-flex align-items-end flex-grow-1">
<form action="../search.html" role="search" class="ms-auto">
<input type="text" class="form-control" aria-label="Search" placeholder="Search" name="q" id="tipue_search_input" autocomplete="off" required>
</form>
</div>
</div><!--/.nav-collapse -->
</div>
</nav>
</div>
<div class="container">
<div class="row">
<h1>stdlib_error.fypp
<small>Source File</small>
</h1>
<div class="container p-2 mb-4 bg-light border rounded-3">
<div class="row align-items-center justify-content-between" id="info-bar">
<div class="col">
<ul class="list-inline" style="margin-bottom:0px;display:inline">
<li class="list-inline-item" id="meta-license"><i class="fa fa-legal"></i> <a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-sa/4.0/80x15.png" /></a></li>
<li class="list-inline-item" id="statements"><i class="fa fa-list-ol"></i>
<a data-bs-toggle="tooltip"
data-bs-placement="bottom" data-html="true"
title=" 0.1% of total for source files.">443 statements</a>
</li>
<li class="list-inline-item" id="source-file">
<i class="fa fa-code"></i>
<a href="../src/stdlib_error.fypp"> Source File</a>
</li>
</ul>
</div>
<div class="col">
<nav aria-label="breadcrumb">
<ol class="breadcrumb justify-content-end mb-0">
<li class="breadcrumb-item active" aria-current="page">stdlib_error.fypp</li>
</ol>
</nav>
</div>
</div>
</div>
<script>
$(function () {
$('[data-bs-toggle="tooltip"]').tooltip()
})
</script>
</div>
<div class="row">
<div class="col-md-3 hidden-xs hidden-sm visible-md visible-lg">
<div id="sidebar">
<h3>Contents</h3>
<div class="card mb-4">
<a data-bs-toggle="collapse" href="#mods-0"
aria-expanded="false" aria-controls="mods-0">
<h4 class="card-header bg-primary text-white">Modules</h4>
</a>
<div id="mods-0" class="collapse">
<div class="list-group list-group-flush">
<a class="list-group-item" href="../module/stdlib_error.html">stdlib_error</a>
</div>
</div>
</div>
<div class="card card-primary">
<div class="card-header text-left"><h3 class="card-title">Source Code</h3></div>
<div class="list-group">
<a class="list-group-item" href="../sourcefile/stdlib_error.fypp.html#src">stdlib_error.fypp</a>
</div>
</div>
</div>
</div>
<div class="col-md-9" id='text'>
<br>
<section>
<h2><span class="anchor" id="src"></span>Source Code</h2>
<div class="hl codehilite"><pre><span></span><a id="ln-1" name="ln-1" href="#ln-1"></a><span class="cp">#:include "common.fypp"</span>
<a id="ln-2" name="ln-2" href="#ln-2"></a><span class="cp">#:set KINDS_TYPES = REAL_KINDS_TYPES + INT_KINDS_TYPES + CMPLX_KINDS_TYPES</span>
<a id="ln-3" name="ln-3" href="#ln-3"></a><span class="k">module </span><span class="n">stdlib_error</span>
<a id="ln-4" name="ln-4" href="#ln-4"></a><span class="w"> </span><span class="c">!! Provides support for catching and handling errors</span>
<a id="ln-5" name="ln-5" href="#ln-5"></a><span class="w"> </span><span class="c">!! ([Specification](../page/specs/stdlib_error.html))</span>
<a id="ln-6" name="ln-6" href="#ln-6"></a><span class="w"> </span><span class="k">use</span><span class="p">,</span><span class="w"> </span><span class="k">intrinsic</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">iso_fortran_env</span><span class="p">,</span><span class="w"> </span><span class="k">only</span><span class="p">:</span><span class="w"> </span><span class="n">stderr</span><span class="w"> </span><span class="o">=></span><span class="w"> </span><span class="n">error_unit</span><span class="p">,</span><span class="w"> </span><span class="n">ilp</span><span class="w"> </span><span class="o">=></span><span class="w"> </span><span class="n">int32</span>
<a id="ln-7" name="ln-7" href="#ln-7"></a><span class="w"> </span><span class="k">use </span><span class="n">stdlib_optval</span><span class="p">,</span><span class="w"> </span><span class="k">only</span><span class="p">:</span><span class="w"> </span><span class="n">optval</span>
<a id="ln-8" name="ln-8" href="#ln-8"></a><span class="w"> </span><span class="k">use </span><span class="n">stdlib_kinds</span><span class="p">,</span><span class="w"> </span><span class="k">only</span><span class="p">:</span><span class="w"> </span><span class="n">int8</span><span class="p">,</span><span class="w"> </span><span class="n">int16</span><span class="p">,</span><span class="w"> </span><span class="n">int32</span><span class="p">,</span><span class="w"> </span><span class="n">int64</span><span class="p">,</span><span class="w"> </span><span class="n">sp</span><span class="p">,</span><span class="w"> </span><span class="n">dp</span><span class="p">,</span><span class="w"> </span><span class="n">xdp</span><span class="p">,</span><span class="w"> </span><span class="n">qp</span><span class="p">,</span><span class="w"> </span><span class="n">lk</span>
<a id="ln-9" name="ln-9" href="#ln-9"></a><span class="w"> </span><span class="k">implicit none</span>
<a id="ln-10" name="ln-10" href="#ln-10"></a><span class="k"> private</span>
<a id="ln-11" name="ln-11" href="#ln-11"></a>
<a id="ln-12" name="ln-12" href="#ln-12"></a><span class="k"> interface</span><span class="w"> </span><span class="c">! f{08,18}estop.f90</span>
<a id="ln-13" name="ln-13" href="#ln-13"></a><span class="w"> </span><span class="k">module subroutine </span><span class="n">error_stop</span><span class="p">(</span><span class="n">msg</span><span class="p">,</span><span class="w"> </span><span class="n">code</span><span class="p">)</span>
<a id="ln-14" name="ln-14" href="#ln-14"></a><span class="w"> </span><span class="c">!! version: experimental</span>
<a id="ln-15" name="ln-15" href="#ln-15"></a><span class="w"> </span><span class="c">!!</span>
<a id="ln-16" name="ln-16" href="#ln-16"></a><span class="w"> </span><span class="c">!! Provides a call to `error stop` and allows the user to specify a code and message</span>
<a id="ln-17" name="ln-17" href="#ln-17"></a><span class="w"> </span><span class="c">!! ([Specification](..//page/specs/stdlib_error.html#description_1))</span>
<a id="ln-18" name="ln-18" href="#ln-18"></a><span class="w"> </span><span class="kt">character</span><span class="p">(</span><span class="o">*</span><span class="p">),</span><span class="w"> </span><span class="k">intent</span><span class="p">(</span><span class="n">in</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">msg</span>
<a id="ln-19" name="ln-19" href="#ln-19"></a><span class="w"> </span><span class="kt">integer</span><span class="p">,</span><span class="w"> </span><span class="k">intent</span><span class="p">(</span><span class="n">in</span><span class="p">),</span><span class="w"> </span><span class="k">optional</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">code</span>
<a id="ln-20" name="ln-20" href="#ln-20"></a><span class="w"> </span><span class="k">end subroutine </span><span class="n">error_stop</span>
<a id="ln-21" name="ln-21" href="#ln-21"></a><span class="w"> </span><span class="k">end interface</span>
<a id="ln-22" name="ln-22" href="#ln-22"></a>
<a id="ln-23" name="ln-23" href="#ln-23"></a><span class="k"> public</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">check</span><span class="p">,</span><span class="w"> </span><span class="n">error_stop</span>
<a id="ln-24" name="ln-24" href="#ln-24"></a>
<a id="ln-25" name="ln-25" href="#ln-25"></a><span class="w"> </span><span class="c">!> Version: experimental</span>
<a id="ln-26" name="ln-26" href="#ln-26"></a><span class="w"> </span><span class="c">!></span>
<a id="ln-27" name="ln-27" href="#ln-27"></a><span class="w"> </span><span class="c">!> A fixed-storage state variable for error handling of linear algebra routines</span>
<a id="ln-28" name="ln-28" href="#ln-28"></a><span class="w"> </span><span class="k">public</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">state_type</span>
<a id="ln-29" name="ln-29" href="#ln-29"></a>
<a id="ln-30" name="ln-30" href="#ln-30"></a><span class="w"> </span><span class="c">!> Version: experimental</span>
<a id="ln-31" name="ln-31" href="#ln-31"></a><span class="w"> </span><span class="c">!></span>
<a id="ln-32" name="ln-32" href="#ln-32"></a><span class="w"> </span><span class="c">!> Interfaces for comparison operators of error states with integer flags</span>
<a id="ln-33" name="ln-33" href="#ln-33"></a><span class="w"> </span><span class="k">public</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">operator</span><span class="p">(</span><span class="o">==</span><span class="p">),</span><span class="n">operator</span><span class="p">(</span><span class="o">/=</span><span class="p">)</span>
<a id="ln-34" name="ln-34" href="#ln-34"></a><span class="w"> </span><span class="k">public</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">operator</span><span class="p">(</span><span class="o"><</span><span class="p">),</span><span class="n">operator</span><span class="p">(</span><span class="o"><=</span><span class="p">)</span>
<a id="ln-35" name="ln-35" href="#ln-35"></a><span class="w"> </span><span class="k">public</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">operator</span><span class="p">(</span><span class="o">></span><span class="p">),</span><span class="n">operator</span><span class="p">(</span><span class="o">>=</span><span class="p">)</span>
<a id="ln-36" name="ln-36" href="#ln-36"></a>
<a id="ln-37" name="ln-37" href="#ln-37"></a><span class="w"> </span><span class="c">!> Base state return types for </span>
<a id="ln-38" name="ln-38" href="#ln-38"></a><span class="w"> </span><span class="kt">integer</span><span class="p">(</span><span class="n">ilp</span><span class="p">),</span><span class="k">parameter</span><span class="p">,</span><span class="k">public</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">STDLIB_SUCCESS</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">0_ilp</span>
<a id="ln-39" name="ln-39" href="#ln-39"></a><span class="w"> </span><span class="kt">integer</span><span class="p">(</span><span class="n">ilp</span><span class="p">),</span><span class="k">parameter</span><span class="p">,</span><span class="k">public</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">STDLIB_VALUE_ERROR</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="o">-</span><span class="mi">1_ilp</span>
<a id="ln-40" name="ln-40" href="#ln-40"></a><span class="w"> </span><span class="kt">integer</span><span class="p">(</span><span class="n">ilp</span><span class="p">),</span><span class="k">parameter</span><span class="p">,</span><span class="k">public</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">STDLIB_LINALG_ERROR</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="o">-</span><span class="mi">2_ilp</span>
<a id="ln-41" name="ln-41" href="#ln-41"></a><span class="w"> </span><span class="kt">integer</span><span class="p">(</span><span class="n">ilp</span><span class="p">),</span><span class="k">parameter</span><span class="p">,</span><span class="k">public</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">STDLIB_INTERNAL_ERROR</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="o">-</span><span class="mi">3_ilp</span>
<a id="ln-42" name="ln-42" href="#ln-42"></a><span class="w"> </span><span class="kt">integer</span><span class="p">(</span><span class="n">ilp</span><span class="p">),</span><span class="k">parameter</span><span class="p">,</span><span class="k">public</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">STDLIB_IO_ERROR</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="o">-</span><span class="mi">4_ilp</span>
<a id="ln-43" name="ln-43" href="#ln-43"></a><span class="w"> </span><span class="kt">integer</span><span class="p">(</span><span class="n">ilp</span><span class="p">),</span><span class="k">parameter</span><span class="p">,</span><span class="k">public</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">STDLIB_FS_ERROR</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="o">-</span><span class="mi">5_ilp</span>
<a id="ln-44" name="ln-44" href="#ln-44"></a>
<a id="ln-45" name="ln-45" href="#ln-45"></a><span class="w"> </span><span class="c">!> Use fixed-size character storage for performance</span>
<a id="ln-46" name="ln-46" href="#ln-46"></a><span class="w"> </span><span class="kt">integer</span><span class="p">(</span><span class="n">ilp</span><span class="p">),</span><span class="k">parameter</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">MSG_LENGTH</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">512_ilp</span>
<a id="ln-47" name="ln-47" href="#ln-47"></a><span class="w"> </span><span class="kt">integer</span><span class="p">(</span><span class="n">ilp</span><span class="p">),</span><span class="k">parameter</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">NAME_LENGTH</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">32_ilp</span>
<a id="ln-48" name="ln-48" href="#ln-48"></a>
<a id="ln-49" name="ln-49" href="#ln-49"></a><span class="w"> </span><span class="c">!> `state_type` defines a general state return type for a</span>
<a id="ln-50" name="ln-50" href="#ln-50"></a><span class="w"> </span><span class="c">!> stdlib routine. State contains a status flag, a comment, and a</span>
<a id="ln-51" name="ln-51" href="#ln-51"></a><span class="w"> </span><span class="c">!> procedure specifier that can be used to mark where the error happened</span>
<a id="ln-52" name="ln-52" href="#ln-52"></a><span class="w"> </span><span class="k">type</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">state_type</span>
<a id="ln-53" name="ln-53" href="#ln-53"></a>
<a id="ln-54" name="ln-54" href="#ln-54"></a><span class="w"> </span><span class="c">!> The current exit state</span>
<a id="ln-55" name="ln-55" href="#ln-55"></a><span class="w"> </span><span class="kt">integer</span><span class="p">(</span><span class="n">ilp</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">state</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">STDLIB_SUCCESS</span>
<a id="ln-56" name="ln-56" href="#ln-56"></a>
<a id="ln-57" name="ln-57" href="#ln-57"></a><span class="w"> </span><span class="c">!> Message associated to the current state</span>
<a id="ln-58" name="ln-58" href="#ln-58"></a><span class="w"> </span><span class="kt">character</span><span class="p">(</span><span class="nb">len</span><span class="o">=</span><span class="n">MSG_LENGTH</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">message</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">repeat</span><span class="p">(</span><span class="s1">' '</span><span class="p">,</span><span class="n">MSG_LENGTH</span><span class="p">)</span>
<a id="ln-59" name="ln-59" href="#ln-59"></a>
<a id="ln-60" name="ln-60" href="#ln-60"></a><span class="w"> </span><span class="c">!> Location of the state change</span>
<a id="ln-61" name="ln-61" href="#ln-61"></a><span class="w"> </span><span class="kt">character</span><span class="p">(</span><span class="nb">len</span><span class="o">=</span><span class="n">NAME_LENGTH</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">where_at</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">repeat</span><span class="p">(</span><span class="s1">' '</span><span class="p">,</span><span class="n">NAME_LENGTH</span><span class="p">)</span>
<a id="ln-62" name="ln-62" href="#ln-62"></a>
<a id="ln-63" name="ln-63" href="#ln-63"></a><span class="w"> </span><span class="k">contains</span>
<a id="ln-64" name="ln-64" href="#ln-64"></a>
<a id="ln-65" name="ln-65" href="#ln-65"></a><span class="w"> </span><span class="c">!> Cleanup</span>
<a id="ln-66" name="ln-66" href="#ln-66"></a><span class="w"> </span><span class="k">procedure</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">destroy</span><span class="w"> </span><span class="o">=></span><span class="w"> </span><span class="n">state_destroy</span>
<a id="ln-67" name="ln-67" href="#ln-67"></a><span class="w"> </span>
<a id="ln-68" name="ln-68" href="#ln-68"></a><span class="w"> </span><span class="c">!> Parse error constructor</span>
<a id="ln-69" name="ln-69" href="#ln-69"></a><span class="w"> </span><span class="k">procedure</span><span class="p">,</span><span class="w"> </span><span class="k">private</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">state_parse_at_location</span>
<a id="ln-70" name="ln-70" href="#ln-70"></a><span class="w"> </span><span class="k">procedure</span><span class="p">,</span><span class="w"> </span><span class="k">private</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">state_parse_arguments</span>
<a id="ln-71" name="ln-71" href="#ln-71"></a><span class="w"> </span><span class="k">generic</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">parse</span><span class="w"> </span><span class="o">=></span><span class="w"> </span><span class="n">state_parse_at_location</span><span class="p">,</span><span class="w"> </span><span class="p">&</span>
<a id="ln-72" name="ln-72" href="#ln-72"></a><span class="w"> </span><span class="n">state_parse_arguments</span>
<a id="ln-73" name="ln-73" href="#ln-73"></a>
<a id="ln-74" name="ln-74" href="#ln-74"></a><span class="w"> </span><span class="c">!> Print error message</span>
<a id="ln-75" name="ln-75" href="#ln-75"></a><span class="w"> </span><span class="k">procedure</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="k">print</span><span class="w"> </span><span class="o">=></span><span class="w"> </span><span class="n">state_print</span>
<a id="ln-76" name="ln-76" href="#ln-76"></a><span class="w"> </span><span class="k">procedure</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">print_msg</span><span class="w"> </span><span class="o">=></span><span class="w"> </span><span class="n">state_message</span>
<a id="ln-77" name="ln-77" href="#ln-77"></a>
<a id="ln-78" name="ln-78" href="#ln-78"></a><span class="w"> </span><span class="c">!> State properties</span>
<a id="ln-79" name="ln-79" href="#ln-79"></a><span class="w"> </span><span class="k">procedure</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">ok</span><span class="w"> </span><span class="o">=></span><span class="w"> </span><span class="n">state_is_ok</span>
<a id="ln-80" name="ln-80" href="#ln-80"></a><span class="w"> </span><span class="k">procedure</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">error</span><span class="w"> </span><span class="o">=></span><span class="w"> </span><span class="n">state_is_error</span>
<a id="ln-81" name="ln-81" href="#ln-81"></a><span class="w"> </span>
<a id="ln-82" name="ln-82" href="#ln-82"></a><span class="w"> </span><span class="c">!> Handle optional error message </span>
<a id="ln-83" name="ln-83" href="#ln-83"></a><span class="w"> </span><span class="k">procedure</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">handle</span><span class="w"> </span><span class="o">=></span><span class="w"> </span><span class="n">error_handling</span>
<a id="ln-84" name="ln-84" href="#ln-84"></a>
<a id="ln-85" name="ln-85" href="#ln-85"></a><span class="w"> </span><span class="k">end type </span><span class="n">state_type</span>
<a id="ln-86" name="ln-86" href="#ln-86"></a>
<a id="ln-87" name="ln-87" href="#ln-87"></a><span class="w"> </span><span class="c">!> Comparison operators</span>
<a id="ln-88" name="ln-88" href="#ln-88"></a><span class="w"> </span><span class="k">interface </span><span class="n">operator</span><span class="p">(</span><span class="o">==</span><span class="p">)</span>
<a id="ln-89" name="ln-89" href="#ln-89"></a><span class="w"> </span><span class="k">module procedure </span><span class="n">state_eq_flag</span>
<a id="ln-90" name="ln-90" href="#ln-90"></a><span class="w"> </span><span class="k">module procedure </span><span class="n">flag_eq_state</span>
<a id="ln-91" name="ln-91" href="#ln-91"></a><span class="w"> </span><span class="k">end interface</span>
<a id="ln-92" name="ln-92" href="#ln-92"></a><span class="k"> interface </span><span class="n">operator</span><span class="p">(</span><span class="o">/=</span><span class="p">)</span>
<a id="ln-93" name="ln-93" href="#ln-93"></a><span class="w"> </span><span class="k">module procedure </span><span class="n">state_neq_flag</span>
<a id="ln-94" name="ln-94" href="#ln-94"></a><span class="w"> </span><span class="k">module procedure </span><span class="n">flag_neq_state</span>
<a id="ln-95" name="ln-95" href="#ln-95"></a><span class="w"> </span><span class="k">end interface</span>
<a id="ln-96" name="ln-96" href="#ln-96"></a><span class="k"> interface </span><span class="n">operator</span><span class="p">(</span><span class="o"><</span><span class="p">)</span>
<a id="ln-97" name="ln-97" href="#ln-97"></a><span class="w"> </span><span class="k">module procedure </span><span class="n">state_lt_flag</span>
<a id="ln-98" name="ln-98" href="#ln-98"></a><span class="w"> </span><span class="k">module procedure </span><span class="n">flag_lt_state</span>
<a id="ln-99" name="ln-99" href="#ln-99"></a><span class="w"> </span><span class="k">end interface</span>
<a id="ln-100" name="ln-100" href="#ln-100"></a><span class="k"> interface </span><span class="n">operator</span><span class="p">(</span><span class="o"><=</span><span class="p">)</span>
<a id="ln-101" name="ln-101" href="#ln-101"></a><span class="w"> </span><span class="k">module procedure </span><span class="n">state_le_flag</span>
<a id="ln-102" name="ln-102" href="#ln-102"></a><span class="w"> </span><span class="k">module procedure </span><span class="n">flag_le_state</span>
<a id="ln-103" name="ln-103" href="#ln-103"></a><span class="w"> </span><span class="k">end interface</span>
<a id="ln-104" name="ln-104" href="#ln-104"></a><span class="k"> interface </span><span class="n">operator</span><span class="p">(</span><span class="o">></span><span class="p">)</span>
<a id="ln-105" name="ln-105" href="#ln-105"></a><span class="w"> </span><span class="k">module procedure </span><span class="n">state_gt_flag</span>
<a id="ln-106" name="ln-106" href="#ln-106"></a><span class="w"> </span><span class="k">module procedure </span><span class="n">flag_gt_state</span>
<a id="ln-107" name="ln-107" href="#ln-107"></a><span class="w"> </span><span class="k">end interface</span>
<a id="ln-108" name="ln-108" href="#ln-108"></a><span class="k"> interface </span><span class="n">operator</span><span class="p">(</span><span class="o">>=</span><span class="p">)</span>
<a id="ln-109" name="ln-109" href="#ln-109"></a><span class="w"> </span><span class="k">module procedure </span><span class="n">state_ge_flag</span>
<a id="ln-110" name="ln-110" href="#ln-110"></a><span class="w"> </span><span class="k">module procedure </span><span class="n">flag_ge_state</span>
<a id="ln-111" name="ln-111" href="#ln-111"></a><span class="w"> </span><span class="k">end interface</span>
<a id="ln-112" name="ln-112" href="#ln-112"></a><span class="w"> </span>
<a id="ln-113" name="ln-113" href="#ln-113"></a><span class="w"> </span><span class="c">!> Assignment operator</span>
<a id="ln-114" name="ln-114" href="#ln-114"></a><span class="w"> </span><span class="k">interface </span><span class="n">assignment</span><span class="p">(</span><span class="o">=</span><span class="p">)</span>
<a id="ln-115" name="ln-115" href="#ln-115"></a><span class="w"> </span><span class="k">module procedure </span><span class="n">state_assign_state</span>
<a id="ln-116" name="ln-116" href="#ln-116"></a><span class="w"> </span><span class="k">end interface </span><span class="n">assignment</span><span class="p">(</span><span class="o">=</span><span class="p">)</span>
<a id="ln-117" name="ln-117" href="#ln-117"></a>
<a id="ln-118" name="ln-118" href="#ln-118"></a><span class="w"> </span><span class="k">interface </span><span class="n">state_type</span>
<a id="ln-119" name="ln-119" href="#ln-119"></a><span class="w"> </span><span class="k">module procedure </span><span class="n">new_state</span>
<a id="ln-120" name="ln-120" href="#ln-120"></a><span class="w"> </span><span class="k">module procedure </span><span class="n">new_state_nowhere</span>
<a id="ln-121" name="ln-121" href="#ln-121"></a><span class="w"> </span><span class="k">end interface </span><span class="n">state_type</span>
<a id="ln-122" name="ln-122" href="#ln-122"></a>
<a id="ln-123" name="ln-123" href="#ln-123"></a><span class="w"> </span><span class="c">!> Format strings with edit descriptors for each type and kind</span>
<a id="ln-124" name="ln-124" href="#ln-124"></a><span class="w"> </span><span class="c">!> cannot be retrieved from stdlib_io due to circular dependencies</span>
<a id="ln-125" name="ln-125" href="#ln-125"></a><span class="w"> </span><span class="kt">character</span><span class="p">(</span><span class="o">*</span><span class="p">),</span><span class="w"> </span><span class="k">parameter</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="p">&</span>
<a id="ln-126" name="ln-126" href="#ln-126"></a><span class="w"> </span><span class="n">FMT_INT</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'(i0)'</span><span class="p">,</span><span class="w"> </span><span class="p">&</span>
<a id="ln-127" name="ln-127" href="#ln-127"></a><span class="w"> </span><span class="n">FMT_REAL_SP</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'(es15.8e2)'</span><span class="p">,</span><span class="w"> </span><span class="p">&</span>
<a id="ln-128" name="ln-128" href="#ln-128"></a><span class="w"> </span><span class="n">FMT_REAL_DP</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'(es24.16e3)'</span><span class="p">,</span><span class="w"> </span><span class="p">&</span>
<a id="ln-129" name="ln-129" href="#ln-129"></a><span class="w"> </span><span class="n">FMT_REAL_XDP</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'(es26.18e3)'</span><span class="p">,</span><span class="w"> </span><span class="p">&</span>
<a id="ln-130" name="ln-130" href="#ln-130"></a><span class="w"> </span><span class="n">FMT_REAL_QP</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'(es44.35e4)'</span><span class="p">,</span><span class="w"> </span><span class="p">&</span>
<a id="ln-131" name="ln-131" href="#ln-131"></a><span class="w"> </span><span class="n">FMT_COMPLEX_SP</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'(es15.8e2,1x,es15.8e2)'</span><span class="p">,</span><span class="w"> </span><span class="p">&</span>
<a id="ln-132" name="ln-132" href="#ln-132"></a><span class="w"> </span><span class="n">FMT_COMPLEX_DP</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'(es24.16e3,1x,es24.16e3)'</span><span class="p">,</span><span class="w"> </span><span class="p">&</span>
<a id="ln-133" name="ln-133" href="#ln-133"></a><span class="w"> </span><span class="n">FMT_COMPLEX_XDP</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'(es26.18e3,1x,es26.18e3)'</span><span class="p">,</span><span class="w"> </span><span class="p">&</span>
<a id="ln-134" name="ln-134" href="#ln-134"></a><span class="w"> </span><span class="n">FMT_COMPLEX_QP</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'(es44.35e4,1x,es44.35e4)'</span>
<a id="ln-135" name="ln-135" href="#ln-135"></a>
<a id="ln-136" name="ln-136" href="#ln-136"></a><span class="k">contains</span>
<a id="ln-137" name="ln-137" href="#ln-137"></a>
<a id="ln-138" name="ln-138" href="#ln-138"></a><span class="k"> subroutine </span><span class="n">check</span><span class="p">(</span><span class="n">condition</span><span class="p">,</span><span class="w"> </span><span class="n">msg</span><span class="p">,</span><span class="w"> </span><span class="n">code</span><span class="p">,</span><span class="w"> </span><span class="n">warn</span><span class="p">)</span>
<a id="ln-139" name="ln-139" href="#ln-139"></a><span class="w"> </span><span class="c">!! version: experimental</span>
<a id="ln-140" name="ln-140" href="#ln-140"></a><span class="w"> </span><span class="c">!!</span>
<a id="ln-141" name="ln-141" href="#ln-141"></a><span class="w"> </span><span class="c">!! Checks the value of a logical condition</span>
<a id="ln-142" name="ln-142" href="#ln-142"></a><span class="w"> </span><span class="c">!! ([Specification](../page/specs/stdlib_error.html#description))</span>
<a id="ln-143" name="ln-143" href="#ln-143"></a><span class="w"> </span><span class="c">!!</span>
<a id="ln-144" name="ln-144" href="#ln-144"></a><span class="w"> </span><span class="c">!!##### Behavior</span>
<a id="ln-145" name="ln-145" href="#ln-145"></a><span class="w"> </span><span class="c">!!</span>
<a id="ln-146" name="ln-146" href="#ln-146"></a><span class="w"> </span><span class="c">!! If `condition == .false.` and:</span>
<a id="ln-147" name="ln-147" href="#ln-147"></a><span class="w"> </span><span class="c">!!</span>
<a id="ln-148" name="ln-148" href="#ln-148"></a><span class="w"> </span><span class="c">!! * No other arguments are provided, it stops the program with the default</span>
<a id="ln-149" name="ln-149" href="#ln-149"></a><span class="w"> </span><span class="c">!! message and exit code `1`;</span>
<a id="ln-150" name="ln-150" href="#ln-150"></a><span class="w"> </span><span class="c">!! * `msg` is provided, it prints the value of `msg`;</span>
<a id="ln-151" name="ln-151" href="#ln-151"></a><span class="w"> </span><span class="c">!! * `code` is provided, it stops the program with the given exit code;</span>
<a id="ln-152" name="ln-152" href="#ln-152"></a><span class="w"> </span><span class="c">!! * `warn` is provided and `.true.`, it doesn't stop the program and prints</span>
<a id="ln-153" name="ln-153" href="#ln-153"></a><span class="w"> </span><span class="c">!! the message.</span>
<a id="ln-154" name="ln-154" href="#ln-154"></a><span class="w"> </span><span class="c">!!</span>
<a id="ln-155" name="ln-155" href="#ln-155"></a><span class="w"> </span><span class="c">!!##### Examples</span>
<a id="ln-156" name="ln-156" href="#ln-156"></a><span class="w"> </span><span class="c">!!</span>
<a id="ln-157" name="ln-157" href="#ln-157"></a><span class="w"> </span><span class="c">!!* If `a /= 5`, stops the program with exit code `1`</span>
<a id="ln-158" name="ln-158" href="#ln-158"></a><span class="w"> </span><span class="c">!! and prints `Check failed.`</span>
<a id="ln-159" name="ln-159" href="#ln-159"></a><span class="w"> </span><span class="c">!!``` fortran</span>
<a id="ln-160" name="ln-160" href="#ln-160"></a><span class="w"> </span><span class="c">!! call check(a == 5)</span>
<a id="ln-161" name="ln-161" href="#ln-161"></a><span class="w"> </span><span class="c">!!```</span>
<a id="ln-162" name="ln-162" href="#ln-162"></a><span class="w"> </span><span class="c">!!</span>
<a id="ln-163" name="ln-163" href="#ln-163"></a><span class="w"> </span><span class="c">!!* As above, but prints `a == 5 failed`.</span>
<a id="ln-164" name="ln-164" href="#ln-164"></a><span class="w"> </span><span class="c">!!``` fortran</span>
<a id="ln-165" name="ln-165" href="#ln-165"></a><span class="w"> </span><span class="c">!! call check(a == 5, msg='a == 5 failed.')</span>
<a id="ln-166" name="ln-166" href="#ln-166"></a><span class="w"> </span><span class="c">!!```</span>
<a id="ln-167" name="ln-167" href="#ln-167"></a><span class="w"> </span><span class="c">!!</span>
<a id="ln-168" name="ln-168" href="#ln-168"></a><span class="w"> </span><span class="c">!!* As above, but doesn't stop the program.</span>
<a id="ln-169" name="ln-169" href="#ln-169"></a><span class="w"> </span><span class="c">!!``` fortran</span>
<a id="ln-170" name="ln-170" href="#ln-170"></a><span class="w"> </span><span class="c">!! call check(a == 5, msg='a == 5 failed.', warn=.true.)</span>
<a id="ln-171" name="ln-171" href="#ln-171"></a><span class="w"> </span><span class="c">!!```</span>
<a id="ln-172" name="ln-172" href="#ln-172"></a><span class="w"> </span><span class="c">!!</span>
<a id="ln-173" name="ln-173" href="#ln-173"></a><span class="w"> </span><span class="c">!!* As example #2, but stops the program with exit code `77`</span>
<a id="ln-174" name="ln-174" href="#ln-174"></a><span class="w"> </span><span class="c">!!``` fortran</span>
<a id="ln-175" name="ln-175" href="#ln-175"></a><span class="w"> </span><span class="c">!! call check(a == 5, msg='a == 5 failed.', code=77)</span>
<a id="ln-176" name="ln-176" href="#ln-176"></a><span class="w"> </span><span class="c">!!```</span>
<a id="ln-177" name="ln-177" href="#ln-177"></a>
<a id="ln-178" name="ln-178" href="#ln-178"></a><span class="w"> </span><span class="c">!</span>
<a id="ln-179" name="ln-179" href="#ln-179"></a><span class="w"> </span><span class="c">! Arguments</span>
<a id="ln-180" name="ln-180" href="#ln-180"></a><span class="w"> </span><span class="c">! ---------</span>
<a id="ln-181" name="ln-181" href="#ln-181"></a>
<a id="ln-182" name="ln-182" href="#ln-182"></a><span class="w"> </span><span class="kt">logical</span><span class="p">,</span><span class="w"> </span><span class="k">intent</span><span class="p">(</span><span class="n">in</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">condition</span>
<a id="ln-183" name="ln-183" href="#ln-183"></a><span class="w"> </span><span class="kt">character</span><span class="p">(</span><span class="o">*</span><span class="p">),</span><span class="w"> </span><span class="k">intent</span><span class="p">(</span><span class="n">in</span><span class="p">),</span><span class="w"> </span><span class="k">optional</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">msg</span>
<a id="ln-184" name="ln-184" href="#ln-184"></a><span class="w"> </span><span class="kt">integer</span><span class="p">,</span><span class="w"> </span><span class="k">intent</span><span class="p">(</span><span class="n">in</span><span class="p">),</span><span class="w"> </span><span class="k">optional</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">code</span>
<a id="ln-185" name="ln-185" href="#ln-185"></a><span class="w"> </span><span class="kt">logical</span><span class="p">,</span><span class="w"> </span><span class="k">intent</span><span class="p">(</span><span class="n">in</span><span class="p">),</span><span class="w"> </span><span class="k">optional</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">warn</span>
<a id="ln-186" name="ln-186" href="#ln-186"></a><span class="w"> </span><span class="kt">character</span><span class="p">(</span><span class="o">*</span><span class="p">),</span><span class="w"> </span><span class="k">parameter</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">msg_default</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'Check failed.'</span>
<a id="ln-187" name="ln-187" href="#ln-187"></a>
<a id="ln-188" name="ln-188" href="#ln-188"></a><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="p">(.</span><span class="nb">not</span><span class="p">.</span><span class="w"> </span><span class="n">condition</span><span class="p">)</span><span class="w"> </span><span class="k">then</span>
<a id="ln-189" name="ln-189" href="#ln-189"></a><span class="k"> if</span><span class="w"> </span><span class="p">(</span><span class="n">optval</span><span class="p">(</span><span class="n">warn</span><span class="p">,</span><span class="w"> </span><span class="p">.</span><span class="n">false</span><span class="p">.))</span><span class="w"> </span><span class="k">then</span>
<a id="ln-190" name="ln-190" href="#ln-190"></a><span class="k"> write</span><span class="p">(</span><span class="n">stderr</span><span class="p">,</span><span class="o">*</span><span class="p">)</span><span class="w"> </span><span class="n">optval</span><span class="p">(</span><span class="n">msg</span><span class="p">,</span><span class="w"> </span><span class="n">msg_default</span><span class="p">)</span>
<a id="ln-191" name="ln-191" href="#ln-191"></a><span class="w"> </span><span class="k">else</span>
<a id="ln-192" name="ln-192" href="#ln-192"></a><span class="k"> call </span><span class="n">error_stop</span><span class="p">(</span><span class="n">optval</span><span class="p">(</span><span class="n">msg</span><span class="p">,</span><span class="w"> </span><span class="n">msg_default</span><span class="p">),</span><span class="w"> </span><span class="n">optval</span><span class="p">(</span><span class="n">code</span><span class="p">,</span><span class="w"> </span><span class="mi">1</span><span class="p">))</span>
<a id="ln-193" name="ln-193" href="#ln-193"></a><span class="w"> </span><span class="k">end if</span>
<a id="ln-194" name="ln-194" href="#ln-194"></a><span class="k"> end if</span>
<a id="ln-195" name="ln-195" href="#ln-195"></a>
<a id="ln-196" name="ln-196" href="#ln-196"></a><span class="k"> end subroutine </span><span class="n">check</span>
<a id="ln-197" name="ln-197" href="#ln-197"></a>
<a id="ln-198" name="ln-198" href="#ln-198"></a><span class="w"> </span><span class="c">!> Cleanup the object</span>
<a id="ln-199" name="ln-199" href="#ln-199"></a><span class="w"> </span><span class="k">elemental subroutine </span><span class="n">state_destroy</span><span class="p">(</span><span class="n">this</span><span class="p">)</span>
<a id="ln-200" name="ln-200" href="#ln-200"></a><span class="w"> </span><span class="k">class</span><span class="p">(</span><span class="n">state_type</span><span class="p">),</span><span class="k">intent</span><span class="p">(</span><span class="n">inout</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">this</span>
<a id="ln-201" name="ln-201" href="#ln-201"></a>
<a id="ln-202" name="ln-202" href="#ln-202"></a><span class="w"> </span><span class="n">this</span><span class="p">%</span><span class="n">state</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">STDLIB_SUCCESS</span>
<a id="ln-203" name="ln-203" href="#ln-203"></a><span class="w"> </span><span class="n">this</span><span class="p">%</span><span class="n">message</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">repeat</span><span class="p">(</span><span class="s1">' '</span><span class="p">,</span><span class="nb">len</span><span class="p">(</span><span class="n">this</span><span class="p">%</span><span class="n">message</span><span class="p">))</span>
<a id="ln-204" name="ln-204" href="#ln-204"></a><span class="w"> </span><span class="n">this</span><span class="p">%</span><span class="n">where_at</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">repeat</span><span class="p">(</span><span class="s1">' '</span><span class="p">,</span><span class="nb">len</span><span class="p">(</span><span class="n">this</span><span class="p">%</span><span class="n">where_at</span><span class="p">))</span>
<a id="ln-205" name="ln-205" href="#ln-205"></a>
<a id="ln-206" name="ln-206" href="#ln-206"></a><span class="w"> </span><span class="k">end subroutine </span><span class="n">state_destroy</span>
<a id="ln-207" name="ln-207" href="#ln-207"></a>
<a id="ln-208" name="ln-208" href="#ln-208"></a><span class="w"> </span><span class="c">!> Interface to print stdlib error messages</span>
<a id="ln-209" name="ln-209" href="#ln-209"></a><span class="w"> </span><span class="k">pure function </span><span class="n">state_flag_message</span><span class="p">(</span><span class="n">flag</span><span class="p">)</span><span class="w"> </span><span class="k">result</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span>
<a id="ln-210" name="ln-210" href="#ln-210"></a><span class="w"> </span><span class="kt">integer</span><span class="p">(</span><span class="n">ilp</span><span class="p">),</span><span class="k">intent</span><span class="p">(</span><span class="n">in</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">flag</span>
<a id="ln-211" name="ln-211" href="#ln-211"></a><span class="w"> </span><span class="kt">character</span><span class="p">(</span><span class="nb">len</span><span class="o">=</span><span class="p">:),</span><span class="k">allocatable</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">msg</span>
<a id="ln-212" name="ln-212" href="#ln-212"></a>
<a id="ln-213" name="ln-213" href="#ln-213"></a><span class="w"> </span><span class="k">select case</span><span class="w"> </span><span class="p">(</span><span class="n">flag</span><span class="p">)</span>
<a id="ln-214" name="ln-214" href="#ln-214"></a><span class="w"> </span><span class="k">case</span><span class="w"> </span><span class="p">(</span><span class="n">STDLIB_SUCCESS</span><span class="p">);</span><span class="w"> </span><span class="n">msg</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'Success!'</span>
<a id="ln-215" name="ln-215" href="#ln-215"></a><span class="w"> </span><span class="k">case</span><span class="w"> </span><span class="p">(</span><span class="n">STDLIB_VALUE_ERROR</span><span class="p">);</span><span class="w"> </span><span class="n">msg</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'Value Error'</span>
<a id="ln-216" name="ln-216" href="#ln-216"></a><span class="w"> </span><span class="k">case</span><span class="w"> </span><span class="p">(</span><span class="n">STDLIB_LINALG_ERROR</span><span class="p">);</span><span class="w"> </span><span class="n">msg</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'Linear Algebra Error'</span>
<a id="ln-217" name="ln-217" href="#ln-217"></a><span class="w"> </span><span class="k">case</span><span class="w"> </span><span class="p">(</span><span class="n">STDLIB_IO_ERROR</span><span class="p">);</span><span class="w"> </span><span class="n">msg</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'I/O Error'</span>
<a id="ln-218" name="ln-218" href="#ln-218"></a><span class="w"> </span><span class="k">case</span><span class="w"> </span><span class="p">(</span><span class="n">STDLIB_FS_ERROR</span><span class="p">);</span><span class="w"> </span><span class="n">msg</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'Filesystem Error'</span>
<a id="ln-219" name="ln-219" href="#ln-219"></a><span class="w"> </span><span class="k">case</span><span class="w"> </span><span class="p">(</span><span class="n">STDLIB_INTERNAL_ERROR</span><span class="p">);</span><span class="w"> </span><span class="n">msg</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'Internal Error'</span>
<a id="ln-220" name="ln-220" href="#ln-220"></a><span class="w"> </span><span class="k">case </span><span class="n">default</span><span class="p">;</span><span class="w"> </span><span class="n">msg</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'INVALID/UNKNOWN STATE FLAG'</span>
<a id="ln-221" name="ln-221" href="#ln-221"></a><span class="w"> </span><span class="k">end select</span>
<a id="ln-222" name="ln-222" href="#ln-222"></a>
<a id="ln-223" name="ln-223" href="#ln-223"></a><span class="k"> end function </span><span class="n">state_flag_message</span>
<a id="ln-224" name="ln-224" href="#ln-224"></a>
<a id="ln-225" name="ln-225" href="#ln-225"></a><span class="w"> </span><span class="c">!> Return a formatted message</span>
<a id="ln-226" name="ln-226" href="#ln-226"></a><span class="w"> </span><span class="k">pure function </span><span class="n">state_message</span><span class="p">(</span><span class="n">this</span><span class="p">)</span><span class="w"> </span><span class="k">result</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span>
<a id="ln-227" name="ln-227" href="#ln-227"></a><span class="w"> </span><span class="k">class</span><span class="p">(</span><span class="n">state_type</span><span class="p">),</span><span class="k">intent</span><span class="p">(</span><span class="n">in</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">this</span>
<a id="ln-228" name="ln-228" href="#ln-228"></a><span class="w"> </span><span class="kt">character</span><span class="p">(</span><span class="nb">len</span><span class="o">=</span><span class="p">:),</span><span class="k">allocatable</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">msg</span>
<a id="ln-229" name="ln-229" href="#ln-229"></a>
<a id="ln-230" name="ln-230" href="#ln-230"></a><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="n">this</span><span class="p">%</span><span class="n">state</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="n">STDLIB_SUCCESS</span><span class="p">)</span><span class="w"> </span><span class="k">then</span>
<a id="ln-231" name="ln-231" href="#ln-231"></a><span class="k"> </span><span class="n">msg</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'Success!'</span>
<a id="ln-232" name="ln-232" href="#ln-232"></a><span class="w"> </span><span class="k">else</span>
<a id="ln-233" name="ln-233" href="#ln-233"></a><span class="k"> </span><span class="n">msg</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">state_flag_message</span><span class="p">(</span><span class="n">this</span><span class="p">%</span><span class="n">state</span><span class="p">)</span><span class="o">//</span><span class="s1">': '</span><span class="o">//</span><span class="nb">trim</span><span class="p">(</span><span class="n">this</span><span class="p">%</span><span class="n">message</span><span class="p">)</span>
<a id="ln-234" name="ln-234" href="#ln-234"></a><span class="w"> </span><span class="k">end if</span>
<a id="ln-235" name="ln-235" href="#ln-235"></a>
<a id="ln-236" name="ln-236" href="#ln-236"></a><span class="k"> end function </span><span class="n">state_message</span>
<a id="ln-237" name="ln-237" href="#ln-237"></a>
<a id="ln-238" name="ln-238" href="#ln-238"></a><span class="w"> </span><span class="c">!> Flow control: on output flag present, return it; otherwise, halt on error</span>
<a id="ln-239" name="ln-239" href="#ln-239"></a><span class="w"> </span><span class="k">pure subroutine </span><span class="n">error_handling</span><span class="p">(</span><span class="n">ierr</span><span class="p">,</span><span class="n">ierr_out</span><span class="p">)</span>
<a id="ln-240" name="ln-240" href="#ln-240"></a><span class="w"> </span><span class="k">class</span><span class="p">(</span><span class="n">state_type</span><span class="p">),</span><span class="w"> </span><span class="k">intent</span><span class="p">(</span><span class="n">in</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">ierr</span>
<a id="ln-241" name="ln-241" href="#ln-241"></a><span class="w"> </span><span class="k">class</span><span class="p">(</span><span class="n">state_type</span><span class="p">),</span><span class="w"> </span><span class="k">optional</span><span class="p">,</span><span class="w"> </span><span class="k">intent</span><span class="p">(</span><span class="n">inout</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">ierr_out</span>
<a id="ln-242" name="ln-242" href="#ln-242"></a>
<a id="ln-243" name="ln-243" href="#ln-243"></a><span class="w"> </span><span class="kt">character</span><span class="p">(</span><span class="nb">len</span><span class="o">=</span><span class="p">:),</span><span class="k">allocatable</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">err_msg</span>
<a id="ln-244" name="ln-244" href="#ln-244"></a>
<a id="ln-245" name="ln-245" href="#ln-245"></a><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="nb">present</span><span class="p">(</span><span class="n">ierr_out</span><span class="p">))</span><span class="w"> </span><span class="k">then</span>
<a id="ln-246" name="ln-246" href="#ln-246"></a><span class="w"> </span><span class="c">! Return error flag</span>
<a id="ln-247" name="ln-247" href="#ln-247"></a><span class="w"> </span><span class="n">ierr_out</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">ierr</span>
<a id="ln-248" name="ln-248" href="#ln-248"></a><span class="w"> </span><span class="k">elseif</span><span class="w"> </span><span class="p">(</span><span class="n">ierr</span><span class="p">%</span><span class="n">error</span><span class="p">())</span><span class="w"> </span><span class="k">then</span>
<a id="ln-249" name="ln-249" href="#ln-249"></a><span class="k"> </span><span class="n">err_msg</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">ierr</span><span class="p">%</span><span class="k">print</span><span class="p">()</span>
<a id="ln-250" name="ln-250" href="#ln-250"></a><span class="w"> </span><span class="k">error stop </span><span class="n">err_msg</span>
<a id="ln-251" name="ln-251" href="#ln-251"></a><span class="w"> </span><span class="k">end if</span>
<a id="ln-252" name="ln-252" href="#ln-252"></a>
<a id="ln-253" name="ln-253" href="#ln-253"></a><span class="k"> end subroutine </span><span class="n">error_handling</span>
<a id="ln-254" name="ln-254" href="#ln-254"></a>
<a id="ln-255" name="ln-255" href="#ln-255"></a><span class="w"> </span><span class="c">!> Produce a nice error string</span>
<a id="ln-256" name="ln-256" href="#ln-256"></a><span class="w"> </span><span class="k">pure function </span><span class="n">state_print</span><span class="p">(</span><span class="n">this</span><span class="p">)</span><span class="w"> </span><span class="k">result</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span>
<a id="ln-257" name="ln-257" href="#ln-257"></a><span class="w"> </span><span class="k">class</span><span class="p">(</span><span class="n">state_type</span><span class="p">),</span><span class="k">intent</span><span class="p">(</span><span class="n">in</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">this</span>
<a id="ln-258" name="ln-258" href="#ln-258"></a><span class="w"> </span><span class="kt">character</span><span class="p">(</span><span class="nb">len</span><span class="o">=</span><span class="p">:),</span><span class="k">allocatable</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">msg</span>
<a id="ln-259" name="ln-259" href="#ln-259"></a>
<a id="ln-260" name="ln-260" href="#ln-260"></a><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="nb">len_trim</span><span class="p">(</span><span class="n">this</span><span class="p">%</span><span class="n">where_at</span><span class="p">)</span><span class="w"> </span><span class="o">></span><span class="w"> </span><span class="mi">0</span><span class="p">)</span><span class="w"> </span><span class="k">then</span>
<a id="ln-261" name="ln-261" href="#ln-261"></a><span class="k"> </span><span class="n">msg</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'['</span><span class="o">//</span><span class="nb">trim</span><span class="p">(</span><span class="n">this</span><span class="p">%</span><span class="n">where_at</span><span class="p">)</span><span class="o">//</span><span class="s1">'] returned '</span><span class="o">//</span><span class="n">this</span><span class="p">%</span><span class="n">print_msg</span><span class="p">()</span>
<a id="ln-262" name="ln-262" href="#ln-262"></a><span class="w"> </span><span class="k">elseif</span><span class="w"> </span><span class="p">(</span><span class="n">this</span><span class="p">%</span><span class="n">error</span><span class="p">())</span><span class="w"> </span><span class="k">then</span>
<a id="ln-263" name="ln-263" href="#ln-263"></a><span class="k"> </span><span class="n">msg</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'Error encountered: '</span><span class="o">//</span><span class="n">this</span><span class="p">%</span><span class="n">print_msg</span><span class="p">()</span>
<a id="ln-264" name="ln-264" href="#ln-264"></a><span class="w"> </span><span class="k">else</span>
<a id="ln-265" name="ln-265" href="#ln-265"></a><span class="k"> </span><span class="n">msg</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">this</span><span class="p">%</span><span class="n">print_msg</span><span class="p">()</span>
<a id="ln-266" name="ln-266" href="#ln-266"></a><span class="w"> </span><span class="k">end if</span>
<a id="ln-267" name="ln-267" href="#ln-267"></a>
<a id="ln-268" name="ln-268" href="#ln-268"></a><span class="k"> end function </span><span class="n">state_print</span>
<a id="ln-269" name="ln-269" href="#ln-269"></a>
<a id="ln-270" name="ln-270" href="#ln-270"></a><span class="w"> </span><span class="c">!> Check if the current state is successful</span>
<a id="ln-271" name="ln-271" href="#ln-271"></a><span class="w"> </span><span class="k">elemental </span><span class="kt">logical</span><span class="p">(</span><span class="n">lk</span><span class="p">)</span><span class="w"> </span><span class="k">function </span><span class="n">state_is_ok</span><span class="p">(</span><span class="n">this</span><span class="p">)</span>
<a id="ln-272" name="ln-272" href="#ln-272"></a><span class="w"> </span><span class="k">class</span><span class="p">(</span><span class="n">state_type</span><span class="p">),</span><span class="k">intent</span><span class="p">(</span><span class="n">in</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">this</span>
<a id="ln-273" name="ln-273" href="#ln-273"></a><span class="w"> </span><span class="n">state_is_ok</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">this</span><span class="p">%</span><span class="n">state</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="n">STDLIB_SUCCESS</span>
<a id="ln-274" name="ln-274" href="#ln-274"></a><span class="w"> </span><span class="k">end function </span><span class="n">state_is_ok</span>
<a id="ln-275" name="ln-275" href="#ln-275"></a>
<a id="ln-276" name="ln-276" href="#ln-276"></a><span class="w"> </span><span class="c">!> Check if the current state is an error state</span>
<a id="ln-277" name="ln-277" href="#ln-277"></a><span class="w"> </span><span class="k">elemental </span><span class="kt">logical</span><span class="p">(</span><span class="n">lk</span><span class="p">)</span><span class="w"> </span><span class="k">function </span><span class="n">state_is_error</span><span class="p">(</span><span class="n">this</span><span class="p">)</span>
<a id="ln-278" name="ln-278" href="#ln-278"></a><span class="w"> </span><span class="k">class</span><span class="p">(</span><span class="n">state_type</span><span class="p">),</span><span class="k">intent</span><span class="p">(</span><span class="n">in</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">this</span>
<a id="ln-279" name="ln-279" href="#ln-279"></a><span class="w"> </span><span class="n">state_is_error</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">this</span><span class="p">%</span><span class="n">state</span><span class="w"> </span><span class="o">/=</span><span class="w"> </span><span class="n">STDLIB_SUCCESS</span>
<a id="ln-280" name="ln-280" href="#ln-280"></a><span class="w"> </span><span class="k">end function </span><span class="n">state_is_error</span>
<a id="ln-281" name="ln-281" href="#ln-281"></a>
<a id="ln-282" name="ln-282" href="#ln-282"></a><span class="w"> </span><span class="c">!> Compare an error state with an integer flag</span>
<a id="ln-283" name="ln-283" href="#ln-283"></a><span class="w"> </span><span class="k">elemental </span><span class="kt">logical</span><span class="p">(</span><span class="n">lk</span><span class="p">)</span><span class="w"> </span><span class="k">function </span><span class="n">state_eq_flag</span><span class="p">(</span><span class="n">err</span><span class="p">,</span><span class="n">flag</span><span class="p">)</span>
<a id="ln-284" name="ln-284" href="#ln-284"></a><span class="w"> </span><span class="k">class</span><span class="p">(</span><span class="n">state_type</span><span class="p">),</span><span class="k">intent</span><span class="p">(</span><span class="n">in</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">err</span>
<a id="ln-285" name="ln-285" href="#ln-285"></a><span class="w"> </span><span class="kt">integer</span><span class="p">,</span><span class="k">intent</span><span class="p">(</span><span class="n">in</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">flag</span>
<a id="ln-286" name="ln-286" href="#ln-286"></a><span class="w"> </span><span class="n">state_eq_flag</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">err</span><span class="p">%</span><span class="n">state</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="n">flag</span>
<a id="ln-287" name="ln-287" href="#ln-287"></a><span class="w"> </span><span class="k">end function </span><span class="n">state_eq_flag</span>
<a id="ln-288" name="ln-288" href="#ln-288"></a>
<a id="ln-289" name="ln-289" href="#ln-289"></a><span class="w"> </span><span class="c">!> Compare an integer flag with the error state</span>
<a id="ln-290" name="ln-290" href="#ln-290"></a><span class="w"> </span><span class="k">elemental </span><span class="kt">logical</span><span class="p">(</span><span class="n">lk</span><span class="p">)</span><span class="w"> </span><span class="k">function </span><span class="n">flag_eq_state</span><span class="p">(</span><span class="n">flag</span><span class="p">,</span><span class="n">err</span><span class="p">)</span>
<a id="ln-291" name="ln-291" href="#ln-291"></a><span class="w"> </span><span class="kt">integer</span><span class="p">,</span><span class="k">intent</span><span class="p">(</span><span class="n">in</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">flag</span>
<a id="ln-292" name="ln-292" href="#ln-292"></a><span class="w"> </span><span class="k">class</span><span class="p">(</span><span class="n">state_type</span><span class="p">),</span><span class="k">intent</span><span class="p">(</span><span class="n">in</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">err</span>
<a id="ln-293" name="ln-293" href="#ln-293"></a><span class="w"> </span><span class="n">flag_eq_state</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">err</span><span class="p">%</span><span class="n">state</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="n">flag</span>
<a id="ln-294" name="ln-294" href="#ln-294"></a><span class="w"> </span><span class="k">end function </span><span class="n">flag_eq_state</span>
<a id="ln-295" name="ln-295" href="#ln-295"></a>
<a id="ln-296" name="ln-296" href="#ln-296"></a><span class="w"> </span><span class="c">!> Compare the error state with an integer flag</span>
<a id="ln-297" name="ln-297" href="#ln-297"></a><span class="w"> </span><span class="k">elemental </span><span class="kt">logical</span><span class="p">(</span><span class="n">lk</span><span class="p">)</span><span class="w"> </span><span class="k">function </span><span class="n">state_neq_flag</span><span class="p">(</span><span class="n">err</span><span class="p">,</span><span class="n">flag</span><span class="p">)</span>
<a id="ln-298" name="ln-298" href="#ln-298"></a><span class="w"> </span><span class="k">class</span><span class="p">(</span><span class="n">state_type</span><span class="p">),</span><span class="k">intent</span><span class="p">(</span><span class="n">in</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">err</span>
<a id="ln-299" name="ln-299" href="#ln-299"></a><span class="w"> </span><span class="kt">integer</span><span class="p">,</span><span class="k">intent</span><span class="p">(</span><span class="n">in</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">flag</span>
<a id="ln-300" name="ln-300" href="#ln-300"></a><span class="w"> </span><span class="n">state_neq_flag</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">.</span><span class="nb">not</span><span class="p">.</span><span class="w"> </span><span class="n">state_eq_flag</span><span class="p">(</span><span class="n">err</span><span class="p">,</span><span class="n">flag</span><span class="p">)</span>
<a id="ln-301" name="ln-301" href="#ln-301"></a><span class="w"> </span><span class="k">end function </span><span class="n">state_neq_flag</span>
<a id="ln-302" name="ln-302" href="#ln-302"></a>
<a id="ln-303" name="ln-303" href="#ln-303"></a><span class="w"> </span><span class="c">!> Compare an integer flag with the error state</span>
<a id="ln-304" name="ln-304" href="#ln-304"></a><span class="w"> </span><span class="k">elemental </span><span class="kt">logical</span><span class="p">(</span><span class="n">lk</span><span class="p">)</span><span class="w"> </span><span class="k">function </span><span class="n">flag_neq_state</span><span class="p">(</span><span class="n">flag</span><span class="p">,</span><span class="n">err</span><span class="p">)</span>
<a id="ln-305" name="ln-305" href="#ln-305"></a><span class="w"> </span><span class="kt">integer</span><span class="p">,</span><span class="k">intent</span><span class="p">(</span><span class="n">in</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">flag</span>
<a id="ln-306" name="ln-306" href="#ln-306"></a><span class="w"> </span><span class="k">class</span><span class="p">(</span><span class="n">state_type</span><span class="p">),</span><span class="k">intent</span><span class="p">(</span><span class="n">in</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">err</span>
<a id="ln-307" name="ln-307" href="#ln-307"></a><span class="w"> </span><span class="n">flag_neq_state</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">.</span><span class="nb">not</span><span class="p">.</span><span class="w"> </span><span class="n">state_eq_flag</span><span class="p">(</span><span class="n">err</span><span class="p">,</span><span class="n">flag</span><span class="p">)</span>
<a id="ln-308" name="ln-308" href="#ln-308"></a><span class="w"> </span><span class="k">end function </span><span class="n">flag_neq_state</span>
<a id="ln-309" name="ln-309" href="#ln-309"></a>
<a id="ln-310" name="ln-310" href="#ln-310"></a><span class="w"> </span><span class="c">!> Compare the error state with an integer flag</span>
<a id="ln-311" name="ln-311" href="#ln-311"></a><span class="w"> </span><span class="k">elemental </span><span class="kt">logical</span><span class="p">(</span><span class="n">lk</span><span class="p">)</span><span class="w"> </span><span class="k">function </span><span class="n">state_lt_flag</span><span class="p">(</span><span class="n">err</span><span class="p">,</span><span class="n">flag</span><span class="p">)</span>
<a id="ln-312" name="ln-312" href="#ln-312"></a><span class="w"> </span><span class="k">class</span><span class="p">(</span><span class="n">state_type</span><span class="p">),</span><span class="k">intent</span><span class="p">(</span><span class="n">in</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">err</span>
<a id="ln-313" name="ln-313" href="#ln-313"></a><span class="w"> </span><span class="kt">integer</span><span class="p">,</span><span class="k">intent</span><span class="p">(</span><span class="n">in</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">flag</span>
<a id="ln-314" name="ln-314" href="#ln-314"></a><span class="w"> </span><span class="n">state_lt_flag</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">err</span><span class="p">%</span><span class="n">state</span><span class="w"> </span><span class="o"><</span><span class="w"> </span><span class="n">flag</span>
<a id="ln-315" name="ln-315" href="#ln-315"></a><span class="w"> </span><span class="k">end function </span><span class="n">state_lt_flag</span>
<a id="ln-316" name="ln-316" href="#ln-316"></a>
<a id="ln-317" name="ln-317" href="#ln-317"></a><span class="w"> </span><span class="c">!> Compare the error state with an integer flag</span>
<a id="ln-318" name="ln-318" href="#ln-318"></a><span class="w"> </span><span class="k">elemental </span><span class="kt">logical</span><span class="p">(</span><span class="n">lk</span><span class="p">)</span><span class="w"> </span><span class="k">function </span><span class="n">state_le_flag</span><span class="p">(</span><span class="n">err</span><span class="p">,</span><span class="n">flag</span><span class="p">)</span>
<a id="ln-319" name="ln-319" href="#ln-319"></a><span class="w"> </span><span class="k">class</span><span class="p">(</span><span class="n">state_type</span><span class="p">),</span><span class="k">intent</span><span class="p">(</span><span class="n">in</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">err</span>
<a id="ln-320" name="ln-320" href="#ln-320"></a><span class="w"> </span><span class="kt">integer</span><span class="p">,</span><span class="k">intent</span><span class="p">(</span><span class="n">in</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">flag</span>
<a id="ln-321" name="ln-321" href="#ln-321"></a><span class="w"> </span><span class="n">state_le_flag</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">err</span><span class="p">%</span><span class="n">state</span><span class="w"> </span><span class="o"><=</span><span class="w"> </span><span class="n">flag</span>
<a id="ln-322" name="ln-322" href="#ln-322"></a><span class="w"> </span><span class="k">end function </span><span class="n">state_le_flag</span>
<a id="ln-323" name="ln-323" href="#ln-323"></a>
<a id="ln-324" name="ln-324" href="#ln-324"></a><span class="w"> </span><span class="c">!> Compare an integer flag with the error state</span>
<a id="ln-325" name="ln-325" href="#ln-325"></a><span class="w"> </span><span class="k">elemental </span><span class="kt">logical</span><span class="p">(</span><span class="n">lk</span><span class="p">)</span><span class="w"> </span><span class="k">function </span><span class="n">flag_lt_state</span><span class="p">(</span><span class="n">flag</span><span class="p">,</span><span class="n">err</span><span class="p">)</span>
<a id="ln-326" name="ln-326" href="#ln-326"></a><span class="w"> </span><span class="kt">integer</span><span class="p">,</span><span class="k">intent</span><span class="p">(</span><span class="n">in</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">flag</span>
<a id="ln-327" name="ln-327" href="#ln-327"></a><span class="w"> </span><span class="k">class</span><span class="p">(</span><span class="n">state_type</span><span class="p">),</span><span class="k">intent</span><span class="p">(</span><span class="n">in</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">err</span>
<a id="ln-328" name="ln-328" href="#ln-328"></a><span class="w"> </span><span class="n">flag_lt_state</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">err</span><span class="p">%</span><span class="n">state</span><span class="w"> </span><span class="o"><</span><span class="w"> </span><span class="n">flag</span>
<a id="ln-329" name="ln-329" href="#ln-329"></a><span class="w"> </span><span class="k">end function </span><span class="n">flag_lt_state</span>
<a id="ln-330" name="ln-330" href="#ln-330"></a>
<a id="ln-331" name="ln-331" href="#ln-331"></a><span class="w"> </span><span class="c">!> Compare an integer flag with the error state</span>
<a id="ln-332" name="ln-332" href="#ln-332"></a><span class="w"> </span><span class="k">elemental </span><span class="kt">logical</span><span class="p">(</span><span class="n">lk</span><span class="p">)</span><span class="w"> </span><span class="k">function </span><span class="n">flag_le_state</span><span class="p">(</span><span class="n">flag</span><span class="p">,</span><span class="n">err</span><span class="p">)</span>
<a id="ln-333" name="ln-333" href="#ln-333"></a><span class="w"> </span><span class="kt">integer</span><span class="p">,</span><span class="k">intent</span><span class="p">(</span><span class="n">in</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">flag</span>
<a id="ln-334" name="ln-334" href="#ln-334"></a><span class="w"> </span><span class="k">class</span><span class="p">(</span><span class="n">state_type</span><span class="p">),</span><span class="k">intent</span><span class="p">(</span><span class="n">in</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">err</span>
<a id="ln-335" name="ln-335" href="#ln-335"></a><span class="w"> </span><span class="n">flag_le_state</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">err</span><span class="p">%</span><span class="n">state</span><span class="w"> </span><span class="o"><=</span><span class="w"> </span><span class="n">flag</span>
<a id="ln-336" name="ln-336" href="#ln-336"></a><span class="w"> </span><span class="k">end function </span><span class="n">flag_le_state</span>
<a id="ln-337" name="ln-337" href="#ln-337"></a>
<a id="ln-338" name="ln-338" href="#ln-338"></a><span class="w"> </span><span class="c">!> Compare the error state with an integer flag</span>
<a id="ln-339" name="ln-339" href="#ln-339"></a><span class="w"> </span><span class="k">elemental </span><span class="kt">logical</span><span class="p">(</span><span class="n">lk</span><span class="p">)</span><span class="w"> </span><span class="k">function </span><span class="n">state_gt_flag</span><span class="p">(</span><span class="n">err</span><span class="p">,</span><span class="n">flag</span><span class="p">)</span>
<a id="ln-340" name="ln-340" href="#ln-340"></a><span class="w"> </span><span class="k">class</span><span class="p">(</span><span class="n">state_type</span><span class="p">),</span><span class="k">intent</span><span class="p">(</span><span class="n">in</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">err</span>
<a id="ln-341" name="ln-341" href="#ln-341"></a><span class="w"> </span><span class="kt">integer</span><span class="p">,</span><span class="k">intent</span><span class="p">(</span><span class="n">in</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">flag</span>
<a id="ln-342" name="ln-342" href="#ln-342"></a><span class="w"> </span><span class="n">state_gt_flag</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">err</span><span class="p">%</span><span class="n">state</span><span class="w"> </span><span class="o">></span><span class="w"> </span><span class="n">flag</span>
<a id="ln-343" name="ln-343" href="#ln-343"></a><span class="w"> </span><span class="k">end function </span><span class="n">state_gt_flag</span>
<a id="ln-344" name="ln-344" href="#ln-344"></a>
<a id="ln-345" name="ln-345" href="#ln-345"></a><span class="w"> </span><span class="c">!> Compare the error state with an integer flag</span>
<a id="ln-346" name="ln-346" href="#ln-346"></a><span class="w"> </span><span class="k">elemental </span><span class="kt">logical</span><span class="p">(</span><span class="n">lk</span><span class="p">)</span><span class="w"> </span><span class="k">function </span><span class="n">state_ge_flag</span><span class="p">(</span><span class="n">err</span><span class="p">,</span><span class="n">flag</span><span class="p">)</span>
<a id="ln-347" name="ln-347" href="#ln-347"></a><span class="w"> </span><span class="k">class</span><span class="p">(</span><span class="n">state_type</span><span class="p">),</span><span class="k">intent</span><span class="p">(</span><span class="n">in</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">err</span>
<a id="ln-348" name="ln-348" href="#ln-348"></a><span class="w"> </span><span class="kt">integer</span><span class="p">,</span><span class="k">intent</span><span class="p">(</span><span class="n">in</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">flag</span>
<a id="ln-349" name="ln-349" href="#ln-349"></a><span class="w"> </span><span class="n">state_ge_flag</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">err</span><span class="p">%</span><span class="n">state</span><span class="w"> </span><span class="o">>=</span><span class="w"> </span><span class="n">flag</span>
<a id="ln-350" name="ln-350" href="#ln-350"></a><span class="w"> </span><span class="k">end function </span><span class="n">state_ge_flag</span>
<a id="ln-351" name="ln-351" href="#ln-351"></a>
<a id="ln-352" name="ln-352" href="#ln-352"></a><span class="w"> </span><span class="c">!> Compare an integer flag with the error state</span>
<a id="ln-353" name="ln-353" href="#ln-353"></a><span class="w"> </span><span class="k">elemental </span><span class="kt">logical</span><span class="p">(</span><span class="n">lk</span><span class="p">)</span><span class="w"> </span><span class="k">function </span><span class="n">flag_gt_state</span><span class="p">(</span><span class="n">flag</span><span class="p">,</span><span class="n">err</span><span class="p">)</span>
<a id="ln-354" name="ln-354" href="#ln-354"></a><span class="w"> </span><span class="kt">integer</span><span class="p">,</span><span class="k">intent</span><span class="p">(</span><span class="n">in</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">flag</span>
<a id="ln-355" name="ln-355" href="#ln-355"></a><span class="w"> </span><span class="k">class</span><span class="p">(</span><span class="n">state_type</span><span class="p">),</span><span class="k">intent</span><span class="p">(</span><span class="n">in</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">err</span>
<a id="ln-356" name="ln-356" href="#ln-356"></a><span class="w"> </span><span class="n">flag_gt_state</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">err</span><span class="p">%</span><span class="n">state</span><span class="w"> </span><span class="o">></span><span class="w"> </span><span class="n">flag</span>
<a id="ln-357" name="ln-357" href="#ln-357"></a><span class="w"> </span><span class="k">end function </span><span class="n">flag_gt_state</span>
<a id="ln-358" name="ln-358" href="#ln-358"></a>
<a id="ln-359" name="ln-359" href="#ln-359"></a><span class="w"> </span><span class="c">!> Compare an integer flag with the error state</span>
<a id="ln-360" name="ln-360" href="#ln-360"></a><span class="w"> </span><span class="k">elemental </span><span class="kt">logical</span><span class="p">(</span><span class="n">lk</span><span class="p">)</span><span class="w"> </span><span class="k">function </span><span class="n">flag_ge_state</span><span class="p">(</span><span class="n">flag</span><span class="p">,</span><span class="n">err</span><span class="p">)</span>
<a id="ln-361" name="ln-361" href="#ln-361"></a><span class="w"> </span><span class="kt">integer</span><span class="p">,</span><span class="k">intent</span><span class="p">(</span><span class="n">in</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">flag</span>
<a id="ln-362" name="ln-362" href="#ln-362"></a><span class="w"> </span><span class="k">class</span><span class="p">(</span><span class="n">state_type</span><span class="p">),</span><span class="k">intent</span><span class="p">(</span><span class="n">in</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">err</span>
<a id="ln-363" name="ln-363" href="#ln-363"></a><span class="w"> </span><span class="n">flag_ge_state</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">err</span><span class="p">%</span><span class="n">state</span><span class="w"> </span><span class="o">>=</span><span class="w"> </span><span class="n">flag</span>
<a id="ln-364" name="ln-364" href="#ln-364"></a><span class="w"> </span><span class="k">end function </span><span class="n">flag_ge_state</span>
<a id="ln-365" name="ln-365" href="#ln-365"></a>
<a id="ln-366" name="ln-366" href="#ln-366"></a><span class="w"> </span><span class="c">!> Assign a state type to another</span>
<a id="ln-367" name="ln-367" href="#ln-367"></a><span class="w"> </span><span class="k">elemental subroutine </span><span class="n">state_assign_state</span><span class="p">(</span><span class="n">to</span><span class="p">,</span><span class="w"> </span><span class="n">from</span><span class="p">)</span>
<a id="ln-368" name="ln-368" href="#ln-368"></a><span class="w"> </span><span class="k">class</span><span class="p">(</span><span class="n">state_type</span><span class="p">),</span><span class="w"> </span><span class="k">intent</span><span class="p">(</span><span class="n">inout</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">to</span>
<a id="ln-369" name="ln-369" href="#ln-369"></a><span class="w"> </span><span class="k">class</span><span class="p">(</span><span class="n">state_type</span><span class="p">),</span><span class="w"> </span><span class="k">intent</span><span class="p">(</span><span class="n">in</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">from</span>
<a id="ln-370" name="ln-370" href="#ln-370"></a><span class="w"> </span>
<a id="ln-371" name="ln-371" href="#ln-371"></a><span class="w"> </span><span class="n">to</span><span class="p">%</span><span class="n">state</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">from</span><span class="p">%</span><span class="n">state</span>
<a id="ln-372" name="ln-372" href="#ln-372"></a><span class="w"> </span><span class="n">to</span><span class="p">%</span><span class="n">message</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">from</span><span class="p">%</span><span class="n">message</span>
<a id="ln-373" name="ln-373" href="#ln-373"></a><span class="w"> </span><span class="n">to</span><span class="p">%</span><span class="n">where_at</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">from</span><span class="p">%</span><span class="n">where_at</span>
<a id="ln-374" name="ln-374" href="#ln-374"></a><span class="w"> </span>
<a id="ln-375" name="ln-375" href="#ln-375"></a><span class="w"> </span><span class="k">end subroutine </span><span class="n">state_assign_state</span>
<a id="ln-376" name="ln-376" href="#ln-376"></a>
<a id="ln-377" name="ln-377" href="#ln-377"></a><span class="w"> </span><span class="c">!> Append a generic value to the error flag (rank-agnostic)</span>
<a id="ln-378" name="ln-378" href="#ln-378"></a><span class="w"> </span><span class="k">pure subroutine </span><span class="n">appendr</span><span class="p">(</span><span class="n">msg</span><span class="p">,</span><span class="n">a</span><span class="p">,</span><span class="n">prefix</span><span class="p">)</span>
<a id="ln-379" name="ln-379" href="#ln-379"></a><span class="w"> </span><span class="k">class</span><span class="p">(</span><span class="o">*</span><span class="p">),</span><span class="k">optional</span><span class="p">,</span><span class="k">intent</span><span class="p">(</span><span class="n">in</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">a</span><span class="p">(..)</span>
<a id="ln-380" name="ln-380" href="#ln-380"></a><span class="w"> </span><span class="kt">character</span><span class="p">(</span><span class="nb">len</span><span class="o">=*</span><span class="p">),</span><span class="k">intent</span><span class="p">(</span><span class="n">inout</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">msg</span>
<a id="ln-381" name="ln-381" href="#ln-381"></a><span class="w"> </span><span class="kt">character</span><span class="p">,</span><span class="k">optional</span><span class="p">,</span><span class="k">intent</span><span class="p">(</span><span class="n">in</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">prefix</span>
<a id="ln-382" name="ln-382" href="#ln-382"></a><span class="w"> </span>
<a id="ln-383" name="ln-383" href="#ln-383"></a><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="nb">present</span><span class="p">(</span><span class="n">a</span><span class="p">))</span><span class="w"> </span><span class="k">then </span>
<a id="ln-384" name="ln-384" href="#ln-384"></a><span class="k"> select </span><span class="n">rank</span><span class="w"> </span><span class="p">(</span><span class="n">v</span><span class="o">=></span><span class="n">a</span><span class="p">)</span>
<a id="ln-385" name="ln-385" href="#ln-385"></a><span class="w"> </span><span class="n">rank</span><span class="w"> </span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>
<a id="ln-386" name="ln-386" href="#ln-386"></a><span class="w"> </span><span class="k">call </span><span class="n">append</span><span class="w"> </span><span class="p">(</span><span class="n">msg</span><span class="p">,</span><span class="n">v</span><span class="p">,</span><span class="n">prefix</span><span class="p">)</span>
<a id="ln-387" name="ln-387" href="#ln-387"></a><span class="w"> </span><span class="n">rank</span><span class="w"> </span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
<a id="ln-388" name="ln-388" href="#ln-388"></a><span class="w"> </span><span class="k">call </span><span class="n">appendv</span><span class="p">(</span><span class="n">msg</span><span class="p">,</span><span class="n">v</span><span class="p">)</span>
<a id="ln-389" name="ln-389" href="#ln-389"></a><span class="w"> </span><span class="n">rank</span><span class="w"> </span><span class="n">default</span>
<a id="ln-390" name="ln-390" href="#ln-390"></a><span class="w"> </span><span class="n">msg</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">trim</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span><span class="o">//</span><span class="s1">' <ERROR: INVALID RANK>'</span>
<a id="ln-391" name="ln-391" href="#ln-391"></a><span class="w"> </span>
<a id="ln-392" name="ln-392" href="#ln-392"></a><span class="w"> </span><span class="k">end select </span>
<a id="ln-393" name="ln-393" href="#ln-393"></a><span class="k"> endif</span>
<a id="ln-394" name="ln-394" href="#ln-394"></a><span class="k"> </span>
<a id="ln-395" name="ln-395" href="#ln-395"></a><span class="k"> end subroutine </span><span class="n">appendr</span>
<a id="ln-396" name="ln-396" href="#ln-396"></a>
<a id="ln-397" name="ln-397" href="#ln-397"></a><span class="w"> </span><span class="c">! Append a generic value to the error flag</span>
<a id="ln-398" name="ln-398" href="#ln-398"></a><span class="w"> </span><span class="k">pure subroutine </span><span class="n">append</span><span class="p">(</span><span class="n">msg</span><span class="p">,</span><span class="n">a</span><span class="p">,</span><span class="n">prefix</span><span class="p">)</span>
<a id="ln-399" name="ln-399" href="#ln-399"></a><span class="w"> </span><span class="k">class</span><span class="p">(</span><span class="o">*</span><span class="p">),</span><span class="k">intent</span><span class="p">(</span><span class="n">in</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">a</span>
<a id="ln-400" name="ln-400" href="#ln-400"></a><span class="w"> </span><span class="kt">character</span><span class="p">(</span><span class="nb">len</span><span class="o">=*</span><span class="p">),</span><span class="k">intent</span><span class="p">(</span><span class="n">inout</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">msg</span>
<a id="ln-401" name="ln-401" href="#ln-401"></a><span class="w"> </span><span class="kt">character</span><span class="p">,</span><span class="k">optional</span><span class="p">,</span><span class="k">intent</span><span class="p">(</span><span class="n">in</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">prefix</span>
<a id="ln-402" name="ln-402" href="#ln-402"></a>
<a id="ln-403" name="ln-403" href="#ln-403"></a><span class="w"> </span><span class="kt">character</span><span class="p">(</span><span class="nb">len</span><span class="o">=</span><span class="n">MSG_LENGTH</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">buffer</span><span class="p">,</span><span class="n">buffer2</span>
<a id="ln-404" name="ln-404" href="#ln-404"></a><span class="w"> </span><span class="kt">character</span><span class="p">(</span><span class="nb">len</span><span class="o">=</span><span class="mi">2</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">sep</span>
<a id="ln-405" name="ln-405" href="#ln-405"></a><span class="w"> </span><span class="kt">integer</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">ls</span>
<a id="ln-406" name="ln-406" href="#ln-406"></a>
<a id="ln-407" name="ln-407" href="#ln-407"></a><span class="w"> </span><span class="c">! Do not add separator if this is the first instance</span>
<a id="ln-408" name="ln-408" href="#ln-408"></a><span class="w"> </span><span class="n">sep</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">' '</span>
<a id="ln-409" name="ln-409" href="#ln-409"></a><span class="w"> </span><span class="n">ls</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">merge</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="nb">len_trim</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span><span class="w"> </span><span class="o">></span><span class="w"> </span><span class="mi">0</span><span class="p">)</span>
<a id="ln-410" name="ln-410" href="#ln-410"></a>
<a id="ln-411" name="ln-411" href="#ln-411"></a><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="nb">present</span><span class="p">(</span><span class="n">prefix</span><span class="p">))</span><span class="w"> </span><span class="k">then</span>
<a id="ln-412" name="ln-412" href="#ln-412"></a><span class="k"> </span><span class="n">ls</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">ls</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="mi">1</span>
<a id="ln-413" name="ln-413" href="#ln-413"></a><span class="w"> </span><span class="n">sep</span><span class="p">(</span><span class="n">ls</span><span class="p">:</span><span class="n">ls</span><span class="p">)</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">prefix</span>
<a id="ln-414" name="ln-414" href="#ln-414"></a><span class="w"> </span><span class="k">end if</span>
<a id="ln-415" name="ln-415" href="#ln-415"></a>
<a id="ln-416" name="ln-416" href="#ln-416"></a><span class="k"> select type</span><span class="w"> </span><span class="p">(</span><span class="n">aa</span><span class="w"> </span><span class="o">=></span><span class="w"> </span><span class="n">a</span><span class="p">)</span>
<a id="ln-417" name="ln-417" href="#ln-417"></a>
<a id="ln-418" name="ln-418" href="#ln-418"></a><span class="w"> </span><span class="c">!> String type</span>
<a id="ln-419" name="ln-419" href="#ln-419"></a><span class="w"> </span><span class="k">type is</span><span class="w"> </span><span class="p">(</span><span class="kt">character</span><span class="p">(</span><span class="nb">len</span><span class="o">=*</span><span class="p">))</span>
<a id="ln-420" name="ln-420" href="#ln-420"></a><span class="w"> </span><span class="n">msg</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">trim</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span><span class="o">//</span><span class="n">sep</span><span class="p">(:</span><span class="n">ls</span><span class="p">)</span><span class="o">//</span><span class="n">aa</span>
<a id="ln-421" name="ln-421" href="#ln-421"></a>
<a id="ln-422" name="ln-422" href="#ln-422"></a><span class="w"> </span><span class="c">!> Numeric types</span>
<a id="ln-423" name="ln-423" href="#ln-423"></a><span class="cp">#:for k1, t1 in KINDS_TYPES</span>
<a id="ln-424" name="ln-424" href="#ln-424"></a><span class="w"> </span><span class="k">type is</span><span class="w"> </span><span class="p">(</span><span class="err">${</span><span class="n">t1</span><span class="err">}$</span><span class="p">)</span>
<a id="ln-425" name="ln-425" href="#ln-425"></a><span class="w"> </span><span class="err">#</span><span class="p">:</span><span class="k">if</span><span class="w"> </span><span class="s1">'complex'</span><span class="w"> </span><span class="n">in</span><span class="w"> </span><span class="n">t1</span>
<a id="ln-426" name="ln-426" href="#ln-426"></a><span class="w"> </span><span class="k">write</span><span class="w"> </span><span class="p">(</span><span class="n">buffer</span><span class="p">,</span><span class="w"> </span><span class="n">FMT_REAL_$</span><span class="err">{</span><span class="n">k1</span><span class="err">}$</span><span class="p">)</span><span class="w"> </span><span class="n">aa</span><span class="p">%</span><span class="n">re</span>
<a id="ln-427" name="ln-427" href="#ln-427"></a><span class="w"> </span><span class="k">write</span><span class="w"> </span><span class="p">(</span><span class="n">buffer2</span><span class="p">,</span><span class="n">FMT_REAL_$</span><span class="err">{</span><span class="n">k1</span><span class="err">}$</span><span class="p">)</span><span class="w"> </span><span class="n">aa</span><span class="p">%</span><span class="n">im</span>
<a id="ln-428" name="ln-428" href="#ln-428"></a><span class="w"> </span><span class="n">msg</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">trim</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span><span class="o">//</span><span class="n">sep</span><span class="p">(:</span><span class="n">ls</span><span class="p">)</span><span class="o">//</span><span class="s1">'('</span><span class="o">//</span><span class="nb">trim</span><span class="p">(</span><span class="nb">adjustl</span><span class="p">(</span><span class="n">buffer</span><span class="p">))</span><span class="o">//</span><span class="s1">','</span><span class="o">//</span><span class="nb">trim</span><span class="p">(</span><span class="nb">adjustl</span><span class="p">(</span><span class="n">buffer2</span><span class="p">))</span><span class="o">//</span><span class="s1">')'</span>
<a id="ln-429" name="ln-429" href="#ln-429"></a><span class="w"> </span><span class="err">#</span><span class="p">:</span><span class="k">else</span>
<a id="ln-430" name="ln-430" href="#ln-430"></a><span class="w"> </span><span class="err">#</span><span class="p">:</span><span class="k">if</span><span class="w"> </span><span class="s1">'real'</span><span class="w"> </span><span class="n">in</span><span class="w"> </span><span class="n">t1</span>
<a id="ln-431" name="ln-431" href="#ln-431"></a><span class="w"> </span><span class="k">write</span><span class="w"> </span><span class="p">(</span><span class="n">buffer</span><span class="p">,</span><span class="n">FMT_REAL_$</span><span class="err">{</span><span class="n">k1</span><span class="err">}$</span><span class="p">)</span><span class="w"> </span><span class="n">aa</span>
<a id="ln-432" name="ln-432" href="#ln-432"></a><span class="w"> </span><span class="err">#</span><span class="p">:</span><span class="k">else</span>
<a id="ln-433" name="ln-433" href="#ln-433"></a><span class="k"> write</span><span class="w"> </span><span class="p">(</span><span class="n">buffer</span><span class="p">,</span><span class="n">FMT_INT</span><span class="p">)</span><span class="w"> </span><span class="n">aa</span>
<a id="ln-434" name="ln-434" href="#ln-434"></a><span class="w"> </span><span class="err">#</span><span class="p">:</span><span class="k">endif</span>
<a id="ln-435" name="ln-435" href="#ln-435"></a><span class="k"> </span><span class="n">msg</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">trim</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span><span class="o">//</span><span class="n">sep</span><span class="p">(:</span><span class="n">ls</span><span class="p">)</span><span class="o">//</span><span class="nb">trim</span><span class="p">(</span><span class="nb">adjustl</span><span class="p">(</span><span class="n">buffer</span><span class="p">))</span>
<a id="ln-436" name="ln-436" href="#ln-436"></a><span class="w"> </span><span class="err">#</span><span class="p">:</span><span class="k">endif</span>
<a id="ln-437" name="ln-437" href="#ln-437"></a>
<a id="ln-438" name="ln-438" href="#ln-438"></a><span class="cp">#:endfor</span>
<a id="ln-439" name="ln-439" href="#ln-439"></a><span class="w"> </span><span class="k">class </span><span class="n">default</span>
<a id="ln-440" name="ln-440" href="#ln-440"></a><span class="w"> </span><span class="n">msg</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">trim</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span><span class="o">//</span><span class="s1">' <ERROR: INVALID TYPE>'</span>
<a id="ln-441" name="ln-441" href="#ln-441"></a>
<a id="ln-442" name="ln-442" href="#ln-442"></a><span class="w"> </span><span class="k">end select</span>
<a id="ln-443" name="ln-443" href="#ln-443"></a>
<a id="ln-444" name="ln-444" href="#ln-444"></a><span class="k"> end subroutine </span><span class="n">append</span>
<a id="ln-445" name="ln-445" href="#ln-445"></a>
<a id="ln-446" name="ln-446" href="#ln-446"></a><span class="w"> </span><span class="c">!> Append a generic vector to the error flag</span>
<a id="ln-447" name="ln-447" href="#ln-447"></a><span class="w"> </span><span class="k">pure subroutine </span><span class="n">appendv</span><span class="p">(</span><span class="n">msg</span><span class="p">,</span><span class="n">a</span><span class="p">)</span>
<a id="ln-448" name="ln-448" href="#ln-448"></a><span class="w"> </span><span class="k">class</span><span class="p">(</span><span class="o">*</span><span class="p">),</span><span class="k">intent</span><span class="p">(</span><span class="n">in</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">a</span><span class="p">(:)</span>
<a id="ln-449" name="ln-449" href="#ln-449"></a><span class="w"> </span><span class="kt">character</span><span class="p">(</span><span class="nb">len</span><span class="o">=*</span><span class="p">),</span><span class="k">intent</span><span class="p">(</span><span class="n">inout</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">msg</span>
<a id="ln-450" name="ln-450" href="#ln-450"></a>
<a id="ln-451" name="ln-451" href="#ln-451"></a><span class="w"> </span><span class="kt">integer</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">j</span><span class="p">,</span><span class="n">ls</span>
<a id="ln-452" name="ln-452" href="#ln-452"></a><span class="w"> </span><span class="kt">character</span><span class="p">(</span><span class="nb">len</span><span class="o">=</span><span class="n">MSG_LENGTH</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">buffer</span><span class="p">,</span><span class="n">buffer2</span><span class="p">,</span><span class="n">buffer_format</span>
<a id="ln-453" name="ln-453" href="#ln-453"></a><span class="w"> </span><span class="kt">character</span><span class="p">(</span><span class="nb">len</span><span class="o">=</span><span class="mi">2</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">sep</span>
<a id="ln-454" name="ln-454" href="#ln-454"></a>
<a id="ln-455" name="ln-455" href="#ln-455"></a><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="n">size</span><span class="p">(</span><span class="n">a</span><span class="p">)</span><span class="w"> </span><span class="o"><=</span><span class="w"> </span><span class="mi">0</span><span class="p">)</span><span class="w"> </span><span class="k">return</span>
<a id="ln-456" name="ln-456" href="#ln-456"></a>
<a id="ln-457" name="ln-457" href="#ln-457"></a><span class="w"> </span><span class="c">! Default: separate elements with one space</span>
<a id="ln-458" name="ln-458" href="#ln-458"></a><span class="w"> </span><span class="n">sep</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">' '</span>
<a id="ln-459" name="ln-459" href="#ln-459"></a><span class="w"> </span><span class="n">ls</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">1</span>
<a id="ln-460" name="ln-460" href="#ln-460"></a>
<a id="ln-461" name="ln-461" href="#ln-461"></a><span class="w"> </span><span class="c">! Open bracket</span>
<a id="ln-462" name="ln-462" href="#ln-462"></a><span class="w"> </span><span class="n">msg</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">trim</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span><span class="o">//</span><span class="s1">' ['</span>
<a id="ln-463" name="ln-463" href="#ln-463"></a>
<a id="ln-464" name="ln-464" href="#ln-464"></a><span class="w"> </span><span class="c">! Do not call append(msg(aa(j))), it will crash gfortran</span>
<a id="ln-465" name="ln-465" href="#ln-465"></a><span class="w"> </span><span class="k">select type</span><span class="w"> </span><span class="p">(</span><span class="n">aa</span><span class="w"> </span><span class="o">=></span><span class="w"> </span><span class="n">a</span><span class="p">)</span>
<a id="ln-466" name="ln-466" href="#ln-466"></a>
<a id="ln-467" name="ln-467" href="#ln-467"></a><span class="w"> </span><span class="c">!> Strings (cannot use string_type due to `sequence`)</span>
<a id="ln-468" name="ln-468" href="#ln-468"></a><span class="w"> </span><span class="k">type is</span><span class="w"> </span><span class="p">(</span><span class="kt">character</span><span class="p">(</span><span class="nb">len</span><span class="o">=*</span><span class="p">))</span>
<a id="ln-469" name="ln-469" href="#ln-469"></a><span class="w"> </span><span class="n">msg</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">trim</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span><span class="o">//</span><span class="nb">adjustl</span><span class="p">(</span><span class="n">aa</span><span class="p">(</span><span class="mi">1</span><span class="p">))</span>
<a id="ln-470" name="ln-470" href="#ln-470"></a><span class="w"> </span><span class="k">do </span><span class="n">j</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">2</span><span class="p">,</span><span class="n">size</span><span class="p">(</span><span class="n">a</span><span class="p">)</span>
<a id="ln-471" name="ln-471" href="#ln-471"></a><span class="w"> </span><span class="n">msg</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">trim</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span><span class="o">//</span><span class="n">sep</span><span class="p">(:</span><span class="n">ls</span><span class="p">)</span><span class="o">//</span><span class="nb">adjustl</span><span class="p">(</span><span class="n">aa</span><span class="p">(</span><span class="n">j</span><span class="p">))</span>
<a id="ln-472" name="ln-472" href="#ln-472"></a><span class="w"> </span><span class="k">end do</span>
<a id="ln-473" name="ln-473" href="#ln-473"></a>
<a id="ln-474" name="ln-474" href="#ln-474"></a><span class="w"> </span><span class="c">!> Numeric types</span>
<a id="ln-475" name="ln-475" href="#ln-475"></a><span class="cp">#:for k1, t1 in KINDS_TYPES</span>
<a id="ln-476" name="ln-476" href="#ln-476"></a><span class="w"> </span><span class="k">type is</span><span class="w"> </span><span class="p">(</span><span class="err">${</span><span class="n">t1</span><span class="err">}$</span><span class="p">)</span>
<a id="ln-477" name="ln-477" href="#ln-477"></a><span class="w"> </span><span class="err">#</span><span class="p">:</span><span class="k">if</span><span class="w"> </span><span class="s1">'complex'</span><span class="w"> </span><span class="n">in</span><span class="w"> </span><span class="n">t1</span>
<a id="ln-478" name="ln-478" href="#ln-478"></a><span class="w"> </span><span class="k">write</span><span class="w"> </span><span class="p">(</span><span class="n">buffer</span><span class="p">,</span><span class="n">FMT_REAL_$</span><span class="err">{</span><span class="n">k1</span><span class="err">}$</span><span class="p">)</span><span class="w"> </span><span class="n">aa</span><span class="p">(</span><span class="mi">1</span><span class="p">)%</span><span class="n">re</span>
<a id="ln-479" name="ln-479" href="#ln-479"></a><span class="w"> </span><span class="k">write</span><span class="w"> </span><span class="p">(</span><span class="n">buffer2</span><span class="p">,</span><span class="n">FMT_REAL_$</span><span class="err">{</span><span class="n">k1</span><span class="err">}$</span><span class="p">)</span><span class="w"> </span><span class="n">aa</span><span class="p">(</span><span class="mi">1</span><span class="p">)%</span><span class="n">im</span>
<a id="ln-480" name="ln-480" href="#ln-480"></a><span class="w"> </span><span class="n">msg</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">trim</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span><span class="o">//</span><span class="s1">'('</span><span class="o">//</span><span class="nb">trim</span><span class="p">(</span><span class="nb">adjustl</span><span class="p">(</span><span class="n">buffer</span><span class="p">))</span><span class="o">//</span><span class="s1">','</span><span class="o">//</span><span class="nb">trim</span><span class="p">(</span><span class="nb">adjustl</span><span class="p">(</span><span class="n">buffer2</span><span class="p">))</span><span class="o">//</span><span class="s1">')'</span>
<a id="ln-481" name="ln-481" href="#ln-481"></a><span class="w"> </span><span class="k">do </span><span class="n">j</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">2</span><span class="p">,</span><span class="n">size</span><span class="p">(</span><span class="n">a</span><span class="p">)</span>
<a id="ln-482" name="ln-482" href="#ln-482"></a><span class="w"> </span><span class="k">write</span><span class="w"> </span><span class="p">(</span><span class="n">buffer</span><span class="p">,</span><span class="n">FMT_REAL_$</span><span class="err">{</span><span class="n">k1</span><span class="err">}$</span><span class="p">)</span><span class="w"> </span><span class="n">aa</span><span class="p">(</span><span class="n">j</span><span class="p">)%</span><span class="n">re</span>
<a id="ln-483" name="ln-483" href="#ln-483"></a><span class="w"> </span><span class="k">write</span><span class="w"> </span><span class="p">(</span><span class="n">buffer2</span><span class="p">,</span><span class="n">FMT_REAL_$</span><span class="err">{</span><span class="n">k1</span><span class="err">}$</span><span class="p">)</span><span class="w"> </span><span class="n">aa</span><span class="p">(</span><span class="n">j</span><span class="p">)%</span><span class="n">im</span>
<a id="ln-484" name="ln-484" href="#ln-484"></a><span class="w"> </span><span class="n">msg</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">trim</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span><span class="o">//</span><span class="n">sep</span><span class="p">(:</span><span class="n">ls</span><span class="p">)</span><span class="o">//</span><span class="s1">'('</span><span class="o">//</span><span class="nb">trim</span><span class="p">(</span><span class="nb">adjustl</span><span class="p">(</span><span class="n">buffer</span><span class="p">))</span><span class="o">//</span><span class="s1">','</span><span class="o">//</span><span class="nb">trim</span><span class="p">(</span><span class="nb">adjustl</span><span class="p">(</span><span class="n">buffer2</span><span class="p">))</span><span class="o">//</span><span class="s1">')'</span>
<a id="ln-485" name="ln-485" href="#ln-485"></a><span class="w"> </span><span class="k">end do</span>
<a id="ln-486" name="ln-486" href="#ln-486"></a><span class="w"> </span><span class="err">#</span><span class="p">:</span><span class="k">else</span>
<a id="ln-487" name="ln-487" href="#ln-487"></a><span class="w"> </span><span class="err">#</span><span class="p">:</span><span class="k">if</span><span class="w"> </span><span class="s1">'real'</span><span class="w"> </span><span class="n">in</span><span class="w"> </span><span class="n">t1</span>
<a id="ln-488" name="ln-488" href="#ln-488"></a><span class="w"> </span><span class="n">buffer_format</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">FMT_REAL_$</span><span class="err">{</span><span class="n">k1</span><span class="err">}$</span>
<a id="ln-489" name="ln-489" href="#ln-489"></a><span class="w"> </span><span class="err">#</span><span class="p">:</span><span class="k">else</span>
<a id="ln-490" name="ln-490" href="#ln-490"></a><span class="k"> </span><span class="n">buffer_format</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">FMT_INT</span>
<a id="ln-491" name="ln-491" href="#ln-491"></a><span class="w"> </span><span class="err">#</span><span class="p">:</span><span class="k">endif</span>
<a id="ln-492" name="ln-492" href="#ln-492"></a>
<a id="ln-493" name="ln-493" href="#ln-493"></a><span class="k"> write</span><span class="w"> </span><span class="p">(</span><span class="n">buffer</span><span class="p">,</span><span class="n">buffer_format</span><span class="p">)</span><span class="w"> </span><span class="n">aa</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
<a id="ln-494" name="ln-494" href="#ln-494"></a><span class="w"> </span><span class="n">msg</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">trim</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span><span class="o">//</span><span class="nb">adjustl</span><span class="p">(</span><span class="n">buffer</span><span class="p">)</span>
<a id="ln-495" name="ln-495" href="#ln-495"></a><span class="w"> </span><span class="k">do </span><span class="n">j</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">2</span><span class="p">,</span><span class="n">size</span><span class="p">(</span><span class="n">a</span><span class="p">)</span>
<a id="ln-496" name="ln-496" href="#ln-496"></a><span class="w"> </span><span class="k">write</span><span class="w"> </span><span class="p">(</span><span class="n">buffer</span><span class="p">,</span><span class="n">buffer_format</span><span class="p">)</span><span class="w"> </span><span class="n">aa</span><span class="p">(</span><span class="n">j</span><span class="p">)</span>
<a id="ln-497" name="ln-497" href="#ln-497"></a><span class="w"> </span><span class="n">msg</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">trim</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span><span class="o">//</span><span class="n">sep</span><span class="p">(:</span><span class="n">ls</span><span class="p">)</span><span class="o">//</span><span class="nb">adjustl</span><span class="p">(</span><span class="n">buffer</span><span class="p">)</span>
<a id="ln-498" name="ln-498" href="#ln-498"></a><span class="w"> </span><span class="k">end do</span>
<a id="ln-499" name="ln-499" href="#ln-499"></a><span class="k"> </span><span class="n">msg</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">trim</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span><span class="o">//</span><span class="n">sep</span><span class="p">(:</span><span class="n">ls</span><span class="p">)</span><span class="o">//</span><span class="nb">trim</span><span class="p">(</span><span class="nb">adjustl</span><span class="p">(</span><span class="n">buffer</span><span class="p">))</span>
<a id="ln-500" name="ln-500" href="#ln-500"></a><span class="w"> </span><span class="err">#</span><span class="p">:</span><span class="k">endif</span>
<a id="ln-501" name="ln-501" href="#ln-501"></a><span class="cp">#:endfor</span>
<a id="ln-502" name="ln-502" href="#ln-502"></a><span class="w"> </span><span class="k">class </span><span class="n">default</span>
<a id="ln-503" name="ln-503" href="#ln-503"></a><span class="w"> </span><span class="n">msg</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">trim</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span><span class="o">//</span><span class="s1">' <ERROR: INVALID TYPE>'</span>
<a id="ln-504" name="ln-504" href="#ln-504"></a>
<a id="ln-505" name="ln-505" href="#ln-505"></a><span class="w"> </span><span class="k">end select</span>
<a id="ln-506" name="ln-506" href="#ln-506"></a>
<a id="ln-507" name="ln-507" href="#ln-507"></a><span class="w"> </span><span class="c">! Close bracket</span>
<a id="ln-508" name="ln-508" href="#ln-508"></a><span class="w"> </span><span class="n">msg</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">trim</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span><span class="o">//</span><span class="s1">']'</span>
<a id="ln-509" name="ln-509" href="#ln-509"></a>
<a id="ln-510" name="ln-510" href="#ln-510"></a><span class="w"> </span><span class="k">end subroutine </span><span class="n">appendv</span>
<a id="ln-511" name="ln-511" href="#ln-511"></a>
<a id="ln-512" name="ln-512" href="#ln-512"></a><span class="w"> </span><span class="c">!> Error creation message, with location location</span>
<a id="ln-513" name="ln-513" href="#ln-513"></a><span class="w"> </span><span class="k">pure type</span><span class="p">(</span><span class="n">state_type</span><span class="p">)</span><span class="w"> </span><span class="k">function </span><span class="n">new_state</span><span class="p">(</span><span class="n">where_at</span><span class="p">,</span><span class="n">flag</span><span class="p">,</span><span class="n">a1</span><span class="p">,</span><span class="n">a2</span><span class="p">,</span><span class="n">a3</span><span class="p">,</span><span class="n">a4</span><span class="p">,</span><span class="n">a5</span><span class="p">,</span><span class="n">a6</span><span class="p">,</span><span class="n">a7</span><span class="p">,</span><span class="n">a8</span><span class="p">,</span><span class="n">a9</span><span class="p">,</span><span class="n">a10</span><span class="p">,</span><span class="w"> </span><span class="p">&</span>
<a id="ln-514" name="ln-514" href="#ln-514"></a><span class="w"> </span><span class="n">a11</span><span class="p">,</span><span class="n">a12</span><span class="p">,</span><span class="n">a13</span><span class="p">,</span><span class="n">a14</span><span class="p">,</span><span class="n">a15</span><span class="p">,</span><span class="n">a16</span><span class="p">,</span><span class="n">a17</span><span class="p">,</span><span class="n">a18</span><span class="p">,</span><span class="n">a19</span><span class="p">,</span><span class="n">a20</span><span class="p">)</span><span class="w"> </span>
<a id="ln-515" name="ln-515" href="#ln-515"></a>
<a id="ln-516" name="ln-516" href="#ln-516"></a><span class="w"> </span><span class="c">!> Location</span>
<a id="ln-517" name="ln-517" href="#ln-517"></a><span class="w"> </span><span class="kt">character</span><span class="p">(</span><span class="nb">len</span><span class="o">=*</span><span class="p">),</span><span class="k">intent</span><span class="p">(</span><span class="n">in</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">where_at</span>
<a id="ln-518" name="ln-518" href="#ln-518"></a>
<a id="ln-519" name="ln-519" href="#ln-519"></a><span class="w"> </span><span class="c">!> Input error flag</span>
<a id="ln-520" name="ln-520" href="#ln-520"></a><span class="w"> </span><span class="kt">integer</span><span class="p">,</span><span class="k">intent</span><span class="p">(</span><span class="n">in</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">flag</span>
<a id="ln-521" name="ln-521" href="#ln-521"></a>
<a id="ln-522" name="ln-522" href="#ln-522"></a><span class="w"> </span><span class="c">!> Optional rank-agnostic arguments</span>
<a id="ln-523" name="ln-523" href="#ln-523"></a><span class="w"> </span><span class="k">class</span><span class="p">(</span><span class="o">*</span><span class="p">),</span><span class="k">optional</span><span class="p">,</span><span class="k">intent</span><span class="p">(</span><span class="n">in</span><span class="p">),</span><span class="k">dimension</span><span class="p">(..)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">a1</span><span class="p">,</span><span class="n">a2</span><span class="p">,</span><span class="n">a3</span><span class="p">,</span><span class="n">a4</span><span class="p">,</span><span class="n">a5</span><span class="p">,</span><span class="n">a6</span><span class="p">,</span><span class="n">a7</span><span class="p">,</span><span class="n">a8</span><span class="p">,</span><span class="n">a9</span><span class="p">,</span><span class="n">a10</span><span class="p">,</span><span class="w"> </span><span class="p">&</span>
<a id="ln-524" name="ln-524" href="#ln-524"></a><span class="w"> </span><span class="n">a11</span><span class="p">,</span><span class="n">a12</span><span class="p">,</span><span class="n">a13</span><span class="p">,</span><span class="n">a14</span><span class="p">,</span><span class="n">a15</span><span class="p">,</span><span class="n">a16</span><span class="p">,</span><span class="n">a17</span><span class="p">,</span><span class="n">a18</span><span class="p">,</span><span class="n">a19</span><span class="p">,</span><span class="n">a20</span><span class="w"> </span>
<a id="ln-525" name="ln-525" href="#ln-525"></a>
<a id="ln-526" name="ln-526" href="#ln-526"></a><span class="w"> </span><span class="c">! Init object</span>
<a id="ln-527" name="ln-527" href="#ln-527"></a><span class="w"> </span><span class="k">call </span><span class="n">new_state</span><span class="p">%</span><span class="n">parse</span><span class="p">(</span><span class="n">where_at</span><span class="p">,</span><span class="n">flag</span><span class="p">,</span><span class="n">a1</span><span class="p">,</span><span class="n">a2</span><span class="p">,</span><span class="n">a3</span><span class="p">,</span><span class="n">a4</span><span class="p">,</span><span class="n">a5</span><span class="p">,</span><span class="n">a6</span><span class="p">,</span><span class="n">a7</span><span class="p">,</span><span class="n">a8</span><span class="p">,</span><span class="n">a9</span><span class="p">,</span><span class="n">a10</span><span class="p">,</span><span class="w"> </span><span class="p">&</span>
<a id="ln-528" name="ln-528" href="#ln-528"></a><span class="w"> </span><span class="n">a11</span><span class="p">,</span><span class="n">a12</span><span class="p">,</span><span class="n">a13</span><span class="p">,</span><span class="n">a14</span><span class="p">,</span><span class="n">a15</span><span class="p">,</span><span class="n">a16</span><span class="p">,</span><span class="n">a17</span><span class="p">,</span><span class="n">a18</span><span class="p">,</span><span class="n">a19</span><span class="p">,</span><span class="n">a20</span><span class="p">)</span>
<a id="ln-529" name="ln-529" href="#ln-529"></a>
<a id="ln-530" name="ln-530" href="#ln-530"></a><span class="w"> </span><span class="k">end function </span><span class="n">new_state</span>
<a id="ln-531" name="ln-531" href="#ln-531"></a>
<a id="ln-532" name="ln-532" href="#ln-532"></a><span class="w"> </span><span class="c">!> Error creation message, from N input variables (numeric or strings)</span>
<a id="ln-533" name="ln-533" href="#ln-533"></a><span class="w"> </span><span class="k">pure type</span><span class="p">(</span><span class="n">state_type</span><span class="p">)</span><span class="w"> </span><span class="k">function </span><span class="n">new_state_nowhere</span><span class="p">(</span><span class="n">flag</span><span class="p">,</span><span class="n">a1</span><span class="p">,</span><span class="n">a2</span><span class="p">,</span><span class="n">a3</span><span class="p">,</span><span class="n">a4</span><span class="p">,</span><span class="n">a5</span><span class="p">,</span><span class="n">a6</span><span class="p">,</span><span class="n">a7</span><span class="p">,</span><span class="n">a8</span><span class="p">,</span><span class="n">a9</span><span class="p">,</span><span class="n">a10</span><span class="p">,</span><span class="w"> </span><span class="p">&</span>
<a id="ln-534" name="ln-534" href="#ln-534"></a><span class="w"> </span><span class="n">a11</span><span class="p">,</span><span class="n">a12</span><span class="p">,</span><span class="n">a13</span><span class="p">,</span><span class="n">a14</span><span class="p">,</span><span class="n">a15</span><span class="p">,</span><span class="n">a16</span><span class="p">,</span><span class="n">a17</span><span class="p">,</span><span class="n">a18</span><span class="p">,</span><span class="n">a19</span><span class="p">,</span><span class="n">a20</span><span class="p">)</span><span class="w"> </span><span class="p">&</span>
<a id="ln-535" name="ln-535" href="#ln-535"></a><span class="w"> </span><span class="k">result</span><span class="p">(</span><span class="n">new_state</span><span class="p">)</span>
<a id="ln-536" name="ln-536" href="#ln-536"></a>
<a id="ln-537" name="ln-537" href="#ln-537"></a><span class="w"> </span><span class="c">!> Input error flag</span>
<a id="ln-538" name="ln-538" href="#ln-538"></a><span class="w"> </span><span class="kt">integer</span><span class="p">,</span><span class="k">intent</span><span class="p">(</span><span class="n">in</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">flag</span>
<a id="ln-539" name="ln-539" href="#ln-539"></a>
<a id="ln-540" name="ln-540" href="#ln-540"></a><span class="w"> </span><span class="c">!> Optional rank-agnostic arguments</span>
<a id="ln-541" name="ln-541" href="#ln-541"></a><span class="w"> </span><span class="k">class</span><span class="p">(</span><span class="o">*</span><span class="p">),</span><span class="k">optional</span><span class="p">,</span><span class="k">intent</span><span class="p">(</span><span class="n">in</span><span class="p">),</span><span class="k">dimension</span><span class="p">(..)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">a1</span><span class="p">,</span><span class="n">a2</span><span class="p">,</span><span class="n">a3</span><span class="p">,</span><span class="n">a4</span><span class="p">,</span><span class="n">a5</span><span class="p">,</span><span class="n">a6</span><span class="p">,</span><span class="n">a7</span><span class="p">,</span><span class="n">a8</span><span class="p">,</span><span class="n">a9</span><span class="p">,</span><span class="n">a10</span><span class="p">,</span><span class="w"> </span><span class="p">&</span>
<a id="ln-542" name="ln-542" href="#ln-542"></a><span class="w"> </span><span class="n">a11</span><span class="p">,</span><span class="n">a12</span><span class="p">,</span><span class="n">a13</span><span class="p">,</span><span class="n">a14</span><span class="p">,</span><span class="n">a15</span><span class="p">,</span><span class="n">a16</span><span class="p">,</span><span class="n">a17</span><span class="p">,</span><span class="n">a18</span><span class="p">,</span><span class="n">a19</span><span class="p">,</span><span class="n">a20</span><span class="w"> </span>
<a id="ln-543" name="ln-543" href="#ln-543"></a>
<a id="ln-544" name="ln-544" href="#ln-544"></a><span class="w"> </span><span class="c">! Init object</span>
<a id="ln-545" name="ln-545" href="#ln-545"></a><span class="w"> </span><span class="k">call </span><span class="n">new_state</span><span class="p">%</span><span class="n">parse</span><span class="p">(</span><span class="n">flag</span><span class="p">,</span><span class="n">a1</span><span class="p">,</span><span class="n">a2</span><span class="p">,</span><span class="n">a3</span><span class="p">,</span><span class="n">a4</span><span class="p">,</span><span class="n">a5</span><span class="p">,</span><span class="n">a6</span><span class="p">,</span><span class="n">a7</span><span class="p">,</span><span class="n">a8</span><span class="p">,</span><span class="n">a9</span><span class="p">,</span><span class="n">a10</span><span class="p">,</span><span class="w"> </span><span class="p">&</span>
<a id="ln-546" name="ln-546" href="#ln-546"></a><span class="w"> </span><span class="n">a11</span><span class="p">,</span><span class="n">a12</span><span class="p">,</span><span class="n">a13</span><span class="p">,</span><span class="n">a14</span><span class="p">,</span><span class="n">a15</span><span class="p">,</span><span class="n">a16</span><span class="p">,</span><span class="n">a17</span><span class="p">,</span><span class="n">a18</span><span class="p">,</span><span class="n">a19</span><span class="p">,</span><span class="n">a20</span><span class="p">)</span>
<a id="ln-547" name="ln-547" href="#ln-547"></a>
<a id="ln-548" name="ln-548" href="#ln-548"></a><span class="w"> </span><span class="k">end function </span><span class="n">new_state_nowhere</span>
<a id="ln-549" name="ln-549" href="#ln-549"></a><span class="w"> </span>
<a id="ln-550" name="ln-550" href="#ln-550"></a><span class="w"> </span><span class="c">!> Parse a generic list of arguments provided to the error constructor</span>
<a id="ln-551" name="ln-551" href="#ln-551"></a><span class="w"> </span><span class="k">pure subroutine </span><span class="n">state_parse_at_location</span><span class="p">(</span><span class="n">new_state</span><span class="p">,</span><span class="n">where_at</span><span class="p">,</span><span class="n">flag</span><span class="p">,</span><span class="n">a1</span><span class="p">,</span><span class="n">a2</span><span class="p">,</span><span class="n">a3</span><span class="p">,</span><span class="n">a4</span><span class="p">,</span><span class="n">a5</span><span class="p">,</span><span class="n">a6</span><span class="p">,</span><span class="n">a7</span><span class="p">,</span><span class="n">a8</span><span class="p">,</span><span class="n">a9</span><span class="p">,</span><span class="n">a10</span><span class="p">,</span><span class="w"> </span><span class="p">&</span>
<a id="ln-552" name="ln-552" href="#ln-552"></a><span class="w"> </span><span class="n">a11</span><span class="p">,</span><span class="n">a12</span><span class="p">,</span><span class="n">a13</span><span class="p">,</span><span class="n">a14</span><span class="p">,</span><span class="n">a15</span><span class="p">,</span><span class="n">a16</span><span class="p">,</span><span class="n">a17</span><span class="p">,</span><span class="n">a18</span><span class="p">,</span><span class="n">a19</span><span class="p">,</span><span class="n">a20</span><span class="p">)</span>
<a id="ln-553" name="ln-553" href="#ln-553"></a><span class="w"> </span>
<a id="ln-554" name="ln-554" href="#ln-554"></a><span class="w"> </span><span class="c">!> The current state variable </span>
<a id="ln-555" name="ln-555" href="#ln-555"></a><span class="w"> </span><span class="k">class</span><span class="p">(</span><span class="n">state_type</span><span class="p">),</span><span class="w"> </span><span class="k">intent</span><span class="p">(</span><span class="n">inout</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">new_state</span><span class="w"> </span>
<a id="ln-556" name="ln-556" href="#ln-556"></a>
<a id="ln-557" name="ln-557" href="#ln-557"></a><span class="w"> </span><span class="c">!> Error Location</span>
<a id="ln-558" name="ln-558" href="#ln-558"></a><span class="w"> </span><span class="kt">character</span><span class="p">(</span><span class="nb">len</span><span class="o">=*</span><span class="p">),</span><span class="k">intent</span><span class="p">(</span><span class="n">in</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">where_at</span>
<a id="ln-559" name="ln-559" href="#ln-559"></a>
<a id="ln-560" name="ln-560" href="#ln-560"></a><span class="w"> </span><span class="c">!> Input error flag</span>
<a id="ln-561" name="ln-561" href="#ln-561"></a><span class="w"> </span><span class="kt">integer</span><span class="p">,</span><span class="k">intent</span><span class="p">(</span><span class="n">in</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">flag</span>
<a id="ln-562" name="ln-562" href="#ln-562"></a>
<a id="ln-563" name="ln-563" href="#ln-563"></a><span class="w"> </span><span class="c">!> Optional rank-agnostic arguments</span>
<a id="ln-564" name="ln-564" href="#ln-564"></a><span class="w"> </span><span class="k">class</span><span class="p">(</span><span class="o">*</span><span class="p">),</span><span class="k">optional</span><span class="p">,</span><span class="k">intent</span><span class="p">(</span><span class="n">in</span><span class="p">),</span><span class="k">dimension</span><span class="p">(..)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">a1</span><span class="p">,</span><span class="n">a2</span><span class="p">,</span><span class="n">a3</span><span class="p">,</span><span class="n">a4</span><span class="p">,</span><span class="n">a5</span><span class="p">,</span><span class="n">a6</span><span class="p">,</span><span class="n">a7</span><span class="p">,</span><span class="n">a8</span><span class="p">,</span><span class="n">a9</span><span class="p">,</span><span class="n">a10</span><span class="p">,</span><span class="w"> </span><span class="p">&</span>
<a id="ln-565" name="ln-565" href="#ln-565"></a><span class="w"> </span><span class="n">a11</span><span class="p">,</span><span class="n">a12</span><span class="p">,</span><span class="n">a13</span><span class="p">,</span><span class="n">a14</span><span class="p">,</span><span class="n">a15</span><span class="p">,</span><span class="n">a16</span><span class="p">,</span><span class="n">a17</span><span class="p">,</span><span class="n">a18</span><span class="p">,</span><span class="n">a19</span><span class="p">,</span><span class="n">a20</span><span class="w"> </span>
<a id="ln-566" name="ln-566" href="#ln-566"></a><span class="w"> </span>
<a id="ln-567" name="ln-567" href="#ln-567"></a><span class="w"> </span><span class="c">! Init object</span>
<a id="ln-568" name="ln-568" href="#ln-568"></a><span class="w"> </span><span class="k">call </span><span class="n">new_state</span><span class="p">%</span><span class="n">destroy</span><span class="p">()</span>
<a id="ln-569" name="ln-569" href="#ln-569"></a>
<a id="ln-570" name="ln-570" href="#ln-570"></a><span class="w"> </span><span class="c">!> Set error flag</span>
<a id="ln-571" name="ln-571" href="#ln-571"></a><span class="w"> </span><span class="n">new_state</span><span class="p">%</span><span class="n">state</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">flag</span>
<a id="ln-572" name="ln-572" href="#ln-572"></a>
<a id="ln-573" name="ln-573" href="#ln-573"></a><span class="w"> </span><span class="c">!> Set chain</span>
<a id="ln-574" name="ln-574" href="#ln-574"></a><span class="w"> </span><span class="n">new_state</span><span class="p">%</span><span class="n">message</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s2">""</span>
<a id="ln-575" name="ln-575" href="#ln-575"></a><span class="w"> </span><span class="k">call </span><span class="n">appendr</span><span class="p">(</span><span class="n">new_state</span><span class="p">%</span><span class="n">message</span><span class="p">,</span><span class="n">a1</span><span class="p">)</span>
<a id="ln-576" name="ln-576" href="#ln-576"></a><span class="w"> </span><span class="k">call </span><span class="n">appendr</span><span class="p">(</span><span class="n">new_state</span><span class="p">%</span><span class="n">message</span><span class="p">,</span><span class="n">a2</span><span class="p">)</span>
<a id="ln-577" name="ln-577" href="#ln-577"></a><span class="w"> </span><span class="k">call </span><span class="n">appendr</span><span class="p">(</span><span class="n">new_state</span><span class="p">%</span><span class="n">message</span><span class="p">,</span><span class="n">a3</span><span class="p">)</span>
<a id="ln-578" name="ln-578" href="#ln-578"></a><span class="w"> </span><span class="k">call </span><span class="n">appendr</span><span class="p">(</span><span class="n">new_state</span><span class="p">%</span><span class="n">message</span><span class="p">,</span><span class="n">a4</span><span class="p">)</span>
<a id="ln-579" name="ln-579" href="#ln-579"></a><span class="w"> </span><span class="k">call </span><span class="n">appendr</span><span class="p">(</span><span class="n">new_state</span><span class="p">%</span><span class="n">message</span><span class="p">,</span><span class="n">a5</span><span class="p">)</span>
<a id="ln-580" name="ln-580" href="#ln-580"></a><span class="w"> </span><span class="k">call </span><span class="n">appendr</span><span class="p">(</span><span class="n">new_state</span><span class="p">%</span><span class="n">message</span><span class="p">,</span><span class="n">a6</span><span class="p">)</span>
<a id="ln-581" name="ln-581" href="#ln-581"></a><span class="w"> </span><span class="k">call </span><span class="n">appendr</span><span class="p">(</span><span class="n">new_state</span><span class="p">%</span><span class="n">message</span><span class="p">,</span><span class="n">a7</span><span class="p">)</span>
<a id="ln-582" name="ln-582" href="#ln-582"></a><span class="w"> </span><span class="k">call </span><span class="n">appendr</span><span class="p">(</span><span class="n">new_state</span><span class="p">%</span><span class="n">message</span><span class="p">,</span><span class="n">a8</span><span class="p">)</span>
<a id="ln-583" name="ln-583" href="#ln-583"></a><span class="w"> </span><span class="k">call </span><span class="n">appendr</span><span class="p">(</span><span class="n">new_state</span><span class="p">%</span><span class="n">message</span><span class="p">,</span><span class="n">a9</span><span class="p">)</span>
<a id="ln-584" name="ln-584" href="#ln-584"></a><span class="w"> </span><span class="k">call </span><span class="n">appendr</span><span class="p">(</span><span class="n">new_state</span><span class="p">%</span><span class="n">message</span><span class="p">,</span><span class="n">a10</span><span class="p">)</span>
<a id="ln-585" name="ln-585" href="#ln-585"></a><span class="w"> </span><span class="k">call </span><span class="n">appendr</span><span class="p">(</span><span class="n">new_state</span><span class="p">%</span><span class="n">message</span><span class="p">,</span><span class="n">a11</span><span class="p">)</span>
<a id="ln-586" name="ln-586" href="#ln-586"></a><span class="w"> </span><span class="k">call </span><span class="n">appendr</span><span class="p">(</span><span class="n">new_state</span><span class="p">%</span><span class="n">message</span><span class="p">,</span><span class="n">a12</span><span class="p">)</span>
<a id="ln-587" name="ln-587" href="#ln-587"></a><span class="w"> </span><span class="k">call </span><span class="n">appendr</span><span class="p">(</span><span class="n">new_state</span><span class="p">%</span><span class="n">message</span><span class="p">,</span><span class="n">a13</span><span class="p">)</span>
<a id="ln-588" name="ln-588" href="#ln-588"></a><span class="w"> </span><span class="k">call </span><span class="n">appendr</span><span class="p">(</span><span class="n">new_state</span><span class="p">%</span><span class="n">message</span><span class="p">,</span><span class="n">a14</span><span class="p">)</span>
<a id="ln-589" name="ln-589" href="#ln-589"></a><span class="w"> </span><span class="k">call </span><span class="n">appendr</span><span class="p">(</span><span class="n">new_state</span><span class="p">%</span><span class="n">message</span><span class="p">,</span><span class="n">a15</span><span class="p">)</span>
<a id="ln-590" name="ln-590" href="#ln-590"></a><span class="w"> </span><span class="k">call </span><span class="n">appendr</span><span class="p">(</span><span class="n">new_state</span><span class="p">%</span><span class="n">message</span><span class="p">,</span><span class="n">a16</span><span class="p">)</span>
<a id="ln-591" name="ln-591" href="#ln-591"></a><span class="w"> </span><span class="k">call </span><span class="n">appendr</span><span class="p">(</span><span class="n">new_state</span><span class="p">%</span><span class="n">message</span><span class="p">,</span><span class="n">a17</span><span class="p">)</span>
<a id="ln-592" name="ln-592" href="#ln-592"></a><span class="w"> </span><span class="k">call </span><span class="n">appendr</span><span class="p">(</span><span class="n">new_state</span><span class="p">%</span><span class="n">message</span><span class="p">,</span><span class="n">a18</span><span class="p">)</span>
<a id="ln-593" name="ln-593" href="#ln-593"></a><span class="w"> </span><span class="k">call </span><span class="n">appendr</span><span class="p">(</span><span class="n">new_state</span><span class="p">%</span><span class="n">message</span><span class="p">,</span><span class="n">a19</span><span class="p">)</span>
<a id="ln-594" name="ln-594" href="#ln-594"></a><span class="w"> </span><span class="k">call </span><span class="n">appendr</span><span class="p">(</span><span class="n">new_state</span><span class="p">%</span><span class="n">message</span><span class="p">,</span><span class="n">a20</span><span class="p">)</span><span class="w"> </span>
<a id="ln-595" name="ln-595" href="#ln-595"></a><span class="w"> </span>
<a id="ln-596" name="ln-596" href="#ln-596"></a><span class="w"> </span><span class="c">!> Add location</span>
<a id="ln-597" name="ln-597" href="#ln-597"></a><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="nb">len_trim</span><span class="p">(</span><span class="n">where_at</span><span class="p">)</span><span class="w"> </span><span class="o">></span><span class="w"> </span><span class="mi">0</span><span class="p">)</span><span class="w"> </span><span class="n">new_state</span><span class="p">%</span><span class="n">where_at</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">adjustl</span><span class="p">(</span><span class="n">where_at</span><span class="p">)</span><span class="w"> </span>
<a id="ln-598" name="ln-598" href="#ln-598"></a><span class="w"> </span>
<a id="ln-599" name="ln-599" href="#ln-599"></a><span class="w"> </span><span class="k">end subroutine </span><span class="n">state_parse_at_location</span>
<a id="ln-600" name="ln-600" href="#ln-600"></a><span class="w"> </span>
<a id="ln-601" name="ln-601" href="#ln-601"></a><span class="w"> </span><span class="c">!> Parse a generic list of arguments provided to the error constructor</span>
<a id="ln-602" name="ln-602" href="#ln-602"></a><span class="w"> </span><span class="k">pure subroutine </span><span class="n">state_parse_arguments</span><span class="p">(</span><span class="n">new_state</span><span class="p">,</span><span class="n">flag</span><span class="p">,</span><span class="n">a1</span><span class="p">,</span><span class="n">a2</span><span class="p">,</span><span class="n">a3</span><span class="p">,</span><span class="n">a4</span><span class="p">,</span><span class="n">a5</span><span class="p">,</span><span class="n">a6</span><span class="p">,</span><span class="n">a7</span><span class="p">,</span><span class="n">a8</span><span class="p">,</span><span class="n">a9</span><span class="p">,</span><span class="n">a10</span><span class="p">,</span><span class="w"> </span><span class="p">&</span>
<a id="ln-603" name="ln-603" href="#ln-603"></a><span class="w"> </span><span class="n">a11</span><span class="p">,</span><span class="n">a12</span><span class="p">,</span><span class="n">a13</span><span class="p">,</span><span class="n">a14</span><span class="p">,</span><span class="n">a15</span><span class="p">,</span><span class="n">a16</span><span class="p">,</span><span class="n">a17</span><span class="p">,</span><span class="n">a18</span><span class="p">,</span><span class="n">a19</span><span class="p">,</span><span class="n">a20</span><span class="p">)</span>
<a id="ln-604" name="ln-604" href="#ln-604"></a><span class="w"> </span>
<a id="ln-605" name="ln-605" href="#ln-605"></a><span class="w"> </span><span class="c">!> The current state variable </span>
<a id="ln-606" name="ln-606" href="#ln-606"></a><span class="w"> </span><span class="k">class</span><span class="p">(</span><span class="n">state_type</span><span class="p">),</span><span class="w"> </span><span class="k">intent</span><span class="p">(</span><span class="n">inout</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">new_state</span><span class="w"> </span>
<a id="ln-607" name="ln-607" href="#ln-607"></a>
<a id="ln-608" name="ln-608" href="#ln-608"></a><span class="w"> </span><span class="c">!> Input error flag</span>
<a id="ln-609" name="ln-609" href="#ln-609"></a><span class="w"> </span><span class="kt">integer</span><span class="p">,</span><span class="k">intent</span><span class="p">(</span><span class="n">in</span><span class="p">)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">flag</span>
<a id="ln-610" name="ln-610" href="#ln-610"></a>
<a id="ln-611" name="ln-611" href="#ln-611"></a><span class="w"> </span><span class="c">!> Optional rank-agnostic arguments</span>
<a id="ln-612" name="ln-612" href="#ln-612"></a><span class="w"> </span><span class="k">class</span><span class="p">(</span><span class="o">*</span><span class="p">),</span><span class="k">optional</span><span class="p">,</span><span class="k">intent</span><span class="p">(</span><span class="n">in</span><span class="p">),</span><span class="k">dimension</span><span class="p">(..)</span><span class="w"> </span><span class="kd">::</span><span class="w"> </span><span class="n">a1</span><span class="p">,</span><span class="n">a2</span><span class="p">,</span><span class="n">a3</span><span class="p">,</span><span class="n">a4</span><span class="p">,</span><span class="n">a5</span><span class="p">,</span><span class="n">a6</span><span class="p">,</span><span class="n">a7</span><span class="p">,</span><span class="n">a8</span><span class="p">,</span><span class="n">a9</span><span class="p">,</span><span class="n">a10</span><span class="p">,</span><span class="w"> </span><span class="p">&</span>
<a id="ln-613" name="ln-613" href="#ln-613"></a><span class="w"> </span><span class="n">a11</span><span class="p">,</span><span class="n">a12</span><span class="p">,</span><span class="n">a13</span><span class="p">,</span><span class="n">a14</span><span class="p">,</span><span class="n">a15</span><span class="p">,</span><span class="n">a16</span><span class="p">,</span><span class="n">a17</span><span class="p">,</span><span class="n">a18</span><span class="p">,</span><span class="n">a19</span><span class="p">,</span><span class="n">a20</span><span class="w"> </span>
<a id="ln-614" name="ln-614" href="#ln-614"></a><span class="w"> </span>
<a id="ln-615" name="ln-615" href="#ln-615"></a><span class="w"> </span><span class="c">! Init object</span>
<a id="ln-616" name="ln-616" href="#ln-616"></a><span class="w"> </span><span class="k">call </span><span class="n">new_state</span><span class="p">%</span><span class="n">destroy</span><span class="p">()</span>
<a id="ln-617" name="ln-617" href="#ln-617"></a>
<a id="ln-618" name="ln-618" href="#ln-618"></a><span class="w"> </span><span class="c">!> Set error flag</span>
<a id="ln-619" name="ln-619" href="#ln-619"></a><span class="w"> </span><span class="n">new_state</span><span class="p">%</span><span class="n">state</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">flag</span>
<a id="ln-620" name="ln-620" href="#ln-620"></a>
<a id="ln-621" name="ln-621" href="#ln-621"></a><span class="w"> </span><span class="c">!> Set chain</span>
<a id="ln-622" name="ln-622" href="#ln-622"></a><span class="w"> </span><span class="n">new_state</span><span class="p">%</span><span class="n">message</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s2">""</span>
<a id="ln-623" name="ln-623" href="#ln-623"></a><span class="w"> </span><span class="k">call </span><span class="n">appendr</span><span class="p">(</span><span class="n">new_state</span><span class="p">%</span><span class="n">message</span><span class="p">,</span><span class="n">a1</span><span class="p">)</span>
<a id="ln-624" name="ln-624" href="#ln-624"></a><span class="w"> </span><span class="k">call </span><span class="n">appendr</span><span class="p">(</span><span class="n">new_state</span><span class="p">%</span><span class="n">message</span><span class="p">,</span><span class="n">a2</span><span class="p">)</span>
<a id="ln-625" name="ln-625" href="#ln-625"></a><span class="w"> </span><span class="k">call </span><span class="n">appendr</span><span class="p">(</span><span class="n">new_state</span><span class="p">%</span><span class="n">message</span><span class="p">,</span><span class="n">a3</span><span class="p">)</span>
<a id="ln-626" name="ln-626" href="#ln-626"></a><span class="w"> </span><span class="k">call </span><span class="n">appendr</span><span class="p">(</span><span class="n">new_state</span><span class="p">%</span><span class="n">message</span><span class="p">,</span><span class="n">a4</span><span class="p">)</span>
<a id="ln-627" name="ln-627" href="#ln-627"></a><span class="w"> </span><span class="k">call </span><span class="n">appendr</span><span class="p">(</span><span class="n">new_state</span><span class="p">%</span><span class="n">message</span><span class="p">,</span><span class="n">a5</span><span class="p">)</span>
<a id="ln-628" name="ln-628" href="#ln-628"></a><span class="w"> </span><span class="k">call </span><span class="n">appendr</span><span class="p">(</span><span class="n">new_state</span><span class="p">%</span><span class="n">message</span><span class="p">,</span><span class="n">a6</span><span class="p">)</span>
<a id="ln-629" name="ln-629" href="#ln-629"></a><span class="w"> </span><span class="k">call </span><span class="n">appendr</span><span class="p">(</span><span class="n">new_state</span><span class="p">%</span><span class="n">message</span><span class="p">,</span><span class="n">a7</span><span class="p">)</span>
<a id="ln-630" name="ln-630" href="#ln-630"></a><span class="w"> </span><span class="k">call </span><span class="n">appendr</span><span class="p">(</span><span class="n">new_state</span><span class="p">%</span><span class="n">message</span><span class="p">,</span><span class="n">a8</span><span class="p">)</span>
<a id="ln-631" name="ln-631" href="#ln-631"></a><span class="w"> </span><span class="k">call </span><span class="n">appendr</span><span class="p">(</span><span class="n">new_state</span><span class="p">%</span><span class="n">message</span><span class="p">,</span><span class="n">a9</span><span class="p">)</span>
<a id="ln-632" name="ln-632" href="#ln-632"></a><span class="w"> </span><span class="k">call </span><span class="n">appendr</span><span class="p">(</span><span class="n">new_state</span><span class="p">%</span><span class="n">message</span><span class="p">,</span><span class="n">a10</span><span class="p">)</span>
<a id="ln-633" name="ln-633" href="#ln-633"></a><span class="w"> </span><span class="k">call </span><span class="n">appendr</span><span class="p">(</span><span class="n">new_state</span><span class="p">%</span><span class="n">message</span><span class="p">,</span><span class="n">a11</span><span class="p">)</span>
<a id="ln-634" name="ln-634" href="#ln-634"></a><span class="w"> </span><span class="k">call </span><span class="n">appendr</span><span class="p">(</span><span class="n">new_state</span><span class="p">%</span><span class="n">message</span><span class="p">,</span><span class="n">a12</span><span class="p">)</span>
<a id="ln-635" name="ln-635" href="#ln-635"></a><span class="w"> </span><span class="k">call </span><span class="n">appendr</span><span class="p">(</span><span class="n">new_state</span><span class="p">%</span><span class="n">message</span><span class="p">,</span><span class="n">a13</span><span class="p">)</span>
<a id="ln-636" name="ln-636" href="#ln-636"></a><span class="w"> </span><span class="k">call </span><span class="n">appendr</span><span class="p">(</span><span class="n">new_state</span><span class="p">%</span><span class="n">message</span><span class="p">,</span><span class="n">a14</span><span class="p">)</span>
<a id="ln-637" name="ln-637" href="#ln-637"></a><span class="w"> </span><span class="k">call </span><span class="n">appendr</span><span class="p">(</span><span class="n">new_state</span><span class="p">%</span><span class="n">message</span><span class="p">,</span><span class="n">a15</span><span class="p">)</span>
<a id="ln-638" name="ln-638" href="#ln-638"></a><span class="w"> </span><span class="k">call </span><span class="n">appendr</span><span class="p">(</span><span class="n">new_state</span><span class="p">%</span><span class="n">message</span><span class="p">,</span><span class="n">a16</span><span class="p">)</span>
<a id="ln-639" name="ln-639" href="#ln-639"></a><span class="w"> </span><span class="k">call </span><span class="n">appendr</span><span class="p">(</span><span class="n">new_state</span><span class="p">%</span><span class="n">message</span><span class="p">,</span><span class="n">a17</span><span class="p">)</span>
<a id="ln-640" name="ln-640" href="#ln-640"></a><span class="w"> </span><span class="k">call </span><span class="n">appendr</span><span class="p">(</span><span class="n">new_state</span><span class="p">%</span><span class="n">message</span><span class="p">,</span><span class="n">a18</span><span class="p">)</span>
<a id="ln-641" name="ln-641" href="#ln-641"></a><span class="w"> </span><span class="k">call </span><span class="n">appendr</span><span class="p">(</span><span class="n">new_state</span><span class="p">%</span><span class="n">message</span><span class="p">,</span><span class="n">a19</span><span class="p">)</span>
<a id="ln-642" name="ln-642" href="#ln-642"></a><span class="w"> </span><span class="k">call </span><span class="n">appendr</span><span class="p">(</span><span class="n">new_state</span><span class="p">%</span><span class="n">message</span><span class="p">,</span><span class="n">a20</span><span class="p">)</span><span class="w"> </span>
<a id="ln-643" name="ln-643" href="#ln-643"></a><span class="w"> </span>
<a id="ln-644" name="ln-644" href="#ln-644"></a><span class="w"> </span><span class="k">end subroutine </span><span class="n">state_parse_arguments</span>
<a id="ln-645" name="ln-645" href="#ln-645"></a>
<a id="ln-646" name="ln-646" href="#ln-646"></a><span class="k">end module </span><span class="n">stdlib_error</span>
</pre></div>
</section>
</div>
</div>
<hr>
</div> <!-- /container -->
<footer>
<div class="container">
<div class="row justify-content-between">
<div class="col"><p>Fortran-lang/stdlib was developed by fortran-lang/stdlib contributors<br>© 2025 <a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-sa/4.0/80x15.png" /></a>
<br /><small>def840da</small></p>
</div>
<div class="col">
<p class="text-end">
Documentation generated by
<a href="https://github.com/Fortran-FOSS-Programmers/ford">FORD</a>
on 2025-04-03 06:18 </p>
</div>
</div>
<br>
</div> <!-- /container -->
</footer>
<!-- Bootstrap core JavaScript -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"
integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
<!-- MathJax JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
TeX: { extensions: ['AMSmath.js','AMSsymbols.js','noErrors.js','noUndefined.js'], equationNumbers: { autoNumber: 'AMS' } },
jax: ['input/TeX','input/MathML','output/HTML-CSS'],
extensions: ['tex2jax.js','mml2jax.js','MathMenu.js','MathZoom.js']
});
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script src="../tipuesearch/tipuesearch_content.js"></script>
<script src="../tipuesearch/tipuesearch_set.js"></script>
<script src="../tipuesearch/tipuesearch.js"></script>
</body>
</html>