OpenCMISS-Iron Internal API Documentation
iso_varying_string.f90
Go to the documentation of this file.
1 
3 
4 ! ******************************************************************************
5 ! * *
6 ! * iso_varying_string.f90 *
7 ! * *
8 ! * Copyright (c) 2003, Rich Townsend <rhdt@bartol.udel.edu> *
9 ! * All rights reserved. *
10 ! * *
11 ! * Redistribution and use in source and binary forms, with or without *
12 ! * modification, are permitted provided that the following conditions are *
13 ! * met: *
14 ! * *
15 ! * * Redistributions of source code must retain the above copyright notice, *
16 ! * this list of conditions and the following disclaimer. *
17 ! * * Redistributions in binary form must reproduce the above copyright *
18 ! * notice, this list of conditions and the following disclaimer in the *
19 ! * documentation and/or other materials provided with the distribution. *
20 ! * *
21 ! * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS *
22 ! * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, *
23 ! * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR *
24 ! * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR *
25 ! * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
26 ! * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
27 ! * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
28 ! * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
29 ! * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
30 ! * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
31 ! * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
32 ! * *
33 ! ******************************************************************************
34 !
35 ! Author : Rich Townsend <rhdt@bartol.udel.edu>
36 ! Synopsis : Definition of iso_varying_string module, conformant to the API
37 ! specified in ISO/IEC 1539-2:2000 (varying-length strings for
38 ! Fortran 95).
39 ! Version : 1.3-F
40 ! Thanks : Lawrie Schonfelder (bugfixes and design pointers), Walt Brainerd
41 ! (conversion to F).
42 
43 !JL 20/10/10 seems *very* strange that there is no deallocate statement in this entire file... given that varying string is
44 ! an allocatable character array. Adding one to prevent memory leak - has to be called manually like normal
45 ! deallocate statement
46 
47 !CPL 13/09/11
48 ! It's not accurate to think of allocatables as just a kind of pointer (in particular, allocate should not be thought
49 ! of as just a Fortran-style malloc). They are more like managed resources, and there is quite a bit of hidden
50 ! machinery involved when using them.
51 !
52 ! Note that the Fortran95 spec states the following:
53 ! Allocatable arrays (including type components) are automatically deallocated when they leave scope.
54 ! Assigning to an allocatable array will cause it to be automatically deallocated, then reallocated with the right size.
55 !
56 ! In the context of varying_string, this means that all copies are deep copies, and temporaries (such as those generated
57 ! by compound concatenations and function calls) are cleaned up automatically at runtime.
58 
59 
63  USE iso_c_binding
64 
65 ! No implicit typing
66 
67  implicit none
68 
69 ! Parameter definitions
70 
71  integer, parameter, private :: get_buffer_len = 256
72 
73 ! Type definitions
74 
75  TYPE, PUBLIC :: varying_string
76  private
77  character(LEN=1), dimension(:), allocatable :: chars
78  END TYPE varying_string
79 
80 ! Interface blocks
81 
82  interface assignment(=)
83  module procedure op_assign_ch_vs
84  module procedure op_assign_vs_ch
85  end interface !assignment(=)
86 
87  interface operator(//)
88  module procedure op_concat_vs_vs
89  module procedure op_concat_ch_vs
90  module procedure op_concat_vs_ch
91  module procedure op_concat_vs_int
92  end interface !operator(//)
93 
94  interface operator(==)
95  module procedure op_eq_vs_vs
96  module procedure op_eq_ch_vs
97  module procedure op_eq_vs_ch
98  end interface !operator(==)
99 
100  interface operator(/=)
101  module procedure op_ne_vs_vs
102  module procedure op_ne_ch_vs
103  module procedure op_ne_vs_ch
104  end interface !operator (/=)
105 
106  interface operator(<)
107  module procedure op_lt_vs_vs
108  module procedure op_lt_ch_vs
109  module procedure op_lt_vs_ch
110  end interface !operator (<)
111 
112  interface operator(<=)
113  module procedure op_le_vs_vs
114  module procedure op_le_ch_vs
115  module procedure op_le_vs_ch
116  end interface !operator (<=)
117 
118  interface operator(>=)
119  module procedure op_ge_vs_vs
120  module procedure op_ge_ch_vs
121  module procedure op_ge_vs_ch
122  end interface !operator (>=)
123 
124  interface operator(>)
125  module procedure op_gt_vs_vs
126  module procedure op_gt_ch_vs
127  module procedure op_gt_vs_ch
128  end interface !operator (>)
129 
130  interface adjustl
131  module procedure adjustl_
132  end interface !adjustl
133 
134  interface adjustr
135  module procedure adjustr_
136  end interface !adjustr
137 
138  interface char
139  module procedure char_auto
140  module procedure char_fixed
141  end interface !char
142 
143  interface cchar
144  module procedure c_char_auto
145  module procedure c_char_fixed
146  end interface !cchar
147 
148  interface iachar
149  module procedure iachar_
150  end interface !iachar
151 
152  interface ichar
153  module procedure ichar_
154  end interface !ichar
155 
156  interface index
157  module procedure index_vs_vs
158  module procedure index_ch_vs
159  module procedure index_vs_ch
160  end interface !index
161 
162  interface len
163  module procedure len_
164  end interface !len
165 
166  interface len_trim
167  module procedure len_trim_
168  end interface !len_trim
169 
170  interface lge
171  module procedure lge_vs_vs
172  module procedure lge_ch_vs
173  module procedure lge_vs_ch
174  end interface !lge
175 
176  interface lgt
177  module procedure lgt_vs_vs
178  module procedure lgt_ch_vs
179  module procedure lgt_vs_ch
180  end interface !lgt
181 
182  interface lle
183  module procedure lle_vs_vs
184  module procedure lle_ch_vs
185  module procedure lle_vs_ch
186  end interface !lle
187 
188  interface llt
189  module procedure llt_vs_vs
190  module procedure llt_ch_vs
191  module procedure llt_vs_ch
192  end interface !llt
193 
194  interface repeat
195  module procedure repeat_
196  end interface !repeat
197 
198  interface scan
199  module procedure scan_vs_vs
200  module procedure scan_ch_vs
201  module procedure scan_vs_ch
202  end interface !scan
203 
204  interface trim
205  module procedure trim_
206  end interface !trim
207 
208  interface verify
209  module procedure verify_vs_vs
210  module procedure verify_ch_vs
211  module procedure verify_vs_ch
212  end interface !verify
213 
214  interface var_str
215  module procedure var_str_
216  end interface !var_str
217 
218  interface get
219  module procedure get_
220  module procedure get_unit
221  module procedure get_set_vs
222  module procedure get_set_ch
223  module procedure get_unit_set_vs
224  module procedure get_unit_set_ch
225  end interface !get
226 
227  interface put
228  module procedure put_vs
229  module procedure put_ch
230  module procedure put_unit_vs
231  module procedure put_unit_ch
232  end interface !put
233 
234  interface put_line
235  module procedure put_line_vs
236  module procedure put_line_ch
237  module procedure put_line_unit_vs
238  module procedure put_line_unit_ch
239  end interface !put_line
240 
241  interface extract
242  module procedure extract_vs
243  module procedure extract_ch
244  end interface !extract
245 
246  interface insert
247  module procedure insert_vs_vs
248  module procedure insert_ch_vs
249  module procedure insert_vs_ch
250  module procedure insert_ch_ch
251  end interface !insert
252 
253  interface remove
254  module procedure remove_vs
255  module procedure remove_ch
256  end interface !remove
257 
258  interface replace
259  module procedure replace_vs_vs_auto
260  module procedure replace_ch_vs_auto
261  module procedure replace_vs_ch_auto
262  module procedure replace_ch_ch_auto
263  module procedure replace_vs_vs_fixed
264  module procedure replace_ch_vs_fixed
265  module procedure replace_vs_ch_fixed
266  module procedure replace_ch_ch_fixed
267  module procedure replace_vs_vs_vs_target
268  module procedure replace_ch_vs_vs_target
269  module procedure replace_vs_ch_vs_target
270  module procedure replace_ch_ch_vs_target
271  module procedure replace_vs_vs_ch_target
272  module procedure replace_ch_vs_ch_target
273  module procedure replace_vs_ch_ch_target
274  module procedure replace_ch_ch_ch_target
275  end interface
276 
277  interface split
278  module procedure split_vs
279  module procedure split_ch
280  end interface !split
281 
282  interface erase
283  module procedure erase_
284  end interface !erase
285 
286  ! Access specifiers
287 
288  public :: assignment(=)
289  public :: operator(//)
290  public :: operator(==)
291  public :: operator(/=)
292  public :: operator(<)
293  public :: operator(<=)
294  public :: operator(>=)
295  public :: operator(>)
296  public :: adjustl
297  public :: adjustr
298  public :: char
299  public :: cchar
300  public :: iachar
301  public :: ichar
302  public :: index
303  public :: len
304  public :: len_trim
305  public :: lge
306  public :: lgt
307  public :: lle
308  public :: llt
309  public :: repeat
310  public :: scan
311  public :: trim
312  public :: verify
313  public :: var_str
314  public :: get
315  public :: put
316  public :: put_line
317  public :: extract
318  public :: insert
319  public :: remove
320  public :: replace
321  public :: split
322  public :: erase
323 
324  private :: op_assign_ch_vs
325  private :: op_assign_vs_ch
326  private :: op_concat_vs_vs
327  private :: op_concat_ch_vs
328  private :: op_concat_vs_ch
329  private :: op_concat_vs_int
330  private :: op_eq_vs_vs
331  private :: op_eq_ch_vs
332  private :: op_eq_vs_ch
333  private :: op_ne_vs_vs
334  private :: op_ne_ch_vs
335  private :: op_ne_vs_ch
336  private :: op_lt_vs_vs
337  private :: op_lt_ch_vs
338  private :: op_lt_vs_ch
339  private :: op_le_vs_vs
340  private :: op_le_ch_vs
341  private :: op_le_vs_ch
342  private :: op_ge_vs_vs
343  private :: op_ge_ch_vs
344  private :: op_ge_vs_ch
345  private :: op_gt_vs_vs
346  private :: op_gt_ch_vs
347  private :: op_gt_vs_ch
348  private :: adjustl_
349  private :: adjustr_
350  private :: char_auto
351  private :: char_fixed
352  private :: c_char_auto
353  private :: c_char_fixed
354  private :: iachar_
355  private :: ichar_
356  private :: index_vs_vs
357  private :: index_ch_vs
358  private :: index_vs_ch
359  private :: len_
360  private :: len_trim_
361  private :: lge_vs_vs
362  private :: lge_ch_vs
363  private :: lge_vs_ch
364  private :: lgt_vs_vs
365  private :: lgt_ch_vs
366  private :: lgt_vs_ch
367  private :: lle_vs_vs
368  private :: lle_ch_vs
369  private :: lle_vs_ch
370  private :: llt_vs_vs
371  private :: llt_ch_vs
372  private :: llt_vs_ch
373  private :: repeat_
374  private :: scan_vs_vs
375  private :: scan_ch_vs
376  private :: scan_vs_ch
377  private :: trim_
378  private :: verify_vs_vs
379  private :: verify_ch_vs
380  private :: verify_vs_ch
381  private :: var_str_
382  private :: get_
383  private :: get_unit
384  private :: get_set_vs
385  private :: get_set_ch
386  private :: get_unit_set_vs
387  private :: get_unit_set_ch
388  private :: put_vs
389  private :: put_ch
390  private :: put_unit_vs
391  private :: put_unit_ch
392  private :: put_line_vs
393  private :: put_line_ch
394  private :: put_line_unit_vs
395  private :: put_line_unit_ch
396  private :: extract_vs
397  private :: extract_ch
398  private :: insert_vs_vs
399  private :: insert_ch_vs
400  private :: insert_vs_ch
401  private :: insert_ch_ch
402  private :: remove_vs
403  private :: remove_ch
404  private :: replace_vs_vs_auto
405  private :: replace_ch_vs_auto
406  private :: replace_vs_ch_auto
407  private :: replace_ch_ch_auto
408  private :: replace_vs_vs_fixed
409  private :: replace_ch_vs_fixed
410  private :: replace_vs_ch_fixed
411  private :: replace_ch_ch_fixed
412  private :: replace_vs_vs_vs_target
413  private :: replace_ch_vs_vs_target
414  private :: replace_vs_ch_vs_target
415  private :: replace_ch_ch_vs_target
416  private :: replace_vs_vs_ch_target
417  private :: replace_ch_vs_ch_target
418  private :: replace_vs_ch_ch_target
419  private :: replace_ch_ch_ch_target
420  private :: split_vs
421  private :: split_ch
422  private :: erase_
423 
424 ! Procedures
425 
426 contains
427 
428 !CPB 26/9/05 Move len here as the IBM compilers require it defined before it is used.
429  !****
430 
431  elemental function len_ (string) result (length)
433  type(varying_string), intent(in) :: string
434  integer :: length
435 
436 ! Get the length of a varying string
437 
438  if(ALLOCATED(string%chars)) then
439  length = SIZE(string%chars)
440  else
441  length = 0
442  endif
443 
444 ! Finish
445 
446  return
447 
448  end function len_
449 
450 !****
451 
452  elemental subroutine op_assign_ch_vs (var, exp)
454  character(LEN=*), intent(out) :: var
455  type(varying_string), intent(in) :: exp
456 
457 ! Assign a varying string to a character string
458 
459  var = char(exp)
460 
461 ! Finish
462 
463  return
464 
465  end subroutine op_assign_ch_vs
466 
467 !****
468 
469  elemental subroutine op_assign_vs_ch (var, exp)
471  type(varying_string), intent(out) :: var
472  character(LEN=*), intent(in) :: exp
473 
474 ! Assign a character string to a varying string
475 
476  var = var_str(exp)
477 
478 ! Finish
479 
480  return
481 
482  end subroutine op_assign_vs_ch
483 
484 !****
485 
486  elemental function op_concat_vs_vs (string_a, string_b) result (concat_string)
488  type(varying_string), intent(in) :: string_a
489  type(varying_string), intent(in) :: string_b
490  type(varying_string) :: concat_string
491 
492  integer :: len_string_a
493 
494 ! Concatenate two varying strings
495 
496  len_string_a = len(string_a)
497 
498  ALLOCATE(concat_string%chars(len_string_a+len(string_b)))
499 
500  !CPB 20/02/07 aix compiler seems to have problems with this routine if string_a is not allocated and so the the
501  !length is zero. Check not zero then execute command.
502  if(len_string_a > 0) then
503 
504  concat_string%chars(:len_string_a) = string_a%chars
505 
506  endif
507  concat_string%chars(len_string_a+1:) = string_b%chars
508 
509 ! Finish
510 
511  return
512 
513  end function op_concat_vs_vs
514 
515 !****
516 
517  elemental function op_concat_ch_vs (string_a, string_b) result (concat_string)
519  character(LEN=*), intent(in) :: string_a
520  type(varying_string), intent(in) :: string_b
521  type(varying_string) :: concat_string
522 
523 ! Concatenate a character string and a varying
524 ! string
525 
526  concat_string = op_concat_vs_vs(var_str(string_a), string_b)
527 
528 ! Finish
529 
530  return
531 
532  end function op_concat_ch_vs
533 
534 !****
535 
536  elemental function op_concat_vs_ch (string_a, string_b) result (concat_string)
538  type(varying_string), intent(in) :: string_a
539  character(LEN=*), intent(in) :: string_b
540  type(varying_string) :: concat_string
541 
542 ! Concatenate a varying string and a character
543 ! string
544 
545  concat_string = op_concat_vs_vs(string_a, var_str(string_b))
546 
547 ! Finish
548 
549  return
550 
551  end function op_concat_vs_ch
552 
553 !****
554 
555  elemental function op_concat_vs_int (string, value) result (concat_string)
557  type(varying_string), intent(in) :: string
558  integer, intent(in) :: value
559  type(varying_string) :: concat_string
560 
561 ! Concatenate a varying string and an integer
562  character(LEN=20) :: local_string
563 
564  WRITE(local_string,"(I12)") value
565 
566  concat_string=string//trim(adjustl(local_string))
567 
568 ! Finish
569 
570  return
571 
572  end function op_concat_vs_int
573 
574 !****
575 
576  elemental function op_eq_vs_vs (string_a, string_b) result (op_eq)
578  type(varying_string), intent(in) :: string_a
579  type(varying_string), intent(in) :: string_b
580  logical :: op_eq
581  integer :: len_a, len_b, min_len
582 
583 ! Compare (==) two varying strings
584 
585  op_eq = .true.
586  len_a = len(string_a)
587  len_b = len(string_b)
588  min_len = min(len_a, len_b)
589 
590  if(any(string_a%chars(1:min_len)/=string_b%chars(1:min_len))) then
591  op_eq = .false.
592  return
593  end if
594  !Strings might have different length but be padded with space
595  if(any(string_a%chars(len_b+1:len_a)/=" ")) then
596  op_eq = .false.
597  return
598  end if
599  if(any(string_b%chars(len_a+1:len_b)/=" ")) then
600  op_eq = .false.
601  return
602  end if
603 
604 ! Finish
605 
606  return
607 
608  end function op_eq_vs_vs
609 
610 !****
611 
612  elemental function op_eq_ch_vs (string_a, string_b) result (op_eq)
614  character(LEN=*), intent(in) :: string_a
615  type(varying_string), intent(in) :: string_b
616  logical :: op_eq
617 
618 ! Compare (==) a character string and a varying
619 ! string
620 
621  op_eq = string_a == char(string_b)
622 
623 ! Finish
624 
625  return
626 
627  end function op_eq_ch_vs
628 
629 !****
630 
631  elemental function op_eq_vs_ch (string_a, string_b) result (op_eq)
633  type(varying_string), intent(in) :: string_a
634  character(LEN=*), intent(in) :: string_b
635  logical :: op_eq
636 
637 ! Compare (==) a varying string and a character
638 ! string
639 
640  op_eq = char(string_a) == string_b
641 
642 ! Finish
643 
644  return
645 
646  end function op_eq_vs_ch
647 
648 !****
649 
650  elemental function op_ne_vs_vs (string_a, string_b) result (op_ne)
652  type(varying_string), intent(in) :: string_a
653  type(varying_string), intent(in) :: string_b
654  logical :: op_ne
655 
656 ! Compare (/=) two varying strings
657 
658  op_ne = char(string_a) /= char(string_b)
659 
660 ! Finish
661 
662  return
663 
664  end function op_ne_vs_vs
665 
666 !****
667 
668  elemental function op_ne_ch_vs (string_a, string_b) result (op_ne)
670  character(LEN=*), intent(in) :: string_a
671  type(varying_string), intent(in) :: string_b
672  logical :: op_ne
673 
674 ! Compare (/=) a character string and a varying
675 ! string
676 
677  op_ne = string_a /= char(string_b)
678 
679 ! Finish
680 
681  return
682 
683  end function op_ne_ch_vs
684 
685 !****
686 
687  elemental function op_ne_vs_ch (string_a, string_b) result (op_ne)
689  type(varying_string), intent(in) :: string_a
690  character(LEN=*), intent(in) :: string_b
691  logical :: op_ne
692 
693 ! Compare (/=) a varying string and a character
694 ! string
695 
696  op_ne = char(string_a) /= string_b
697 
698 ! Finish
699 
700  return
701 
702  end function op_ne_vs_ch
703 
704 !****
705 
706  elemental function op_lt_vs_vs (string_a, string_b) result (op_lt)
708  type(varying_string), intent(in) :: string_a
709  type(varying_string), intent(in) :: string_b
710  logical :: op_lt
711 
712 ! Compare (<) two varying strings
713 
714  op_lt = char(string_a) < char(string_b)
715 
716 ! Finish
717 
718  return
719 
720  end function op_lt_vs_vs
721 
722 !****
723 
724  elemental function op_lt_ch_vs (string_a, string_b) result (op_lt)
726  character(LEN=*), intent(in) :: string_a
727  type(varying_string), intent(in) :: string_b
728  logical :: op_lt
729 
730 ! Compare (<) a character string and a varying
731 ! string
732 
733  op_lt = string_a < char(string_b)
734 
735 ! Finish
736 
737  return
738 
739  end function op_lt_ch_vs
740 
741 !****
742 
743  elemental function op_lt_vs_ch (string_a, string_b) result (op_lt)
745  type(varying_string), intent(in) :: string_a
746  character(LEN=*), intent(in) :: string_b
747  logical :: op_lt
748 
749 ! Compare (<) a varying string and a character
750 ! string
751 
752  op_lt = char(string_a) < string_b
753 
754 ! Finish
755 
756  return
757 
758  end function op_lt_vs_ch
759 
760 !****
761 
762  elemental function op_le_vs_vs (string_a, string_b) result (op_le)
764  type(varying_string), intent(in) :: string_a
765  type(varying_string), intent(in) :: string_b
766  logical :: op_le
767 
768 ! Compare (<=) two varying strings
769 
770  op_le = char(string_a) <= char(string_b)
771 
772 ! Finish
773 
774  return
775 
776  end function op_le_vs_vs
777 
778 !****
779 
780  elemental function op_le_ch_vs (string_a, string_b) result (op_le)
782  character(LEN=*), intent(in) :: string_a
783  type(varying_string), intent(in) :: string_b
784  logical :: op_le
785 
786 ! Compare (<=) a character string and a varying
787 ! string
788 
789  op_le = string_a <= char(string_b)
790 
791 ! Finish
792 
793  return
794 
795  end function op_le_ch_vs
796 
797 !****
798 
799  elemental function op_le_vs_ch (string_a, string_b) result (op_le)
801  type(varying_string), intent(in) :: string_a
802  character(LEN=*), intent(in) :: string_b
803  logical :: op_le
804 
805 ! Compare (<=) a varying string and a character
806 ! string
807 
808  op_le = char(string_a) <= string_b
809 
810 ! Finish
811 
812  return
813 
814  end function op_le_vs_ch
815 
816 !****
817 
818  elemental function op_ge_vs_vs (string_a, string_b) result (op_ge)
820  type(varying_string), intent(in) :: string_a
821  type(varying_string), intent(in) :: string_b
822  logical :: op_ge
823 
824 ! Compare (>=) two varying strings
825 
826  op_ge = char(string_a) >= char(string_b)
827 
828 ! Finish
829 
830  return
831 
832  end function op_ge_vs_vs
833 
834 !****
835 
836  elemental function op_ge_ch_vs (string_a, string_b) result (op_ge)
838  character(LEN=*), intent(in) :: string_a
839  type(varying_string), intent(in) :: string_b
840  logical :: op_ge
841 
842 ! Compare (>=) a character string and a varying
843 ! string
844 
845  op_ge = string_a >= char(string_b)
846 
847 ! Finish
848 
849  return
850 
851  end function op_ge_ch_vs
852 
853 !****
854 
855  elemental function op_ge_vs_ch (string_a, string_b) result (op_ge)
857  type(varying_string), intent(in) :: string_a
858  character(LEN=*), intent(in) :: string_b
859  logical :: op_ge
860 
861 ! Compare (>=) a varying string and a character
862 ! string
863 
864  op_ge = char(string_a) >= string_b
865 
866 ! Finish
867 
868  return
869 
870  end function op_ge_vs_ch
871 
872 !****
873 
874  elemental function op_gt_vs_vs (string_a, string_b) result (op_gt)
876  type(varying_string), intent(in) :: string_a
877  type(varying_string), intent(in) :: string_b
878  logical :: op_gt
879 
880 ! Compare (>) two varying strings
881 
882  op_gt = char(string_a) > char(string_b)
883 
884 ! Finish
885 
886  return
887 
888  end function op_gt_vs_vs
889 
890 !****
891 
892  elemental function op_gt_ch_vs (string_a, string_b) result (op_gt)
894  character(LEN=*), intent(in) :: string_a
895  type(varying_string), intent(in) :: string_b
896  logical :: op_gt
897 
898 ! Compare (>) a character string and a varying
899 ! string
900 
901  op_gt = string_a > char(string_b)
902 
903 ! Finish
904 
905  return
906 
907  end function op_gt_ch_vs
908 
909 !****
910 
911  elemental function op_gt_vs_ch (string_a, string_b) result (op_gt)
913  type(varying_string), intent(in) :: string_a
914  character(LEN=*), intent(in) :: string_b
915  logical :: op_gt
916 
917 ! Compare (>) a varying string and a character
918 ! string
919 
920  op_gt = char(string_a) > string_b
921 
922 ! Finish
923 
924  return
925 
926  end function op_gt_vs_ch
927 
928 !****
929 
930  elemental function adjustl_ (string) result (adjustl_string)
932  type(varying_string), intent(in) :: string
933  type(varying_string) :: adjustl_string
934 
935 ! Adjust the varying string to the left
936 
937  adjustl_string = adjustl(char(string))
938 
939 ! Finish
940 
941  return
942 
943  end function adjustl_
944 
945 !****
946 
947  elemental function adjustr_ (string) result (adjustr_string)
949  type(varying_string), intent(in) :: string
950  type(varying_string) :: adjustr_string
951 
952 ! Adjust the varying string to the right
953 
954  adjustr_string = adjustr(char(string))
955 
956 ! Finish
957 
958  return
959 
960  end function adjustr_
961 
962 !****
963 
964  pure function char_auto (string) result (char_string)
966  type(varying_string), intent(in) :: string
967  character(LEN=len(string)) :: char_string
968 
969  integer :: i_char
970 
971 ! Convert a varying string into a character string
972 ! (automatic length)
973 
974  forall(i_char = 1:len(string))
975  char_string(i_char:i_char) = string%chars(i_char)
976  end forall
977 
978 ! Finish
979 
980  return
981 
982  end function char_auto
983 
984 !****
985 
986  pure function char_fixed (string, length) result (char_string)
988  type(varying_string), intent(in) :: string
989  integer, intent(in) :: length
990  character(LEN=length) :: char_string
991 
992 ! Convert a varying string into a character string
993 ! (fixed length)
994 
995  char_string = char(string)
996 
997 ! Finish
998 
999  return
1000 
1001  end function char_fixed
1002 
1003 !****
1004 
1005  pure function c_char_auto (string) result (c_char_string)
1007  type(varying_string), intent(in) :: string
1008  character(LEN=1,KIND=C_CHAR) :: c_char_string(len(string)+1)
1009 
1010  integer :: i_char
1011 
1012 ! Convert a varying string into a character string
1013 ! (automatic length)
1014 
1015  forall(i_char = 1:len(string))
1016  c_char_string(i_char) = string%chars(i_char)
1017  end forall
1018  c_char_string(len(string)+1) = c_null_char
1019 
1020 ! Finish
1021 
1022  return
1023 
1024  end function c_char_auto
1025 
1026 !****
1027 
1028  pure function c_char_fixed (string, length) result (c_char_string)
1030  type(varying_string), intent(in) :: string
1031  integer, intent(in) :: length
1032  character(LEN=1,KIND=C_CHAR) :: c_char_string(length+1)
1033 
1034  integer :: i_char
1035 
1036 ! Convert a varying string into a character string
1037 ! (fixed length)
1038 
1039  forall(i_char = 1:length)
1040  c_char_string(i_char) = string%chars(i_char)
1041  end forall
1042  c_char_string(length+1) = c_null_char
1043 
1044 ! Finish
1045 
1046  return
1047 
1048  end function c_char_fixed
1049 
1050 !****
1051 
1052  elemental function iachar_ (c) result (i)
1054  type(varying_string), intent(in) :: c
1055  integer :: i
1056 
1057 ! Get the position in the ISO 646 collating sequence
1058 ! of a varying string character
1059 
1060  i = ichar(char(c))
1061 
1062 ! Finish
1063 
1064  return
1065 
1066  end function iachar_
1067 
1068 !****
1069 
1070  elemental function ichar_ (c) result (i)
1072  type(varying_string), intent(in) :: c
1073  integer :: i
1074 
1075 ! Get the position in the processor collating
1076 ! sequence of a varying string character
1077 
1078  i = ichar(char(c))
1079 
1080 ! Finish
1081 
1082  return
1083 
1084  end function ichar_
1085 
1086 !****
1087 
1088  elemental function index_vs_vs (string, substring, back) result (i_substring)
1090  type(varying_string), intent(in) :: string
1091  type(varying_string), intent(in) :: substring
1092  logical, intent(in), optional :: back
1093  integer :: i_substring
1094 
1095 ! Get the index of a varying substring within a
1096 ! varying string
1097 
1098  i_substring = index(char(string), char(substring), back)
1099 
1100 ! Finish
1101 
1102  return
1103 
1104  end function index_vs_vs
1105 
1106 !****
1107 
1108  elemental function index_ch_vs (string, substring, back) result (i_substring)
1110  character(LEN=*), intent(in) :: string
1111  type(varying_string), intent(in) :: substring
1112  logical, intent(in), optional :: back
1113  integer :: i_substring
1114 
1115 ! Get the index of a varying substring within a
1116 ! character string
1117 
1118  i_substring = index(string, char(substring), back)
1119 
1120 ! Finish
1121 
1122  return
1123 
1124  end function index_ch_vs
1125 
1126 !****
1127 
1128  elemental function index_vs_ch (string, substring, back) result (i_substring)
1130  type(varying_string), intent(in) :: string
1131  character(LEN=*), intent(in) :: substring
1132  logical, intent(in), optional :: back
1133  integer :: i_substring
1134 
1135 ! Get the index of a character substring within a
1136 ! varying string
1137 
1138  i_substring = index(char(string), substring, back)
1139 
1140 ! Finish
1141 
1142  return
1143 
1144  end function index_vs_ch
1145 
1146 !****
1147 
1148  elemental function len_trim_ (string) result (length)
1150  type(varying_string), intent(in) :: string
1151  integer :: length
1152 
1153 ! Get the trimmed length of a varying string
1154 
1155  if(ALLOCATED(string%chars)) then
1156  length = len_trim(char(string))
1157  else
1158  length = 0
1159  endif
1160 
1161 ! Finish
1162 
1163  return
1164 
1165  end function len_trim_
1166 
1167 !****
1168 
1169  elemental function lge_vs_vs (string_a, string_b) result (comp)
1171  type(varying_string), intent(in) :: string_a
1172  type(varying_string), intent(in) :: string_b
1173  logical :: comp
1174 
1175 ! Compare (LGE) two varying strings
1176 
1177  comp = (char(string_a) >= char(string_b))
1178 
1179 ! Finish
1180 
1181  return
1182 
1183  end function lge_vs_vs
1184 
1185 !****
1186 
1187  elemental function lge_ch_vs (string_a, string_b) result (comp)
1189  character(LEN=*), intent(in) :: string_a
1190  type(varying_string), intent(in) :: string_b
1191  logical :: comp
1192 
1193 ! Compare (LGE) a character string and a varying
1194 ! string
1195 
1196  comp = (string_a >= char(string_b))
1197 
1198 ! Finish
1199 
1200  return
1201 
1202  end function lge_ch_vs
1203 
1204 !****
1205 
1206  elemental function lge_vs_ch (string_a, string_b) result (comp)
1208  type(varying_string), intent(in) :: string_a
1209  character(LEN=*), intent(in) :: string_b
1210  logical :: comp
1211 
1212 ! Compare (LGE) a varying string and a character
1213 ! string
1214 
1215  comp = (char(string_a) >= string_b)
1216 
1217 ! Finish
1218 
1219  return
1220 
1221  end function lge_vs_ch
1222 
1223 !****
1224 
1225  elemental function lgt_vs_vs (string_a, string_b) result (comp)
1227  type(varying_string), intent(in) :: string_a
1228  type(varying_string), intent(in) :: string_b
1229  logical :: comp
1230 
1231 ! Compare (LGT) two varying strings
1232 
1233  comp = (char(string_a) > char(string_b))
1234 
1235 ! Finish
1236 
1237  return
1238 
1239  end function lgt_vs_vs
1240 
1241 !****
1242 
1243  elemental function lgt_ch_vs (string_a, string_b) result (comp)
1245  character(LEN=*), intent(in) :: string_a
1246  type(varying_string), intent(in) :: string_b
1247  logical :: comp
1248 
1249 ! Compare (LGT) a character string and a varying
1250 ! string
1251 
1252  comp = (string_a > char(string_b))
1253 
1254 ! Finish
1255 
1256  return
1257 
1258  end function lgt_ch_vs
1259 
1260 !****
1261 
1262  elemental function lgt_vs_ch (string_a, string_b) result (comp)
1264  type(varying_string), intent(in) :: string_a
1265  character(LEN=*), intent(in) :: string_b
1266  logical :: comp
1267 
1268 ! Compare (LGT) a varying string and a character
1269 ! string
1270 
1271  comp = (char(string_a) > string_b)
1272 
1273 ! Finish
1274 
1275  return
1276 
1277  end function lgt_vs_ch
1278 
1279 !****
1280 
1281  elemental function lle_vs_vs (string_a, string_b) result (comp)
1283  type(varying_string), intent(in) :: string_a
1284  type(varying_string), intent(in) :: string_b
1285  logical :: comp
1286 
1287 ! Compare (LLE) two varying strings
1288 
1289  comp = (char(string_a) <= char(string_b))
1290 
1291 ! Finish
1292 
1293  return
1294 
1295  end function lle_vs_vs
1296 
1297 !****
1298 
1299  elemental function lle_ch_vs (string_a, string_b) result (comp)
1301  character(LEN=*), intent(in) :: string_a
1302  type(varying_string), intent(in) :: string_b
1303  logical :: comp
1304 
1305 ! Compare (LLE) a character string and a varying
1306 ! string
1307 
1308  comp = (string_a <= char(string_b))
1309 
1310 ! Finish
1311 
1312  return
1313 
1314  end function lle_ch_vs
1315 
1316 !****
1317 
1318  elemental function lle_vs_ch (string_a, string_b) result (comp)
1320  type(varying_string), intent(in) :: string_a
1321  character(LEN=*), intent(in) :: string_b
1322  logical :: comp
1323 
1324 ! Compare (LLE) a varying string and a character
1325 ! string
1326 
1327  comp = (char(string_a) <= string_b)
1328 
1329 ! Finish
1330 
1331  return
1332 
1333  end function lle_vs_ch
1334 
1335 !****
1336 
1337  elemental function llt_vs_vs (string_a, string_b) result (comp)
1339  type(varying_string), intent(in) :: string_a
1340  type(varying_string), intent(in) :: string_b
1341  logical :: comp
1342 
1343 ! Compare (LLT) two varying strings
1344 
1345  comp = (char(string_a) < char(string_b))
1346 
1347 ! Finish
1348 
1349  return
1350 
1351  end function llt_vs_vs
1352 
1353 !****
1354 
1355  elemental function llt_ch_vs (string_a, string_b) result (comp)
1357  character(LEN=*), intent(in) :: string_a
1358  type(varying_string), intent(in) :: string_b
1359  logical :: comp
1360 
1361 ! Compare (LLT) a character string and a varying
1362 ! string
1363 
1364  comp = (string_a < char(string_b))
1365 
1366 ! Finish
1367 
1368  return
1369 
1370  end function llt_ch_vs
1371 
1372 !****
1373 
1374  elemental function llt_vs_ch (string_a, string_b) result (comp)
1376  type(varying_string), intent(in) :: string_a
1377  character(LEN=*), intent(in) :: string_b
1378  logical :: comp
1379 
1380 ! Compare (LLT) a varying string and a character
1381 ! string
1382 
1383  comp = (char(string_a) < string_b)
1384 
1385 ! Finish
1386 
1387  return
1388 
1389  end function llt_vs_ch
1390 
1391 !****
1392 
1393  elemental function repeat_ (string, ncopies) result (repeat_string)
1395  type(varying_string), intent(in) :: string
1396  integer, intent(in) :: ncopies
1397  type(varying_string) :: repeat_string
1398 
1399 ! Concatenate several copies of a varying string
1400 
1401  repeat_string = var_str(repeat(char(string), ncopies))
1402 
1403 ! Finish
1404 
1405  return
1406 
1407  end function repeat_
1408 
1409 !****
1410 
1411  elemental function scan_vs_vs (string, set, back) result (i)
1413  type(varying_string), intent(in) :: string
1414  type(varying_string), intent(in) :: set
1415  logical, intent(in), optional :: back
1416  integer :: i
1417 
1418 ! Scan a varying string for occurrences of
1419 ! characters in a varying-string set
1420 
1421  i = scan(char(string), char(set), back)
1422 
1423 ! Finish
1424 
1425  return
1426 
1427  end function scan_vs_vs
1428 
1429 !****
1430 
1431  elemental function scan_ch_vs (string, set, back) result (i)
1433  character(LEN=*), intent(in) :: string
1434  type(varying_string), intent(in) :: set
1435  logical, intent(in), optional :: back
1436  integer :: i
1437 
1438 ! Scan a character string for occurrences of
1439 ! characters in a varying-string set
1440 
1441  i = scan(string, char(set), back)
1442 
1443 ! Finish
1444 
1445  return
1446 
1447  end function scan_ch_vs
1448 
1449 !****
1450 
1451  elemental function scan_vs_ch (string, set, back) result (i)
1453  type(varying_string), intent(in) :: string
1454  character(LEN=*), intent(in) :: set
1455  logical, intent(in), optional :: back
1456  integer :: i
1457 
1458 ! Scan a varying string for occurrences of
1459 ! characters in a character-string set
1460 
1461  i = scan(char(string), set, back)
1462 
1463 ! Finish
1464 
1465  return
1466 
1467  end function scan_vs_ch
1468 
1469 !****
1470 
1471  elemental function trim_ (string) result (trim_string)
1473  type(varying_string), intent(in) :: string
1474  type(varying_string) :: trim_string
1475 
1476 ! Remove trailing blanks from a varying string
1477 
1478  trim_string = trim(char(string))
1479 
1480 ! Finish
1481 
1482  return
1483 
1484  end function trim_
1485 
1486 !****
1487 
1488  elemental function verify_vs_vs (string, set, back) result (i)
1490  type(varying_string), intent(in) :: string
1491  type(varying_string), intent(in) :: set
1492  logical, intent(in), optional :: back
1493  integer :: i
1494 
1495 ! Verify a varying string for occurrences of
1496 ! characters in a varying-string set
1497 
1498  i = verify(char(string), char(set), back)
1499 
1500 ! Finish
1501 
1502  return
1503 
1504  end function verify_vs_vs
1505 
1506 !****
1507 
1508  elemental function verify_ch_vs (string, set, back) result (i)
1510  character(LEN=*), intent(in) :: string
1511  type(varying_string), intent(in) :: set
1512  logical, intent(in), optional :: back
1513  integer :: i
1514 
1515 ! Verify a character string for occurrences of
1516 ! characters in a varying-string set
1517 
1518  i = verify(string, char(set), back)
1519 
1520 ! Finish
1521 
1522  return
1523 
1524  end function verify_ch_vs
1525 
1526 !****
1527 
1528  elemental function verify_vs_ch (string, set, back) result (i)
1530  type(varying_string), intent(in) :: string
1531  character(LEN=*), intent(in) :: set
1532  logical, intent(in), optional :: back
1533  integer :: i
1534 
1535 ! Verify a varying string for occurrences of
1536 ! characters in a character-string set
1537 
1538  i = verify(char(string), set, back)
1539 
1540 ! Finish
1541 
1542  return
1543 
1544  end function verify_vs_ch
1545 
1546 !****
1547 
1548  elemental function var_str_ (char) result (string)
1550  character(LEN=*), intent(in) :: char
1551  type(varying_string) :: string
1552 
1553  integer :: length
1554  integer :: i
1555 
1556 ! Convert a character string to a varying string
1557 
1558  length = len(char)
1559 
1560  ALLOCATE(string%chars(length))
1561 
1562  forall(i = 1:length)
1563  string%chars(i) = char(i:i)
1564  end forall
1565 
1566 ! Finish
1567 
1568  return
1569 
1570  end function var_str_
1571 
1572 !****
1573 
1574  subroutine get_ (string, maxlen, iostat)
1576  type(varying_string), intent(out) :: string
1577  integer, intent(in), optional :: maxlen
1578  integer, intent(out), optional :: iostat
1579 
1580  integer :: n_chars_remain
1581  integer :: n_chars_read
1582  character(LEN=GET_BUFFER_LEN) :: buffer
1583  integer :: local_iostat
1584 
1585 ! Read from the default unit into a varying string
1586 
1587  string = ""
1588 
1589  if(PRESENT(maxlen)) then
1590  n_chars_remain = maxlen
1591  else
1592  n_chars_remain = huge(1)
1593  endif
1594 
1595  read_loop : do
1596 
1597  if(n_chars_remain <= 0) return
1598 
1599  n_chars_read = min(n_chars_remain, get_buffer_len)
1600 
1601  if(PRESENT(iostat)) then
1602  read(unit=*, fmt="(A)", advance="NO", &
1603  iostat=iostat, size=n_chars_read) buffer(:n_chars_read)
1604  if(iostat < 0) exit read_loop
1605  if(iostat > 0) return
1606  else
1607  read(unit=*, fmt="(A)", advance="NO", &
1608  iostat=local_iostat, size=n_chars_read) buffer(:n_chars_read)
1609  if(local_iostat < 0) exit read_loop
1610  endif
1611 
1612  string = string//buffer(:n_chars_read)
1613  n_chars_remain = n_chars_remain - n_chars_read
1614 
1615  end do read_loop
1616 
1617  string = string//buffer(:n_chars_read)
1618 
1619 ! Finish (end-of-record)
1620 
1621  return
1622 
1623  end subroutine get_
1624 
1625 !****
1626 
1627  subroutine get_unit (unit, string, maxlen, iostat)
1629  integer, intent(in) :: unit
1630  type(varying_string), intent(out) :: string
1631  integer, intent(in), optional :: maxlen
1632  integer, intent(out), optional :: iostat
1633 
1634  integer :: n_chars_remain
1635  integer :: n_chars_read
1636  character(LEN=GET_BUFFER_LEN) :: buffer
1637  integer :: local_iostat
1638 
1639 ! Read from the specified unit into a varying string
1640 
1641  string = ""
1642 
1643  if(PRESENT(maxlen)) then
1644  n_chars_remain = maxlen
1645  else
1646  n_chars_remain = huge(1)
1647  endif
1648 
1649  read_loop : do
1650 
1651  if(n_chars_remain <= 0) return
1652 
1653  n_chars_read = min(n_chars_remain, get_buffer_len)
1654 
1655  if(PRESENT(iostat)) then
1656  read(unit=unit, fmt="(A)", advance="NO", &
1657  iostat=iostat, size=n_chars_read) buffer(:n_chars_read)
1658  if(iostat < 0) exit read_loop
1659  if(iostat > 0) return
1660  else
1661  read(unit=unit, fmt="(A)", advance="NO", &
1662  iostat=local_iostat, size=n_chars_read) buffer(:n_chars_read)
1663  if(local_iostat < 0) exit read_loop
1664  endif
1665 
1666  string = string//buffer(:n_chars_read)
1667  n_chars_remain = n_chars_remain - n_chars_read
1668 
1669  end do read_loop
1670 
1671  string = string//buffer(:n_chars_read)
1672 
1673 ! Finish (end-of-record)
1674 
1675  return
1676 
1677  end subroutine get_unit
1678 
1679 !****
1680 
1681  subroutine get_set_vs (string, set, separator, maxlen, iostat)
1683  type(varying_string), intent(out) :: string
1684  type(varying_string), intent(in) :: set
1685  type(varying_string), intent(out), optional :: separator
1686  integer, intent(in), optional :: maxlen
1687  integer, intent(out), optional :: iostat
1688 
1689 ! Read from the default unit into a varying string,
1690 ! with a custom varying-string separator
1691 
1692  call get(string, char(set), separator, maxlen, iostat)
1693 
1694 ! Finish
1695 
1696  return
1697 
1698  end subroutine get_set_vs
1699 
1700 !****
1701 
1702  subroutine get_set_ch (string, set, separator, maxlen, iostat)
1704  type(varying_string), intent(out) :: string
1705  character(LEN=*), intent(in) :: set
1706  type(varying_string), intent(out), optional :: separator
1707  integer, intent(in), optional :: maxlen
1708  integer, intent(out), optional :: iostat
1709 
1710  integer :: n_chars_remain
1711  character(LEN=1) :: buffer
1712  integer :: i_set
1713  integer :: local_iostat
1714 
1715 ! Read from the default unit into a varying string,
1716 ! with a custom character-string separator
1717 
1718  string = ""
1719 
1720  if(PRESENT(maxlen)) then
1721  n_chars_remain = maxlen
1722  else
1723  n_chars_remain = huge(1)
1724  endif
1725 
1726  if(PRESENT(separator)) separator = ""
1727 
1728  read_loop : do
1729 
1730  if(n_chars_remain <= 0) return
1731 
1732  if(PRESENT(iostat)) then
1733  read(unit=*, fmt="(A1)", advance="NO", iostat=iostat) buffer
1734  if(iostat /= 0) exit read_loop
1735  else
1736  read(unit=*, fmt="(A1)", advance="NO", iostat=local_iostat) buffer
1737  if(local_iostat /= 0) exit read_loop
1738  endif
1739 
1740  i_set = scan(buffer, set)
1741 
1742  if(i_set == 1) then
1743  if(PRESENT(separator)) separator = buffer
1744  exit read_loop
1745  endif
1746 
1747  string = string//buffer
1748  n_chars_remain = n_chars_remain - 1
1749 
1750  end do read_loop
1751 
1752 ! Finish
1753 
1754  return
1755 
1756  end subroutine get_set_ch
1757 
1758 !****
1759 
1760  subroutine get_unit_set_vs (unit, string, set, separator, maxlen, iostat)
1762  integer, intent(in) :: unit
1763  type(varying_string), intent(out) :: string
1764  type(varying_string), intent(in) :: set
1765  type(varying_string), intent(out), optional :: separator
1766  integer, intent(in), optional :: maxlen
1767  integer, intent(out), optional :: iostat
1768 
1769 ! Read from the specified unit into a varying string,
1770 ! with a custom varying-string separator
1771 
1772  call get(unit, string, char(set), separator, maxlen, iostat)
1773 
1774 ! Finish
1775 
1776  return
1777 
1778  end subroutine get_unit_set_vs
1779 
1780 !****
1781 
1782  subroutine get_unit_set_ch (unit, string, set, separator, maxlen, iostat)
1784  integer, intent(in) :: unit
1785  type(varying_string), intent(out) :: string
1786  character(LEN=*), intent(in) :: set
1787  type(varying_string), intent(out), optional :: separator
1788  integer, intent(in), optional :: maxlen
1789  integer, intent(out), optional :: iostat
1790 
1791  integer :: n_chars_remain
1792  character(LEN=1) :: buffer
1793  integer :: i_set
1794  integer :: local_iostat
1795 
1796 ! Read from the default unit into a varying string,
1797 ! with a custom character-string separator
1798 
1799  string = ""
1800 
1801  if(PRESENT(maxlen)) then
1802  n_chars_remain = maxlen
1803  else
1804  n_chars_remain = huge(1)
1805  endif
1806 
1807  if(PRESENT(separator)) separator = ""
1808 
1809  read_loop : do
1810 
1811  if(n_chars_remain <= 0) return
1812 
1813  if(PRESENT(iostat)) then
1814  read(unit=unit, fmt="(A1)", advance="NO", iostat=iostat) buffer
1815  if(iostat /= 0) exit read_loop
1816  else
1817  read(unit=unit, fmt="(A1)", advance="NO", iostat=local_iostat) buffer
1818  if(local_iostat /= 0) exit read_loop
1819  endif
1820 
1821  i_set = scan(buffer, set)
1822 
1823  if(i_set == 1) then
1824  if(PRESENT(separator)) separator = buffer
1825  exit read_loop
1826  endif
1827 
1828  string = string//buffer
1829  n_chars_remain = n_chars_remain - 1
1830 
1831  end do read_loop
1832 
1833 ! Finish
1834 
1835  return
1836 
1837  end subroutine get_unit_set_ch
1838 
1839 !****
1840 
1841  subroutine put_vs (string, iostat)
1843  type(varying_string), intent(in) :: string
1844  integer, intent(out), optional :: iostat
1845 
1846 ! Append a varying string to the current record of
1847 ! the default unit
1848 
1849  call put(char(string), iostat)
1850 
1851 ! Finish
1852 
1853  end subroutine put_vs
1854 
1855 !****
1856 
1857  subroutine put_ch (string, iostat)
1859  character(LEN=*), intent(in) :: string
1860  integer, intent(out), optional :: iostat
1861 
1862 ! Append a character string to the current record of
1863 ! the default unit
1864 
1865  if(PRESENT(iostat)) then
1866  write(unit=*, fmt="(A)", advance="NO", iostat=iostat) string
1867  else
1868  write(unit=*, fmt="(A)", advance="NO") string
1869  endif
1870 
1871 ! Finish
1872 
1873  end subroutine put_ch
1874 
1875 !****
1876 
1877  subroutine put_unit_vs (unit, string, iostat)
1879  integer, intent(in) :: unit
1880  type(varying_string), intent(in) :: string
1881  integer, intent(out), optional :: iostat
1882 
1883 ! Append a varying string to the current record of
1884 ! the specified unit
1885 
1886  call put(unit, char(string), iostat)
1887 
1888 ! Finish
1889 
1890  return
1891 
1892  end subroutine put_unit_vs
1893 
1894 !****
1895 
1896  subroutine put_unit_ch (unit, string, iostat)
1898  integer, intent(in) :: unit
1899  character(LEN=*), intent(in) :: string
1900  integer, intent(out), optional :: iostat
1901 
1902 ! Append a character string to the current record of
1903 ! the specified unit
1904 
1905  if(PRESENT(iostat)) then
1906  write(unit=unit, fmt="(A)", advance="NO", iostat=iostat) string
1907  else
1908  write(unit=unit, fmt="(A)", advance="NO") string
1909  endif
1910 
1911 ! Finish
1912 
1913  return
1914 
1915  end subroutine put_unit_ch
1916 
1917 !****
1918 
1919  subroutine put_line_vs (string, iostat)
1921  type(varying_string), intent(in) :: string
1922  integer, intent(out), optional :: iostat
1923 
1924 ! Append a varying string to the current record of
1925 ! the default unit, terminating the record
1926 
1927  call put_line(char(string), iostat)
1928 
1929 ! Finish
1930 
1931  return
1932 
1933  end subroutine put_line_vs
1934 
1935 !****
1936 
1937  subroutine put_line_ch (string, iostat)
1939  character(LEN=*), intent(in) :: string
1940  integer, intent(out), optional :: iostat
1941 
1942 ! Append a varying string to the current record of
1943 ! the default unit, terminating the record
1944 
1945  if(PRESENT(iostat)) then
1946  write(unit=*, fmt="(A,/)", advance="NO", iostat=iostat) string
1947  else
1948  write(unit=*, fmt="(A,/)", advance="NO") string
1949  endif
1950 
1951 ! Finish
1952 
1953  return
1954 
1955  end subroutine put_line_ch
1956 
1957 !****
1958 
1959  subroutine put_line_unit_vs (unit, string, iostat)
1961  integer, intent(in) :: unit
1962  type(varying_string), intent(in) :: string
1963  integer, intent(out), optional :: iostat
1964 
1965 ! Append a varying string to the current record of
1966 ! the specified unit, terminating the record
1967 
1968  call put_line(unit, char(string), iostat)
1969 
1970 ! Finish
1971 
1972  return
1973 
1974  end subroutine put_line_unit_vs
1975 
1976 !****
1977 
1978  subroutine put_line_unit_ch (unit, string, iostat)
1980  integer, intent(in) :: unit
1981  character(LEN=*), intent(in) :: string
1982  integer, intent(out), optional :: iostat
1983 
1984 ! Append a varying string to the current record of
1985 ! the specified unit, terminating the record
1986 
1987  if(PRESENT(iostat)) then
1988  write(unit=unit, fmt="(A,/)", advance="NO", iostat=iostat) string
1989  else
1990  write(unit=unit, fmt="(A,/)", advance="NO") string
1991  endif
1992 
1993 ! Finish
1994 
1995  return
1996 
1997  end subroutine put_line_unit_ch
1998 
1999 !****
2000 
2001  elemental function extract_vs (string, start, finish) result (ext_string)
2003  type(varying_string), intent(in) :: string
2004  integer, intent(in), optional :: start
2005  integer, intent(in), optional :: finish
2006  type(varying_string) :: ext_string
2007 
2008 ! Extract a varying substring from a varying string
2009 
2010  ext_string = extract(char(string), start, finish)
2011 
2012 ! Finish
2013 
2014  return
2015 
2016  end function extract_vs
2017 
2018 !****
2019 
2020  elemental function extract_ch (string, start, finish) result (ext_string)
2022  character(LEN=*), intent(in) :: string
2023  integer, intent(in), optional :: start
2024  integer, intent(in), optional :: finish
2025  type(varying_string) :: ext_string
2026 
2027  integer :: start_
2028  integer :: finish_
2029 
2030 ! Extract a varying substring from a character string
2031 
2032  if(PRESENT(start)) then
2033  start_ = max(1, start)
2034  else
2035  start_ = 1
2036  endif
2037 
2038  if(PRESENT(finish)) then
2039  finish_ = min(len(string), finish)
2040  else
2041  finish_ = len(string)
2042  endif
2043 
2044  ext_string = var_str(string(start_:finish_))
2045 
2046 ! Finish
2047 
2048  return
2049 
2050  end function extract_ch
2051 
2052 !****
2053 
2054  elemental function insert_vs_vs (string, start, substring) result (ins_string)
2056  type(varying_string), intent(in) :: string
2057  integer, intent(in) :: start
2058  type(varying_string), intent(in) :: substring
2059  type(varying_string) :: ins_string
2060 
2061 ! Insert a varying substring into a varying string
2062 
2063  ins_string = insert(char(string), start, char(substring))
2064 
2065 ! Finish
2066 
2067  return
2068 
2069  end function insert_vs_vs
2070 
2071 !****
2072 
2073  elemental function insert_ch_vs (string, start, substring) result (ins_string)
2075  character(LEN=*), intent(in) :: string
2076  integer, intent(in) :: start
2077  type(varying_string), intent(in) :: substring
2078  type(varying_string) :: ins_string
2079 
2080 ! Insert a varying substring into a character string
2081 
2082  ins_string = insert(string, start, char(substring))
2083 
2084 ! Finish
2085 
2086  return
2087 
2088  end function insert_ch_vs
2089 
2090 !****
2091 
2092  elemental function insert_vs_ch (string, start, substring) result (ins_string)
2094  type(varying_string), intent(in) :: string
2095  integer, intent(in) :: start
2096  character(LEN=*), intent(in) :: substring
2097  type(varying_string) :: ins_string
2098 
2099 ! Insert a character substring into a varying string
2100 
2101  ins_string = insert(char(string), start, substring)
2102 
2103 ! Finish
2104 
2105  return
2106 
2107  end function insert_vs_ch
2108 
2109 !****
2110 
2111  elemental function insert_ch_ch (string, start, substring) result (ins_string)
2113  character(LEN=*), intent(in) :: string
2114  integer, intent(in) :: start
2115  character(LEN=*), intent(in) :: substring
2116  type(varying_string) :: ins_string
2117 
2118  integer :: start_
2119 
2120 ! Insert a character substring into a character
2121 ! string
2122 
2123  start_ = max(1, min(start, len(string)+1))
2124 
2125  ins_string = var_str(string(:start_-1)//substring//string(start_:))
2126 
2127 ! Finish
2128 
2129  return
2130 
2131  end function insert_ch_ch
2132 
2133 !****
2134 
2135  elemental function remove_vs (string, start, finish) result (rem_string)
2137  type(varying_string), intent(in) :: string
2138  integer, intent(in), optional :: start
2139  integer, intent(in), optional :: finish
2140  TYPE(varying_string) :: rem_string
2141 
2142 ! Remove a substring from a varying string
2143 
2144  rem_string = remove(char(string), start, finish)
2145 
2146 ! Finish
2147 
2148  return
2149 
2150  end function remove_vs
2151 
2152 !****
2153 
2154  elemental function remove_ch (string, start, finish) result (rem_string)
2156  character(LEN=*), intent(in) :: string
2157  integer, intent(in), optional :: start
2158  integer, intent(in), optional :: finish
2159  type(varying_string) :: rem_string
2160 
2161  integer :: start_
2162  integer :: finish_
2163 
2164 ! Remove a substring from a character string
2165 
2166  if(PRESENT(start)) then
2167  start_ = max(1, start)
2168  else
2169  start_ = 1
2170  endif
2171 
2172  if(PRESENT(finish)) then
2173  finish_ = min(len(string), finish)
2174  else
2175  finish_ = len(string)
2176  endif
2177 
2178  if(finish_ >= start_) then
2179  rem_string = var_str(string(:start_-1)//string(finish_+1:))
2180  else
2181  rem_string = string
2182  endif
2183 
2184 ! Finish
2185 
2186  return
2187 
2188  end function remove_ch
2189 
2190 !****
2191 
2192  elemental function replace_vs_vs_auto (string, start, substring) result (rep_string)
2194  type(varying_string), intent(in) :: string
2195  integer, intent(in) :: start
2196  type(varying_string), intent(in) :: substring
2197  type(varying_string) :: rep_string
2198 
2199 ! Replace part of a varying string with a varying
2200 ! substring
2201 
2202  rep_string = replace(char(string), start, max(start, 1)+len(substring)-1, char(substring))
2203 
2204 ! Finish
2205 
2206  return
2207 
2208  end function replace_vs_vs_auto
2209 
2210 !****
2211 
2212  elemental function replace_ch_vs_auto (string, start, substring) result (rep_string)
2214  character(LEN=*), intent(in) :: string
2215  integer, intent(in) :: start
2216  type(varying_string), intent(in) :: substring
2217  type(varying_string) :: rep_string
2218 
2219 ! Replace part of a character string with a varying
2220 ! substring
2221 
2222  rep_string = replace(string, start, max(start, 1)+len(substring)-1, char(substring))
2223 
2224 ! Finish
2225 
2226  return
2227 
2228  end function replace_ch_vs_auto
2229 
2230 !****
2231 
2232  elemental function replace_vs_ch_auto (string, start, substring) result (rep_string)
2234  type(varying_string), intent(in) :: string
2235  integer, intent(in) :: start
2236  character(LEN=*), intent(in) :: substring
2237  type(varying_string) :: rep_string
2238 
2239 ! Replace part of a varying string with a character
2240 ! substring
2241 
2242  rep_string = replace(char(string), start, max(start, 1)+len(substring)-1, substring)
2243 
2244 ! Finish
2245 
2246  return
2247 
2248  end function replace_vs_ch_auto
2249 
2250 !****
2251 
2252  elemental function replace_ch_ch_auto (string, start, substring) result (rep_string)
2254  character(LEN=*), intent(in) :: string
2255  integer, intent(in) :: start
2256  character(LEN=*), intent(in) :: substring
2257  type(varying_string) :: rep_string
2258 
2259 ! Replace part of a character string with a character
2260 ! substring
2261 
2262  rep_string = replace(string, start, max(start, 1)+len(substring)-1, substring)
2263 
2264 ! Finish
2265 
2266  return
2267 
2268  end function replace_ch_ch_auto
2269 
2270 !****
2271 
2272  elemental function replace_vs_vs_fixed (string, start, finish, substring) result (rep_string)
2274  type(varying_string), intent(in) :: string
2275  integer, intent(in) :: start
2276  integer, intent(in) :: finish
2277  type(varying_string), intent(in) :: substring
2278  type(varying_string) :: rep_string
2279 
2280 ! Replace part of a varying string with a varying
2281 ! substring
2282 
2283  rep_string = replace(char(string), start, finish, char(substring))
2284 
2285 ! Finish
2286 
2287  return
2288 
2289  end function replace_vs_vs_fixed
2290 
2291 !****
2292 
2293 !****
2294 
2295  elemental function replace_ch_vs_fixed (string, start, finish, substring) result (rep_string)
2297  character(LEN=*), intent(in) :: string
2298  integer, intent(in) :: start
2299  integer, intent(in) :: finish
2300  type(varying_string), intent(in) :: substring
2301  type(varying_string) :: rep_string
2302 
2303 ! Replace part of a character string with a varying
2304 ! substring
2305 
2306  rep_string = replace(string, start, finish, char(substring))
2307 
2308 ! Finish
2309 
2310  return
2311 
2312  end function replace_ch_vs_fixed
2313 
2314 !****
2315 
2316  elemental function replace_vs_ch_fixed (string, start, finish, substring) result (rep_string)
2318  type(varying_string), intent(in) :: string
2319  integer, intent(in) :: start
2320  integer, intent(in) :: finish
2321  character(LEN=*), intent(in) :: substring
2322  type(varying_string) :: rep_string
2323 
2324 ! Replace part of a varying string with a character
2325 ! substring
2326 
2327  rep_string = replace(char(string), start, finish, substring)
2328 
2329 ! Finish
2330 
2331  return
2332 
2333  end function replace_vs_ch_fixed
2334 
2335 !****
2336 
2337  elemental function replace_ch_ch_fixed (string, start, finish, substring) result (rep_string)
2339  character(LEN=*), intent(in) :: string
2340  integer, intent(in) :: start
2341  integer, intent(in) :: finish
2342  character(LEN=*), intent(in) :: substring
2343  type(varying_string) :: rep_string
2344 
2345  integer :: start_
2346  integer :: finish_
2347 
2348 ! Replace part of a character string with a character
2349 ! substring
2350 
2351  start_ = max(1, start)
2352  finish_ = min(len(string), finish)
2353 
2354  if(finish_ < start_) then
2355  rep_string = insert(string, start_, substring)
2356  else
2357  rep_string = var_str(string(:start_-1)//substring//string(finish_+1:))
2358  endif
2359 
2360 ! Finish
2361 
2362  return
2363 
2364  end function replace_ch_ch_fixed
2365 
2366 !****
2367 
2368  elemental function replace_vs_vs_vs_target (string, target, substring, every, back) result (rep_string)
2370  type(varying_string), intent(in) :: string
2371  type(varying_string), intent(in) :: target
2372  type(varying_string), intent(in) :: substring
2373  logical, intent(in), optional :: every
2374  logical, intent(in), optional :: back
2375  type(varying_string) :: rep_string
2376 
2377 ! Replace part of a varying string with a varying
2378 ! substring, at a location matching a varying-
2379 ! string target
2380 
2381  rep_string = replace(char(string), char(target), char(substring), every, back)
2382 
2383 ! Finish
2384 
2385  return
2386 
2387  end function replace_vs_vs_vs_target
2388 
2389 !****
2390 
2391  elemental function replace_ch_vs_vs_target (string, target, substring, every, back) result (rep_string)
2393  character(LEN=*), intent(in) :: string
2394  type(varying_string), intent(in) :: target
2395  type(varying_string), intent(in) :: substring
2396  logical, intent(in), optional :: every
2397  logical, intent(in), optional :: back
2398  type(varying_string) :: rep_string
2399 
2400 ! Replace part of a character string with a varying
2401 ! substring, at a location matching a varying-
2402 ! string target
2403 
2404  rep_string = replace(string, char(target), char(substring), every, back)
2405 
2406 ! Finish
2407 
2408  return
2409 
2410  end function replace_ch_vs_vs_target
2411 
2412 !****
2413 
2414  elemental function replace_vs_ch_vs_target (string, target, substring, every, back) result (rep_string)
2416  type(varying_string), intent(in) :: string
2417  character(LEN=*), intent(in) :: target
2418  type(varying_string), intent(in) :: substring
2419  logical, intent(in), optional :: every
2420  logical, intent(in), optional :: back
2421  type(varying_string) :: rep_string
2422 
2423 ! Replace part of a character string with a varying
2424 ! substring, at a location matching a character-
2425 ! string target
2426 
2427  rep_string = replace(char(string), target, char(substring), every, back)
2428 
2429 ! Finish
2430 
2431  return
2432 
2433  end function replace_vs_ch_vs_target
2434 
2435 !****
2436 
2437  elemental function replace_ch_ch_vs_target (string, target, substring, every, back) result (rep_string)
2439  character(LEN=*), intent(in) :: string
2440  character(LEN=*), intent(in) :: target
2441  type(varying_string), intent(in) :: substring
2442  logical, intent(in), optional :: every
2443  logical, intent(in), optional :: back
2444  type(varying_string) :: rep_string
2445 
2446 ! Replace part of a character string with a varying
2447 ! substring, at a location matching a character-
2448 ! string target
2449 
2450  rep_string = replace(string, target, char(substring), every, back)
2451 
2452 ! Finish
2453 
2454  return
2455 
2456  end function replace_ch_ch_vs_target
2457 
2458 !****
2459 
2460  elemental function replace_vs_vs_ch_target (string, target, substring, every, back) result (rep_string)
2462  type(varying_string), intent(in) :: string
2463  type(varying_string), intent(in) :: target
2464  character(LEN=*), intent(in) :: substring
2465  logical, intent(in), optional :: every
2466  logical, intent(in), optional :: back
2467  type(varying_string) :: rep_string
2468 
2469 ! Replace part of a varying string with a character
2470 ! substring, at a location matching a varying-
2471 ! string target
2472 
2473  rep_string = replace(char(string), char(target), substring, every, back)
2474 
2475 ! Finish
2476 
2477  return
2478 
2479  end function replace_vs_vs_ch_target
2480 
2481 !****
2482 
2483  elemental function replace_ch_vs_ch_target (string, target, substring, every, back) result (rep_string)
2485  character(LEN=*), intent(in) :: string
2486  type(varying_string), intent(in) :: target
2487  character(LEN=*), intent(in) :: substring
2488  logical, intent(in), optional :: every
2489  logical, intent(in), optional :: back
2490  type(varying_string) :: rep_string
2491 
2492 ! Replace part of a character string with a character
2493 ! substring, at a location matching a varying-
2494 ! string target
2495 
2496  rep_string = replace(string, char(target), substring, every, back)
2497 
2498 ! Finish
2499 
2500  return
2501 
2502  end function replace_ch_vs_ch_target
2503 
2504 !****
2505 
2506  elemental function replace_vs_ch_ch_target (string, target, substring, every, back) result (rep_string)
2508  type(varying_string), intent(in) :: string
2509  character(LEN=*), intent(in) :: target
2510  character(LEN=*), intent(in) :: substring
2511  logical, intent(in), optional :: every
2512  logical, intent(in), optional :: back
2513  type(varying_string) :: rep_string
2514 
2515 ! Replace part of a varying string with a character
2516 ! substring, at a location matching a character-
2517 ! string target
2518 
2519  rep_string = replace(char(string), target, substring, every, back)
2520 
2521 ! Finish
2522 
2523  return
2524 
2525  end function replace_vs_ch_ch_target
2526 
2527 !****
2528 
2529  elemental function replace_ch_ch_ch_target (string, target, substring, every, back) result (rep_string)
2531  character(LEN=*), intent(in) :: string
2532  character(LEN=*), intent(in) :: target
2533  character(LEN=*), intent(in) :: substring
2534  logical, intent(in), optional :: every
2535  logical, intent(in), optional :: back
2536  type(varying_string) :: rep_string
2537 
2538  logical :: every_
2539  logical :: back_
2540  type(varying_string) :: work_string
2541  integer :: length_target
2542  integer :: i_target
2543 
2544 ! Handle special cases when LEN(target) == 0. Such
2545 ! instances are prohibited by the standard, but
2546 ! since this function is elemental, no error can be
2547 ! thrown. Therefore, it makes sense to handle them
2548 ! in a sensible manner
2549 
2550  if(len(target) == 0) then
2551  if(len(string) /= 0) then
2552  rep_string = string
2553  else
2554  rep_string = substring
2555  endif
2556  return
2557  end if
2558 
2559 ! Replace part of a character string with a character
2560 ! substring, at a location matching a character-
2561 ! string target
2562 
2563  if(PRESENT(every)) then
2564  every_ = every
2565  else
2566  every_ = .false.
2567  endif
2568 
2569  if(PRESENT(back)) then
2570  back_ = back
2571  else
2572  back_ = .false.
2573  endif
2574 
2575  rep_string = ""
2576 
2577  work_string = string
2578 
2579  length_target = len(target)
2580 
2581  replace_loop : do
2582 
2583  i_target = index(work_string, target, back_)
2584 
2585  if(i_target == 0) exit replace_loop
2586 
2587  if(back_) then
2588  rep_string = substring//extract(work_string, start=i_target+length_target)//rep_string
2589  work_string = extract(work_string, finish=i_target-1)
2590  else
2591  rep_string = rep_string//extract(work_string, finish=i_target-1)//substring
2592  work_string = extract(work_string, start=i_target+length_target)
2593  endif
2594 
2595  if(.NOT. every_) exit replace_loop
2596 
2597  end do replace_loop
2598 
2599  if(back_) then
2600  rep_string = work_string//rep_string
2601  else
2602  rep_string = rep_string//work_string
2603  endif
2604 
2605 ! Finish
2606 
2607  return
2608 
2609  end function replace_ch_ch_ch_target
2610 
2611 !****
2612 
2613  elemental subroutine split_vs (string, word, set, separator, back)
2615  type(varying_string), intent(inout) :: string
2616  type(varying_string), intent(out) :: word
2617  type(varying_string), intent(in) :: set
2618  type(varying_string), intent(out), optional :: separator
2619  logical, intent(in), optional :: back
2620 
2621 ! Split a varying string into two verying strings
2622 
2623  call split_ch(string, word, char(set), separator, back)
2624 
2625 ! Finish
2626 
2627  return
2628 
2629  end subroutine split_vs
2630 
2631 !****
2632 
2633  elemental subroutine split_ch (string, word, set, separator, back)
2635  type(varying_string), intent(inout) :: string
2636  type(varying_string), intent(out) :: word
2637  character(LEN=*), intent(in) :: set
2638  type(varying_string), intent(out), optional :: separator
2639  logical, intent(in), optional :: back
2640 
2641  logical :: back_
2642  integer :: i_separator
2643 
2644 ! Split a varying string into two verying strings
2645 
2646  if(PRESENT(back)) then
2647  back_ = back
2648  else
2649  back_ = .false.
2650  endif
2651 
2652  i_separator = scan(string, set, back_)
2653 
2654  if(i_separator /= 0) then
2655 
2656  if(back_) then
2657  word = extract(string, start=i_separator+1)
2658  if(PRESENT(separator)) separator = extract(string, start=i_separator, finish=i_separator)
2659  string = extract(string, finish=i_separator-1)
2660  else
2661  word = extract(string, finish=i_separator-1)
2662  if(PRESENT(separator)) separator = extract(string, start=i_separator, finish=i_separator)
2663  string = extract(string, start=i_separator+1)
2664  endif
2665 
2666  else
2667 
2668  word = string
2669  if(PRESENT(separator)) separator = ""
2670  string = ""
2671 
2672  endif
2673 
2674 ! Finish
2675 
2676  return
2677 
2678  end subroutine split_ch
2679 
2680 !****
2681 
2682  elemental subroutine erase_ (string)
2684  type(varying_string), intent(inout) :: string
2685 
2686 ! Get the length of a varying string
2687 
2688  if(ALLOCATED(string%chars)) then
2689  deallocate(string%chars)
2690  endif
2691 
2692 ! Finish
2693 
2694  return
2695 
2696  end subroutine erase_
2697 
2698 END MODULE iso_varying_string
2699 
2700 
elemental logical function, private op_ge_vs_ch(string_a, string_b)
pure character(len=1, kind=c_char) function, dimension(len(string)+1), private c_char_auto(string)
elemental integer function, private scan_vs_vs(string, set, back)
elemental logical function, private op_lt_ch_vs(string_a, string_b)
elemental integer function, private verify_ch_vs(string, set, back)
elemental logical function, private op_le_vs_vs(string_a, string_b)
elemental logical function, private lgt_ch_vs(string_a, string_b)
subroutine, private put_ch(string, iostat)
elemental type(varying_string) function, private extract_ch(string, start, finish)
elemental logical function, private llt_ch_vs(string_a, string_b)
elemental type(varying_string) function, private var_str_(char)
elemental type(varying_string) function, private extract_vs(string, start, finish)
elemental type(varying_string) function, private replace_ch_vs_vs_target(string, target, substring, every, back)
pure character(len=len(string)) function, private char_auto(string)
elemental type(varying_string) function, private replace_vs_vs_auto(string, start, substring)
elemental integer function, private iachar_(c)
subroutine, private put_line_unit_vs(unit, string, iostat)
subroutine, private get_unit_set_ch(unit, string, set, separator, maxlen, iostat)
elemental integer function, private index_vs_vs(string, substring, back)
elemental integer function, private index_vs_ch(string, substring, back)
elemental type(varying_string) function, private replace_ch_vs_ch_target(string, target, substring, every, back)
elemental logical function, private lge_ch_vs(string_a, string_b)
elemental integer function, private ichar_(c)
subroutine, private get_unit_set_vs(unit, string, set, separator, maxlen, iostat)
elemental type(varying_string) function, private replace_vs_vs_fixed(string, start, finish, substring)
elemental logical function, private lle_ch_vs(string_a, string_b)
elemental integer function, private len_trim_(string)
elemental logical function, private lle_vs_ch(string_a, string_b)
elemental integer function, private index_ch_vs(string, substring, back)
This module provides an iso_varying_string module, conformant to the API specified in ISO/IEC 1539-2:...
elemental logical function, private op_eq_vs_ch(string_a, string_b)
subroutine, private put_line_unit_ch(unit, string, iostat)
elemental logical function, private op_ge_ch_vs(string_a, string_b)
elemental integer function, private verify_vs_vs(string, set, back)
elemental type(varying_string) function, private op_concat_vs_ch(string_a, string_b)
subroutine, private put_vs(string, iostat)
elemental logical function, private llt_vs_ch(string_a, string_b)
subroutine, private put_line_ch(string, iostat)
elemental subroutine, private split_vs(string, word, set, separator, back)
elemental integer function, private scan_ch_vs(string, set, back)
elemental type(varying_string) function, private repeat_(string, ncopies)
elemental subroutine, private split_ch(string, word, set, separator, back)
elemental logical function, private op_eq_vs_vs(string_a, string_b)
subroutine, private put_line_vs(string, iostat)
elemental logical function, private op_gt_ch_vs(string_a, string_b)
pure character(len=1, kind=c_char) function, dimension(length+1), private c_char_fixed(string, length)
elemental type(varying_string) function, private op_concat_ch_vs(string_a, string_b)
elemental logical function, private op_ge_vs_vs(string_a, string_b)
elemental integer function, private verify_vs_ch(string, set, back)
elemental type(varying_string) function, private remove_ch(string, start, finish)
subroutine, private put_unit_ch(unit, string, iostat)
elemental type(varying_string) function, private insert_vs_ch(string, start, substring)
subroutine, private get_set_ch(string, set, separator, maxlen, iostat)
elemental type(varying_string) function, private replace_vs_vs_vs_target(string, target, substring, every, back)
elemental type(varying_string) function, private op_concat_vs_int(string, value)
elemental type(varying_string) function, private replace_vs_ch_ch_target(string, target, substring, every, back)
elemental type(varying_string) function, private adjustr_(string)
integer, parameter, private get_buffer_len
elemental type(varying_string) function, private remove_vs(string, start, finish)
elemental logical function, private op_gt_vs_vs(string_a, string_b)
elemental logical function, private op_le_ch_vs(string_a, string_b)
elemental type(varying_string) function, private insert_ch_vs(string, start, substring)
elemental type(varying_string) function, private adjustl_(string)
elemental logical function, private llt_vs_vs(string_a, string_b)
elemental logical function, private op_lt_vs_vs(string_a, string_b)
elemental subroutine, private op_assign_ch_vs(var, exp)
elemental logical function, private op_eq_ch_vs(string_a, string_b)
elemental type(varying_string) function, private replace_ch_vs_fixed(string, start, finish, substring)
elemental type(varying_string) function, private replace_ch_ch_ch_target(string, target, substring, every, back)
pure character(len=length) function, private char_fixed(string, length)
elemental logical function, private lle_vs_vs(string_a, string_b)
elemental logical function, private op_lt_vs_ch(string_a, string_b)
elemental subroutine, private op_assign_vs_ch(var, exp)
elemental subroutine, private erase_(string)
elemental logical function, private op_ne_vs_vs(string_a, string_b)
subroutine, private get_(string, maxlen, iostat)
elemental type(varying_string) function, private replace_vs_ch_vs_target(string, target, substring, every, back)
elemental type(varying_string) function, private replace_ch_ch_auto(string, start, substring)
elemental type(varying_string) function, private insert_vs_vs(string, start, substring)
subroutine, private put_unit_vs(unit, string, iostat)
elemental type(varying_string) function, private replace_ch_ch_vs_target(string, target, substring, every, back)
elemental type(varying_string) function, private replace_vs_ch_auto(string, start, substring)
elemental logical function, private op_ne_vs_ch(string_a, string_b)
elemental integer function, private scan_vs_ch(string, set, back)
elemental logical function, private op_le_vs_ch(string_a, string_b)
elemental type(varying_string) function, private replace_vs_ch_fixed(string, start, finish, substring)
elemental logical function, private op_ne_ch_vs(string_a, string_b)
subroutine, private get_unit(unit, string, maxlen, iostat)
elemental type(varying_string) function, private replace_ch_ch_fixed(string, start, finish, substring)
elemental type(varying_string) function, private replace_ch_vs_auto(string, start, substring)
elemental type(varying_string) function, private trim_(string)
elemental logical function, private lgt_vs_ch(string_a, string_b)
subroutine, private get_set_vs(string, set, separator, maxlen, iostat)
elemental type(varying_string) function, private op_concat_vs_vs(string_a, string_b)
elemental type(varying_string) function, private replace_vs_vs_ch_target(string, target, substring, every, back)
elemental logical function, private lge_vs_ch(string_a, string_b)
elemental logical function, private lgt_vs_vs(string_a, string_b)
elemental logical function, private lge_vs_vs(string_a, string_b)
elemental type(varying_string) function, private insert_ch_ch(string, start, substring)
elemental integer function, private len_(string)
elemental logical function, private op_gt_vs_ch(string_a, string_b)