Skip to content

Commit 516ea55

Browse files
authored
Version 1.0.0 release (#25)
* Clean documentation * Add more string usage demos
1 parent 4661170 commit 516ea55

File tree

5 files changed

+33
-33
lines changed

5 files changed

+33
-33
lines changed

doc/conclusion.rst

Lines changed: 0 additions & 14 deletions
This file was deleted.

doc/index.rst

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,9 @@ Flibcpp
1919
\mainmatter
2020
\begin{abstract}
2121

22-
This project uses SWIG-Fortran to expose useful functionality from the C++
23-
standard library to Fortran 2003 application developers. It generates
24-
self-contained Fortran modules with native proxy classes and functions
25-
which wrap the C++ library.
22+
Flibcpp uses SWIG-Fortran to generate native Fortran-2003 interfaces to
23+
efficient and robust algorithms and data containers implemented in the C++
24+
standard library.
2625

2726
.. raw:: latex
2827

@@ -37,7 +36,6 @@ which wrap the C++ library.
3736
conventions.rst
3837
modules.rst
3938
examples.rst
40-
conclusion.rst
4139

4240
.. ***************************************************************************
4341
.. APPENDICES

doc/introduction.rst

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,26 @@
66
Introduction
77
************
88

9-
The purpose of this library is to provide access to efficient and robust
10-
algorithms and data types commonly used in scientific applications.
9+
The Fortran programming language includes many mathematical functions but few
10+
of the generic, high-performance software algorithms and data containers needed
11+
by essentially all modern scientific software. Most Fortran software contains
12+
hand-written code for such algorithms that may be burdensome to maintain and
13+
inflexible, as well as unperformant and erroneous under certain conditions.
14+
15+
Flibcpp is a library for use by application developers that provides native
16+
Fortran interfaces to existing high-quality algorithms and containers
17+
implemented in C++ and available on all modern computer systems.
18+
19+
Flibcpp defines a carefully crafted set of interface files written for the
20+
SWIG-Fortran code generator. These Fortran interfaces generate native Fortran
21+
proxy code that comprises a set of thin wrappers to selected functionality in
22+
the C++ standard library. The resulting code is a set of Fortran modules and
23+
C++ wrappers that expose a concise and well-defined interface that may be built
24+
into and distributed with the application.
25+
26+
The generated modules include functionality for efficient generic sorting and
27+
searching, set operations, random number generation, value mapping, string
28+
manipulation, and dynamically resizing vectors.
1129

1230
Installation
1331
============

example/vecstr.f90

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ program vecstr_example
1313
implicit none
1414
integer :: i
1515
type(VectorString) :: vec
16-
type(String) :: back, front
16+
type(String) :: back, front, temp
1717
character(C_CHAR), dimension(:), pointer :: chars
1818

1919
! Print version information
@@ -36,25 +36,25 @@ program vecstr_example
3636
! Get the final string for modification
3737
back = vec%back_ref()
3838
chars => back%view()
39+
temp = String(back%str())
3940
! Change all characters to exclamation points
4041
chars(:) = '!'
4142
write(STDOUT, *) "The last string is very excited: " // vec%get(vec%size())
4243

43-
44-
! *Copy* back string to front, and add a question mark
44+
! Modify a reference to the front value
4545
front = vec%front_ref()
46-
! XXX: this creates an *alias* rather than assigning values. Revisit
47-
! ownership semantics??
48-
! front = back
49-
call vec%set_ref(1, back)
5046
call front%push_back("?")
47+
48+
! Insert the original 'back' after the first string (make it element #2)
49+
call vec%insert(2, temp%str())
50+
! Inserting the vector invalidates the 'chars' view and back reference.
51+
chars => NULL()
52+
back = vec%back_ref()
53+
write(STDOUT, *) "Inserted the original last string: " // vec%get(2)
5154

5255
! Modify back to be something else.
5356
call back%assign("the end")
5457

55-
! Modifying 'back' invalidates the 'chars' view. Clear it to be safe.
56-
chars => NULL()
57-
5858
write(STDOUT, *) "Modified 'front' string is " // vec%get(1)
5959
write(STDOUT, *) "Modified 'back' string is " // vec%get(vec%size())
6060

include/flc_string.i

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ class string {
6666
public:
6767
// >>> MEMBER FUNCTIONS
6868

69-
// TODO: add more constructors
7069
string();
7170
string(size_type count, value_type ch);
7271
string(const std::string& s);
@@ -92,7 +91,6 @@ class string {
9291
int compare(const string& OTHER);
9392

9493
// >>> EXTENSIONS
95-
// (TODO: add the same erase/insert extensions as std::vector)
9694

9795
%extend {
9896
%fragment("SWIG_check_range");

0 commit comments

Comments
 (0)