00001 /* 00002 * finflect - Algorithms and tools for inflecting Finnish nouns 00003 * Copyright (C) 2004, 2005 The FinFlect Team 00004 * 00005 * This library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU Lesser General Public 00007 * License as published by the Free Software Foundation; either 00008 * version 2.1 of the License, or (at your option) any later version. 00009 * 00010 * This library is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Lesser General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Lesser General Public 00016 * License along with this library; if not, write to the Free Software 00017 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00018 * 00019 * 00020 * For the complete legal text of the GNU Lesser General Public License, 00021 * see the file LICENSE. For a complete list of authors and copyright 00022 * holders, see the file AUTHORS. 00023 */ 00024 00025 /** 00026 * @file tcrip.h 00027 * A few necessary functions extracted from TCLib by Michael Ahlberg et al. 00028 */ 00029 00030 /* 00031 Copyright (C) 2003 Michael Ahlberg, Måns Rullgård 00032 00033 Permission is hereby granted, free of charge, to any person 00034 obtaining a copy of this software and associated documentation 00035 files (the "Software"), to deal in the Software without 00036 restriction, including without limitation the rights to use, copy, 00037 modify, merge, publish, distribute, sublicense, and/or sell copies 00038 of the Software, and to permit persons to whom the Software is 00039 furnished to do so, subject to the following conditions: 00040 00041 The above copyright notice and this permission notice shall be 00042 included in all copies or substantial portions of the Software. 00043 00044 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00045 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00046 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 00047 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 00048 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 00049 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00050 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 00051 DEALINGS IN THE SOFTWARE. 00052 **/ 00053 00054 #ifndef __TCRIP_H 00055 #define __TCRIP_H 00056 00057 #ifdef __cplusplus 00058 extern "C" { 00059 #endif 00060 00061 #define TCSTREXP_ESCAPE 0x1 00062 #define TCSTREXP_FREE 0x2 00063 #define TCSTREXP_KEEPUNDEF 0x4 00064 00065 /** 00066 * Regex substitution. 00067 * @param str The string to do substitution on 00068 * @param pat The regex 00069 * @param sub The substituent, using ${N} = 0...9 as placeholders for groups 00070 * @param cflags The cflags to pass to regcomp 00071 * @return The new malloc'd string 00072 */ 00073 char* tcregsub(const char *str, const char *pat, const char *sub, int cflags); 00074 00075 /** 00076 * Something evil that tcregsub needs. Don't ask me. 00077 */ 00078 char* tcstrexp(const char *s, const char *sd, const char *ed, char fs, 00079 char *(*lookup)(char *, void *), void *ld, int flags); 00080 00081 #ifdef __cplusplus 00082 } 00083 #endif 00084 #endif 00085