diff --git a/doc/conclusion.rst b/doc/conclusion.rst deleted file mode 100644 index e919cdf..0000000 --- a/doc/conclusion.rst +++ /dev/null @@ -1,14 +0,0 @@ -.. ############################################################################ -.. File : doc/conclusion.rst -.. ############################################################################ - -********** -Conclusion -********** - -TODO - - -.. ############################################################################ -.. end of doc/conclusion.rst -.. ############################################################################ diff --git a/doc/index.rst b/doc/index.rst index 33e3094..4a4ddea 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -19,10 +19,9 @@ Flibcpp \mainmatter \begin{abstract} -This project uses SWIG-Fortran to expose useful functionality from the C++ -standard library to Fortran 2003 application developers. It generates -self-contained Fortran modules with native proxy classes and functions -which wrap the C++ library. +Flibcpp uses SWIG-Fortran to generate native Fortran-2003 interfaces to +efficient and robust algorithms and data containers implemented in the C++ +standard library. .. raw:: latex @@ -37,7 +36,6 @@ which wrap the C++ library. conventions.rst modules.rst examples.rst - conclusion.rst .. *************************************************************************** .. APPENDICES diff --git a/doc/introduction.rst b/doc/introduction.rst index 4e0d160..5e5990c 100644 --- a/doc/introduction.rst +++ b/doc/introduction.rst @@ -6,8 +6,26 @@ Introduction ************ -The purpose of this library is to provide access to efficient and robust -algorithms and data types commonly used in scientific applications. +The Fortran programming language includes many mathematical functions but few +of the generic, high-performance software algorithms and data containers needed +by essentially all modern scientific software. Most Fortran software contains +hand-written code for such algorithms that may be burdensome to maintain and +inflexible, as well as unperformant and erroneous under certain conditions. + +Flibcpp is a library for use by application developers that provides native +Fortran interfaces to existing high-quality algorithms and containers +implemented in C++ and available on all modern computer systems. + +Flibcpp defines a carefully crafted set of interface files written for the +SWIG-Fortran code generator. These Fortran interfaces generate native Fortran +proxy code that comprises a set of thin wrappers to selected functionality in +the C++ standard library. The resulting code is a set of Fortran modules and +C++ wrappers that expose a concise and well-defined interface that may be built +into and distributed with the application. + +The generated modules include functionality for efficient generic sorting and +searching, set operations, random number generation, value mapping, string +manipulation, and dynamically resizing vectors. Installation ============ diff --git a/example/vecstr.f90 b/example/vecstr.f90 index df4a133..eb64e20 100644 --- a/example/vecstr.f90 +++ b/example/vecstr.f90 @@ -13,7 +13,7 @@ program vecstr_example implicit none integer :: i type(VectorString) :: vec - type(String) :: back, front + type(String) :: back, front, temp character(C_CHAR), dimension(:), pointer :: chars ! Print version information @@ -36,25 +36,25 @@ program vecstr_example ! Get the final string for modification back = vec%back_ref() chars => back%view() + temp = String(back%str()) ! Change all characters to exclamation points chars(:) = '!' write(STDOUT, *) "The last string is very excited: " // vec%get(vec%size()) - - ! *Copy* back string to front, and add a question mark + ! Modify a reference to the front value front = vec%front_ref() - ! XXX: this creates an *alias* rather than assigning values. Revisit - ! ownership semantics?? - ! front = back - call vec%set_ref(1, back) call front%push_back("?") + + ! Insert the original 'back' after the first string (make it element #2) + call vec%insert(2, temp%str()) + ! Inserting the vector invalidates the 'chars' view and back reference. + chars => NULL() + back = vec%back_ref() + write(STDOUT, *) "Inserted the original last string: " // vec%get(2) ! Modify back to be something else. call back%assign("the end") - ! Modifying 'back' invalidates the 'chars' view. Clear it to be safe. - chars => NULL() - write(STDOUT, *) "Modified 'front' string is " // vec%get(1) write(STDOUT, *) "Modified 'back' string is " // vec%get(vec%size()) diff --git a/include/flc_string.i b/include/flc_string.i index ba60d18..37443b4 100644 --- a/include/flc_string.i +++ b/include/flc_string.i @@ -66,7 +66,6 @@ class string { public: // >>> MEMBER FUNCTIONS - // TODO: add more constructors string(); string(size_type count, value_type ch); string(const std::string& s); @@ -92,7 +91,6 @@ class string { int compare(const string& OTHER); // >>> EXTENSIONS - // (TODO: add the same erase/insert extensions as std::vector) %extend { %fragment("SWIG_check_range");