From: maier Date: Fri, 21 Sep 2012 13:10:52 +0000 (+0000) Subject: Move everything out of contrib that doesn't belong there X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b5a63f1073b1a15b91ff3748694651053c67aa3f;p=dealii-svn.git Move everything out of contrib that doesn't belong there git-svn-id: https://svn.dealii.org/branches/branch_cmake@26594 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/CMakeLists.txt b/deal.II/CMakeLists.txt index 7884a1291e..e6c7e6c1e8 100644 --- a/deal.II/CMakeLists.txt +++ b/deal.II/CMakeLists.txt @@ -4,7 +4,7 @@ SET(VERSION "8.0.pre") # This is the main CMakeLists.txt file for the deal.II project # # The main purpose of this file is to set all the configuration options and -# then call a lot of modules residing under ./contrib/cmake/*/ that do the +# then call a lot of modules residing under ./cmake/*/ that do the # hard work. # # @@ -250,14 +250,14 @@ SET(CMAKE_INCLUDE_CURRENT_DIR true) SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} - ${CMAKE_SOURCE_DIR}/contrib/cmake/ - ${CMAKE_SOURCE_DIR}/contrib/cmake/modules/ + ${CMAKE_SOURCE_DIR}/cmake/ + ${CMAKE_SOURCE_DIR}/cmake/modules/ ) # # Load all macros: # -FILE(GLOB macro_files "contrib/cmake/macros/*.cmake") +FILE(GLOB macro_files "cmake/macros/*.cmake") FOREACH(file ${macro_files}) MESSAGE(STATUS "Include ${file}") INCLUDE(${file}) @@ -329,7 +329,7 @@ SET( DEAL_II_EXTERNAL_LIBRARIES) # # Run all system checks: # -FILE(GLOB check_files "contrib/cmake/check/*.cmake") +FILE(GLOB check_files "cmake/check/*.cmake") FOREACH(file ${check_files}) MESSAGE(STATUS "Include ${file}") INCLUDE(${file}) @@ -339,7 +339,7 @@ ENDFOREACH() # # Feature configuration: # -FILE(GLOB configure_files "contrib/cmake/configure/configure_*.cmake") +FILE(GLOB configure_files "cmake/configure/configure_*.cmake") # Make sure the configure_*.cmake files are included in alphabetical order # to fullfill some dependencies... LIST(SORT configure_files) @@ -367,7 +367,7 @@ INCLUDE(setup_finalize) # # Build the toolchain and prepare the includes: # -ADD_SUBDIRECTORY(contrib/expand_instantiations) +ADD_SUBDIRECTORY(scripts) ADD_SUBDIRECTORY(include) # @@ -393,8 +393,7 @@ LIST(APPEND DEAL_II_INCLUDE_DIRS # Prepare some directories for installation (include them after # DEAL_II_LIBRARIES and DEAL_II_INCLUDE_DIRS is set) # -ADD_SUBDIRECTORY(contrib/config) +ADD_SUBDIRECTORY(config) ADD_SUBDIRECTORY(doc) ADD_SUBDIRECTORY(examples) -ADD_SUBDIRECTORY(scripts) diff --git a/deal.II/contrib/cmake/check/check_for_compiler_bugs.cmake b/deal.II/cmake/check/check_for_compiler_bugs.cmake similarity index 100% rename from deal.II/contrib/cmake/check/check_for_compiler_bugs.cmake rename to deal.II/cmake/check/check_for_compiler_bugs.cmake diff --git a/deal.II/contrib/cmake/check/check_for_compiler_features.cmake b/deal.II/cmake/check/check_for_compiler_features.cmake similarity index 100% rename from deal.II/contrib/cmake/check/check_for_compiler_features.cmake rename to deal.II/cmake/check/check_for_compiler_features.cmake diff --git a/deal.II/contrib/cmake/check/check_for_cxx_features.cmake b/deal.II/cmake/check/check_for_cxx_features.cmake similarity index 100% rename from deal.II/contrib/cmake/check/check_for_cxx_features.cmake rename to deal.II/cmake/check/check_for_cxx_features.cmake diff --git a/deal.II/contrib/cmake/check/tests/darwin-dynamic-cast/BaseClass.cpp b/deal.II/cmake/check/tests/darwin-dynamic-cast/BaseClass.cpp similarity index 100% rename from deal.II/contrib/cmake/check/tests/darwin-dynamic-cast/BaseClass.cpp rename to deal.II/cmake/check/tests/darwin-dynamic-cast/BaseClass.cpp diff --git a/deal.II/contrib/cmake/check/tests/darwin-dynamic-cast/BaseClass.h b/deal.II/cmake/check/tests/darwin-dynamic-cast/BaseClass.h similarity index 100% rename from deal.II/contrib/cmake/check/tests/darwin-dynamic-cast/BaseClass.h rename to deal.II/cmake/check/tests/darwin-dynamic-cast/BaseClass.h diff --git a/deal.II/contrib/cmake/check/tests/darwin-dynamic-cast/main.cc b/deal.II/cmake/check/tests/darwin-dynamic-cast/main.cc similarity index 100% rename from deal.II/contrib/cmake/check/tests/darwin-dynamic-cast/main.cc rename to deal.II/cmake/check/tests/darwin-dynamic-cast/main.cc diff --git a/deal.II/contrib/cmake/configure/configure_1_mpi.cmake b/deal.II/cmake/configure/configure_1_mpi.cmake similarity index 100% rename from deal.II/contrib/cmake/configure/configure_1_mpi.cmake rename to deal.II/cmake/configure/configure_1_mpi.cmake diff --git a/deal.II/contrib/cmake/configure/configure_1_tbb.cmake b/deal.II/cmake/configure/configure_1_tbb.cmake similarity index 100% rename from deal.II/contrib/cmake/configure/configure_1_tbb.cmake rename to deal.II/cmake/configure/configure_1_tbb.cmake diff --git a/deal.II/contrib/cmake/configure/configure_arpack.cmake b/deal.II/cmake/configure/configure_arpack.cmake similarity index 100% rename from deal.II/contrib/cmake/configure/configure_arpack.cmake rename to deal.II/cmake/configure/configure_arpack.cmake diff --git a/deal.II/contrib/cmake/configure/configure_blas.cmake b/deal.II/cmake/configure/configure_blas.cmake similarity index 100% rename from deal.II/contrib/cmake/configure/configure_blas.cmake rename to deal.II/cmake/configure/configure_blas.cmake diff --git a/deal.II/contrib/cmake/configure/configure_boost.cmake b/deal.II/cmake/configure/configure_boost.cmake similarity index 100% rename from deal.II/contrib/cmake/configure/configure_boost.cmake rename to deal.II/cmake/configure/configure_boost.cmake diff --git a/deal.II/contrib/cmake/configure/configure_doxygen.cmake b/deal.II/cmake/configure/configure_doxygen.cmake similarity index 100% rename from deal.II/contrib/cmake/configure/configure_doxygen.cmake rename to deal.II/cmake/configure/configure_doxygen.cmake diff --git a/deal.II/contrib/cmake/configure/configure_functionparser.cmake b/deal.II/cmake/configure/configure_functionparser.cmake similarity index 100% rename from deal.II/contrib/cmake/configure/configure_functionparser.cmake rename to deal.II/cmake/configure/configure_functionparser.cmake diff --git a/deal.II/contrib/cmake/configure/configure_lapack.cmake b/deal.II/cmake/configure/configure_lapack.cmake similarity index 100% rename from deal.II/contrib/cmake/configure/configure_lapack.cmake rename to deal.II/cmake/configure/configure_lapack.cmake diff --git a/deal.II/contrib/cmake/configure/configure_metis.cmake b/deal.II/cmake/configure/configure_metis.cmake similarity index 100% rename from deal.II/contrib/cmake/configure/configure_metis.cmake rename to deal.II/cmake/configure/configure_metis.cmake diff --git a/deal.II/contrib/cmake/configure/configure_netcdf.cmake b/deal.II/cmake/configure/configure_netcdf.cmake similarity index 100% rename from deal.II/contrib/cmake/configure/configure_netcdf.cmake rename to deal.II/cmake/configure/configure_netcdf.cmake diff --git a/deal.II/contrib/cmake/configure/configure_p4est.cmake b/deal.II/cmake/configure/configure_p4est.cmake similarity index 100% rename from deal.II/contrib/cmake/configure/configure_p4est.cmake rename to deal.II/cmake/configure/configure_p4est.cmake diff --git a/deal.II/contrib/cmake/configure/configure_trilinos.cmake b/deal.II/cmake/configure/configure_trilinos.cmake similarity index 100% rename from deal.II/contrib/cmake/configure/configure_trilinos.cmake rename to deal.II/cmake/configure/configure_trilinos.cmake diff --git a/deal.II/contrib/cmake/configure/configure_umfpack.cmake b/deal.II/cmake/configure/configure_umfpack.cmake similarity index 100% rename from deal.II/contrib/cmake/configure/configure_umfpack.cmake rename to deal.II/cmake/configure/configure_umfpack.cmake diff --git a/deal.II/contrib/cmake/configure/configure_zlib.cmake b/deal.II/cmake/configure/configure_zlib.cmake similarity index 100% rename from deal.II/contrib/cmake/configure/configure_zlib.cmake rename to deal.II/cmake/configure/configure_zlib.cmake diff --git a/deal.II/contrib/cmake/macros/macro_add_flags.cmake b/deal.II/cmake/macros/macro_add_flags.cmake similarity index 100% rename from deal.II/contrib/cmake/macros/macro_add_flags.cmake rename to deal.II/cmake/macros/macro_add_flags.cmake diff --git a/deal.II/contrib/cmake/macros/macro_check_cxx_compiler_bug.cmake b/deal.II/cmake/macros/macro_check_cxx_compiler_bug.cmake similarity index 100% rename from deal.II/contrib/cmake/macros/macro_check_cxx_compiler_bug.cmake rename to deal.II/cmake/macros/macro_check_cxx_compiler_bug.cmake diff --git a/deal.II/contrib/cmake/macros/macro_configure_feature.cmake b/deal.II/cmake/macros/macro_configure_feature.cmake similarity index 100% rename from deal.II/contrib/cmake/macros/macro_configure_feature.cmake rename to deal.II/cmake/macros/macro_configure_feature.cmake diff --git a/deal.II/contrib/cmake/macros/macro_enable_if_supported.cmake b/deal.II/cmake/macros/macro_enable_if_supported.cmake similarity index 100% rename from deal.II/contrib/cmake/macros/macro_enable_if_supported.cmake rename to deal.II/cmake/macros/macro_enable_if_supported.cmake diff --git a/deal.II/contrib/cmake/macros/macro_expand_instantiations.cmake b/deal.II/cmake/macros/macro_expand_instantiations.cmake similarity index 100% rename from deal.II/contrib/cmake/macros/macro_expand_instantiations.cmake rename to deal.II/cmake/macros/macro_expand_instantiations.cmake diff --git a/deal.II/contrib/cmake/macros/macro_get_cxx_source_return_value.cmake b/deal.II/cmake/macros/macro_get_cxx_source_return_value.cmake similarity index 100% rename from deal.II/contrib/cmake/macros/macro_get_cxx_source_return_value.cmake rename to deal.II/cmake/macros/macro_get_cxx_source_return_value.cmake diff --git a/deal.II/contrib/cmake/macros/macro_list_contains.cmake b/deal.II/cmake/macros/macro_list_contains.cmake similarity index 100% rename from deal.II/contrib/cmake/macros/macro_list_contains.cmake rename to deal.II/cmake/macros/macro_list_contains.cmake diff --git a/deal.II/contrib/cmake/macros/macro_set_if_empty.cmake b/deal.II/cmake/macros/macro_set_if_empty.cmake similarity index 100% rename from deal.II/contrib/cmake/macros/macro_set_if_empty.cmake rename to deal.II/cmake/macros/macro_set_if_empty.cmake diff --git a/deal.II/contrib/cmake/macros/macro_strip_flag.cmake b/deal.II/cmake/macros/macro_strip_flag.cmake similarity index 100% rename from deal.II/contrib/cmake/macros/macro_strip_flag.cmake rename to deal.II/cmake/macros/macro_strip_flag.cmake diff --git a/deal.II/contrib/cmake/macros/macro_to_string.cmake b/deal.II/cmake/macros/macro_to_string.cmake similarity index 100% rename from deal.II/contrib/cmake/macros/macro_to_string.cmake rename to deal.II/cmake/macros/macro_to_string.cmake diff --git a/deal.II/contrib/cmake/modules/FindAMD.cmake b/deal.II/cmake/modules/FindAMD.cmake similarity index 100% rename from deal.II/contrib/cmake/modules/FindAMD.cmake rename to deal.II/cmake/modules/FindAMD.cmake diff --git a/deal.II/contrib/cmake/modules/FindARPACK.cmake b/deal.II/cmake/modules/FindARPACK.cmake similarity index 100% rename from deal.II/contrib/cmake/modules/FindARPACK.cmake rename to deal.II/cmake/modules/FindARPACK.cmake diff --git a/deal.II/contrib/cmake/modules/FindMETIS.cmake b/deal.II/cmake/modules/FindMETIS.cmake similarity index 100% rename from deal.II/contrib/cmake/modules/FindMETIS.cmake rename to deal.II/cmake/modules/FindMETIS.cmake diff --git a/deal.II/contrib/cmake/modules/FindNETCDF.cmake b/deal.II/cmake/modules/FindNETCDF.cmake similarity index 100% rename from deal.II/contrib/cmake/modules/FindNETCDF.cmake rename to deal.II/cmake/modules/FindNETCDF.cmake diff --git a/deal.II/contrib/cmake/modules/FindP4EST.cmake b/deal.II/cmake/modules/FindP4EST.cmake similarity index 100% rename from deal.II/contrib/cmake/modules/FindP4EST.cmake rename to deal.II/cmake/modules/FindP4EST.cmake diff --git a/deal.II/contrib/cmake/modules/FindSC.cmake b/deal.II/cmake/modules/FindSC.cmake similarity index 100% rename from deal.II/contrib/cmake/modules/FindSC.cmake rename to deal.II/cmake/modules/FindSC.cmake diff --git a/deal.II/contrib/cmake/modules/FindTBB.cmake b/deal.II/cmake/modules/FindTBB.cmake similarity index 100% rename from deal.II/contrib/cmake/modules/FindTBB.cmake rename to deal.II/cmake/modules/FindTBB.cmake diff --git a/deal.II/contrib/cmake/modules/FindTRILINOS.cmake b/deal.II/cmake/modules/FindTRILINOS.cmake similarity index 100% rename from deal.II/contrib/cmake/modules/FindTRILINOS.cmake rename to deal.II/cmake/modules/FindTRILINOS.cmake diff --git a/deal.II/contrib/cmake/modules/FindUMFPACK.cmake b/deal.II/cmake/modules/FindUMFPACK.cmake similarity index 100% rename from deal.II/contrib/cmake/modules/FindUMFPACK.cmake rename to deal.II/cmake/modules/FindUMFPACK.cmake diff --git a/deal.II/contrib/cmake/setup_cached_variables.cmake b/deal.II/cmake/setup_cached_variables.cmake similarity index 100% rename from deal.II/contrib/cmake/setup_cached_variables.cmake rename to deal.II/cmake/setup_cached_variables.cmake diff --git a/deal.II/contrib/cmake/setup_compiler_flags.cmake b/deal.II/cmake/setup_compiler_flags.cmake similarity index 100% rename from deal.II/contrib/cmake/setup_compiler_flags.cmake rename to deal.II/cmake/setup_compiler_flags.cmake diff --git a/deal.II/contrib/cmake/setup_compiler_flags_gnu.cmake b/deal.II/cmake/setup_compiler_flags_gnu.cmake similarity index 100% rename from deal.II/contrib/cmake/setup_compiler_flags_gnu.cmake rename to deal.II/cmake/setup_compiler_flags_gnu.cmake diff --git a/deal.II/contrib/cmake/setup_compiler_flags_intel.cmake b/deal.II/cmake/setup_compiler_flags_intel.cmake similarity index 100% rename from deal.II/contrib/cmake/setup_compiler_flags_intel.cmake rename to deal.II/cmake/setup_compiler_flags_intel.cmake diff --git a/deal.II/contrib/cmake/setup_deal_ii.cmake b/deal.II/cmake/setup_deal_ii.cmake similarity index 100% rename from deal.II/contrib/cmake/setup_deal_ii.cmake rename to deal.II/cmake/setup_deal_ii.cmake diff --git a/deal.II/contrib/cmake/setup_external_macros.cmake b/deal.II/cmake/setup_external_macros.cmake similarity index 100% rename from deal.II/contrib/cmake/setup_external_macros.cmake rename to deal.II/cmake/setup_external_macros.cmake diff --git a/deal.II/contrib/cmake/setup_finalize.cmake b/deal.II/cmake/setup_finalize.cmake similarity index 100% rename from deal.II/contrib/cmake/setup_finalize.cmake rename to deal.II/cmake/setup_finalize.cmake diff --git a/deal.II/contrib/config/CMakeLists.txt b/deal.II/config/CMakeLists.txt similarity index 100% rename from deal.II/contrib/config/CMakeLists.txt rename to deal.II/config/CMakeLists.txt diff --git a/deal.II/contrib/config/Make.global_options.in b/deal.II/config/Make.global_options.in similarity index 100% rename from deal.II/contrib/config/Make.global_options.in rename to deal.II/config/Make.global_options.in diff --git a/deal.II/contrib/config/Make.rules b/deal.II/config/Make.rules similarity index 100% rename from deal.II/contrib/config/Make.rules rename to deal.II/config/Make.rules diff --git a/deal.II/contrib/config/Version.in b/deal.II/config/Version.in similarity index 100% rename from deal.II/contrib/config/Version.in rename to deal.II/config/Version.in diff --git a/deal.II/contrib/config/deal.IIConfig.cmake.in b/deal.II/config/deal.IIConfig.cmake.in similarity index 100% rename from deal.II/contrib/config/deal.IIConfig.cmake.in rename to deal.II/config/deal.IIConfig.cmake.in diff --git a/deal.II/contrib/config/deal.IIConfigVersion.cmake.in b/deal.II/config/deal.IIConfigVersion.cmake.in similarity index 100% rename from deal.II/contrib/config/deal.IIConfigVersion.cmake.in rename to deal.II/config/deal.IIConfigVersion.cmake.in diff --git a/deal.II/contrib/config/template-arguments.in b/deal.II/config/template-arguments.in similarity index 100% rename from deal.II/contrib/config/template-arguments.in rename to deal.II/config/template-arguments.in diff --git a/deal.II/contrib/expand_instantiations/CMakeLists.txt b/deal.II/contrib/expand_instantiations/CMakeLists.txt deleted file mode 100644 index 079ab20347..0000000000 --- a/deal.II/contrib/expand_instantiations/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ - -ADD_EXECUTABLE(expand_instantiations expand_instantiations.cc) - -IF(DEAL_II_INSTALL_COMPAT_FILES) - # - # Install the expand_instantiations to its old place under common/scripts - # - INSTALL(TARGETS expand_instantiations - RUNTIME - DESTINATION common/scripts - COMPONENT compat_files - ) - -ENDIF() diff --git a/deal.II/contrib/expand_instantiations/expand_instantiations.cc b/deal.II/contrib/expand_instantiations/expand_instantiations.cc deleted file mode 100644 index 8f62d4ed71..0000000000 --- a/deal.II/contrib/expand_instantiations/expand_instantiations.cc +++ /dev/null @@ -1,505 +0,0 @@ -//---------------------------- expand_instantiations.cc ------------------- -// $Id$ -// Version: $Name$ -// -// Copyright (C) 2007, 2008, 2009, 2010, 2011 by the deal.II authors -// -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. -// -//---------------------------- expand_instantiations.cc ------------------- - -// This is the program that we use to generate explicit instantiations for a -// variety of template arguments. It takes two kinds of input files. The first -// is given as arguments on the command line and contains entries of the -// following form: -// -------------------- -// REAL_SCALARS := { double; float; long double } -// COMPLEX_SCALARS := { std::complex; -// std::complex; -// std::complex } -// VECTORS := { Vector; Vector; Vector } -// -------------------- -// -// The input file of this form is typically located in the common/ directory -// and is generated by ./configure to contain the list of vectors etc that -// make sense for the current configuration. For example, the list of VECTORS -// is going to contain PETSc vectors if so configured. -// -// The second intput is read from the command line and consists of a sequence -// of statements of the following form: -// -------------------- -// for (u,v:VECTORS; z:SCALARS) { f(u, z, const v &); } -// -------------------- -// Here, everything between {...} will be copied as many times as there are -// combinations of arguments u,v in the list of substitutions given by -// VECTORS. For each copy, the arguments u,v will be replaced by one of these -// combinations. - -// Author: Wolfgang Bangerth, 2007 - - -#include -#include -#include -#include -#include -#include - -// a map from the keys in the expansion lists to the list itself. For -// instance, the example above will lead to the entry -// expansion_lists[REAL_SCALARS] = (double, float, long double) -// in this map, among others -std::map > expansion_lists; - - - -/* ======================== auxiliary functions ================= */ - - -// replace all occurrences of 'pattern' by 'substitute' in 'in', and -// return the result -std::string -replace_all (const std::string &in, - const std::string &pattern, - const std::string &substitute) -{ - std::string x = in; - while (x.find(pattern) != std::string::npos) - x.replace (x.find(pattern), - pattern.size(), - substitute); - return x; -} - - -// extract from the start of #in the part of the string that ends with one of -// the characters in #delim_list. The extracted part is deleted from #in -// and returned. We skip characters in delim_list if they are preceded -// by a backslash -std::string -get_substring_with_delim (std::string &in, - const std::string &delim_list) -{ - std::string x; - while (in.size() != 0) - { - // stop copying to the result - // if the current character is - // a delimiter, but only if the - // previous character was not a - // backslash - if ((delim_list.find (in[0]) != std::string::npos) - && - !((x.size() > 0) - && - (x[x.size()-1] == '\\'))) - break; - - x += in[0]; - in.erase (0, 1); - } - - return x; -} - - -// delete all whitespace at the beginning of the given argument -void -skip_space (std::string &in) -{ - while ((in.size() != 0) - && - ((in[0] == ' ') || (in[0] == '\t') || (in[0] == '\n'))) - in.erase (0, 1); -} - - -std::string remove_comments (std::string line) -{ - const std::string::size_type double_slash_comment = line.find ("//"); - if (double_slash_comment != std::string::npos) - line.erase (double_slash_comment, std::string::npos); - - const std::string::size_type slash_star_comment_begin = line.find ("/*"); - if (slash_star_comment_begin != std::string::npos) - { - const std::string::size_type slash_star_comment_end = line.find ("*/"); - if (slash_star_comment_end == std::string::npos) - { - std::cerr << "The program can currently only handle /* block */" - << "comments that start and end within the same line." - << std::endl; - std::exit (1); - } - line.erase (slash_star_comment_begin, - slash_star_comment_end - slash_star_comment_begin + 2); - } - - return line; -} - - -// read the whole file specified by the stream given as argument into a string -// for simpler parsing, and return it -std::string read_whole_file (std::istream &in) -{ - std::string whole_file; - while (in) - { - std::string line; - getline (in, line); - - whole_file += remove_comments (line); - whole_file += '\n'; - } - // substitute tabs by spaces, multiple - // spaces by single ones - for (unsigned int i=0; i -split_string_list (const std::string &s, - const char delimiter) -{ - std::string tmp = s; - std::list split_list; - - // split the input list - while (tmp.length() != 0) - { - std::string name; - name = tmp; - - if (name.find(delimiter) != std::string::npos) - { - name.erase (name.find(delimiter), std::string::npos); - tmp.erase (0, tmp.find(delimiter)+1); - } - else - tmp = ""; - - skip_space (name); - - while ((name.size() != 0) && (name[name.length()-1] == ' ')) - name.erase (name.length()-1, 1); - - split_list.push_back (name); - } - - return split_list; -} - - - -// return the given list but without empty entries -std::list -delete_empty_entries (const std::list &list) -{ - std::list return_list; - for (std::list::const_iterator i = list.begin(); - i != list.end(); ++i) - if (*i != "") - return_list.push_back (*i); - - return return_list; -} - - - -// determine whether a given substring at position #pos and length #length in -// the string #text is a real token, i.e. not just part of another word -bool is_real_token (const std::string &text, - const std::string::size_type pos, - const std::string::size_type length) -{ - static const std::string token_chars ("abcdefghijklmnopqrstuvwxyz" - "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "0123456789" - "_"); - if ((pos != 0) && (token_chars.find (text[pos-1]) != std::string::npos)) - return false; - - if ((pos+length < text.size()) && - (token_chars.find (text[pos+length]) != std::string::npos)) - return false; - - return true; -} - - -// substitute all occurrences of #token in #text by #substitute. because a -// replacement token could be a templated class like std::complex and -// because the token to the substituted may be a template argument itself, we -// surround the substitution by a space which shouldn't matter in C++ -std::string substitute_tokens (const std::string &text, - const std::string &token, - const std::string &substitute) -{ - std::string x_text = text; - std::string::size_type pos = 0; - while ((pos = x_text.find(token, pos)) != std::string::npos) - { - if (is_real_token (x_text, pos, token.size())) - { - x_text.replace (pos, token.size(), - std::string(" ")+substitute+std::string(" ")); - pos += substitute.size()+2; - } - else - ++pos; - } - - return x_text; -} - - - -/* ======================== the main functions ================= */ - - -// read and parse the expansion lists like -// REAL_SCALARS := { double; float; long double } -// as specified at the top of the file and store them in -// the global expansion_lists variable -void read_expansion_lists (const std::string &filename) -{ - std::ifstream in (filename.c_str()); - - if (! in) - { - std::cerr << "Instantiation list file can not be read!" - << std::endl; - std::exit (1); - } - - // read the entire file into a string for - // simpler processing. replace end-of-line - // characters by spaces - std::string whole_file = read_whole_file (in); - - // now process entries of the form - // NAME := { class1; class2; ...}. - while (whole_file.size() != 0) - { - const std::string - name = get_substring_with_delim (whole_file, " :"); - - skip_space (whole_file); - if (whole_file.find (":=") != 0) - { - std::cerr << "Invalid entry <" << name << '>' << std::endl; - std::exit (1); - } - whole_file.erase (0, 2); - skip_space (whole_file); - if (whole_file.find ("{") != 0) - { - std::cerr << "Invalid entry <" << name << '>' << std::endl; - std::exit (1); - } - whole_file.erase (0, 1); - skip_space (whole_file); - - std::string - expansion = get_substring_with_delim (whole_file, "}"); - - if (whole_file.find ("}") != 0) - { - std::cerr << "Invalid entry <" << name << '>' << std::endl; - std::exit (1); - } - whole_file.erase (0, 1); - skip_space (whole_file); - - // assign but remove empty entries; - // this may happen if an expansion list - // ends in a semicolon (then we get an - // empty entry at the end), or if there - // are multiple semicolons after each - // other (this may happen if, for - // example, we have "Vector; - // TRILINOS_VECTOR;" and if - // TRILINOS_VECTOR is an empty - // expansion after running ./configure) - expansion_lists[name] - = delete_empty_entries (split_string_list (expansion, ';')); - } -} - - - -// produce all combinations of substitutions of the tokens given in the -// #substitutions list in #text and output it to std::cout -void substitute (const std::string &text, - const std::list > &substitutions) -{ - // do things recursively: if the list of - // substitutions has a single entry, then - // process all of them. otherwise, process - // the first in the list and call the - // function recursively with the rest of - // the substitutions - if (substitutions.size() > 1) - { - // do the first substitution, then call - // function recursively - const std::string name = substitutions.front().first, - pattern = substitutions.front().second; - - const std::list > - rest_of_substitutions (++substitutions.begin(), - substitutions.end()); - - for (std::list::const_iterator - expansion = expansion_lists[pattern].begin(); - expansion != expansion_lists[pattern].end(); - ++expansion) - { - std::string new_text - = substitute_tokens (text, name, *expansion); - - substitute (new_text, rest_of_substitutions); - } - } - else if (substitutions.size() == 1) - { - // do the substitutions - const std::string name = substitutions.front().first, - pattern = substitutions.front().second; - - for (std::list::const_iterator - expansion = expansion_lists[pattern].begin(); - expansion != expansion_lists[pattern].end(); - ++expansion) - std::cout << substitute_tokens (text, name, *expansion) - << std::endl; - } - else - { - std::cout << text - << std::endl; - } -} - - - -// process the list of instantiations given in the form -// -------------------- -// for (u,v:VECTORS; z:SCALARS) { f(u, z, const v &); } -// -------------------- -void process_instantiations () -{ - std::string whole_file = read_whole_file (std::cin); - - // process entries of the form - // for (X:Y; A:B) { INST } - while (whole_file.size() != 0) - { - skip_space (whole_file); - if (whole_file.find ("for") != 0) - { - std::cerr << "Invalid instantiation list: missing 'for'" << std::endl; - std::exit (1); - } - whole_file.erase (0, 3); - skip_space (whole_file); - if (whole_file.find ("(") != 0) - { - std::cerr << "Invalid instantiation list: missing '('" << std::endl; - std::exit (1); - } - whole_file.erase (0, 1); - skip_space (whole_file); - - const std::list - substitutions_list - = split_string_list (get_substring_with_delim (whole_file, - ")"), - ';'); - if (whole_file.find (")") != 0) - { - std::cerr << "Invalid instantiation list: missing ')'" << std::endl; - std::exit (1); - } - whole_file.erase (0, 1); - skip_space (whole_file); - - // process the header - std::list > - substitutions; - - for (std::list::const_iterator - s = substitutions_list.begin(); - s != substitutions_list.end(); ++s) - { - const std::list - names_and_type = split_string_list (*s, ':'); - if (names_and_type.size() != 2) - { - std::cerr << "Invalid instantiation header" << std::endl; - std::exit (1); - } - - const std::list - names = split_string_list (names_and_type.front(), ','); - - for (std::list::const_iterator - x = names.begin(); x != names.end(); ++x) - substitutions.push_back (std::make_pair (*x, - names_and_type.back())); - } - - // now read the part in {...} - skip_space (whole_file); - if (whole_file.find ("{") != 0) - { - std::cerr << "Invalid substitution text" << std::endl; - std::exit (1); - } - whole_file.erase (0, 1); - skip_space (whole_file); - const std::string text_to_substitute - = get_substring_with_delim (whole_file, "}"); - whole_file.erase (0,1); - skip_space (whole_file); - - // now produce the - // substitutions. first replace - // all occurrences of "\{" by - // "{" - substitute (replace_all(replace_all(text_to_substitute, "\\{", "{"), - "\\}", "}"), - substitutions); - } -} - - - -int main (int argc, char **argv) -{ - if (argc < 2) - { - std::cerr << "Usage: " << std::endl - << " expand_instantiations class_list_files < in_file > out_file" - << std::endl; - std::exit (1); - } - - for (int i=1; i