Skip to content

Commit

Permalink
Version 1.0.0 release (#25)
Browse files Browse the repository at this point in the history
* Clean documentation
* Add more string usage demos
  • Loading branch information
sethrj authored Dec 8, 2020
1 parent 4661170 commit 516ea55
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 33 deletions.
14 changes: 0 additions & 14 deletions doc/conclusion.rst

This file was deleted.

8 changes: 3 additions & 5 deletions doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -37,7 +36,6 @@ which wrap the C++ library.
conventions.rst
modules.rst
examples.rst
conclusion.rst

.. ***************************************************************************
.. APPENDICES
Expand Down
22 changes: 20 additions & 2 deletions doc/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
============
Expand Down
20 changes: 10 additions & 10 deletions example/vecstr.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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())

Expand Down
2 changes: 0 additions & 2 deletions include/flc_string.i
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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");
Expand Down

0 comments on commit 516ea55

Please sign in to comment.