00001 /* Part of the culibs project, <http://www.eideticdew.org/culibs/>. 00002 * Copyright (C) 2006--2007 Petter Urkedal <urkedal@nbi.dk> 00003 * 00004 * This program is free software: you can redistribute it and/or modify 00005 * it under the terms of the GNU General Public License as published by 00006 * the Free Software Foundation, either version 3 of the License, or 00007 * (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00016 */ 00017 00018 #ifndef CUEX_FALGO_H 00019 #define CUEX_FALGO_H 00020 00021 #include <cuex/fwd.h> 00022 00023 CU_BEGIN_DECLARATIONS 00024 00025 cuex_t cuex_ftype_apply_n(cuex_t ftype, cu_rank_t n); 00026 00027 cuex_t cuex_ftype_apply_argtuple(cuex_t fn_type, cuex_t arg_tuple); 00028 00029 /*!Makes a tuple suitable as an argument vector using indexed \ref 00030 * cuex_fpvar_t variables in the range from \a index_begin inclusive to \a 00031 * index_end exclusive. The types are taken from \a ftype, which must be a 00032 * chain of \ref CUEX_O2_FARROW of sufficient length, or else this function 00033 * will return \c NULL to indicate the error. If \a result_type_out is non-\c 00034 * NULL, then the result type after \a index_end - \a index_begin application 00035 * of \a fn_type is stored at \c *\a result_type_out. */ 00036 cuex_t cuex_ftype_argtuple(cuex_t ftype, 00037 cu_rank_t index_begin, cu_rank_t index_end, 00038 cuex_t *result_type_out); 00039 00040 /*!A variant of \ref cuex_ftype_argtuple, suitable if a closure argument \a 00041 * carg_type not mentioned in \a ftype is the first argument. The total number 00042 * of components in the tuple is still \a index_end - \a index_begin. */ 00043 cuex_t cuex_ftype_argtuple_carg(cuex_t carg_type, cuex_t ftype, 00044 cu_rank_t index_begin, cu_rank_t index_end, 00045 cuex_t *result_type_out); 00046 00047 00048 /*!Remove universal quantification nodes (\ref CUEX_O2_FORALL) in \a ftype 00049 * and replace the corresponding variables with universally quantified indexed 00050 * (\ref cuex_ivar) variables. Indices range from 0 to exclusive \c *\a 00051 * tparam_cnt_out. */ 00052 cuex_t cuex_ftype_normalise_no_quant(cuex_t ftype, cu_rank_t *tparam_cnt_out); 00053 00054 /*!Compute \ref cuex_ftype_normalise_no_quant and wrap quantification nodes 00055 * around the result. */ 00056 cuex_t cuex_ftype_normalise_outmost_quant(cuex_t ftype, 00057 cu_rank_t *tparam_cnt_out); 00058 00059 CU_END_DECLARATIONS 00060 00061 #endif