Main Page | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

ffword.c

Go to the documentation of this file.
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 ffword.c Implements functions for manipulating instances of
00027  * the ffword data type. They are declared along with the data type
00028  * itself in ffword.h.
00029  */
00030 
00031 #include <string.h>
00032 
00033 #include "ffword.h"
00034 
00035 ffint32 ffword_create(const ffchar* source, ffword* target) {
00036   ffint32 err;
00037 
00038   if((err = ffstring_create(source, &target->data))) {
00039     return err;
00040   }
00041 
00042   memset(&target->metadata, 0, sizeof(ffops));
00043 
00044   return 0;
00045 }
00046 
00047 ffint32 ffword_copy(ffword* source, ffword* target) {
00048   ffint32 err;
00049 
00050   if((err = ffstring_copy(&source->data, &target->data))) {
00051     return err;
00052   }
00053 
00054   memcpy(&target->metadata, &source->metadata, sizeof(ffops));
00055 
00056   return 0;
00057 }
00058 
00059 ffint32 ffword_delete(ffword* target) {
00060   ffint32 err;
00061 
00062   if((err = ffstring_delete(&target->data))) {
00063     return err;
00064   }
00065 
00066   return 0;
00067 }
00068 
00069 ffint32 ffword_swap_delete(ffword* source, ffword* target) {
00070   ffint32 err;
00071 
00072   if((err = ffstring_delete(&target->data))) {
00073     return err;
00074   }
00075 
00076   target->data = source->data;
00077   /* Target is now new owner of the data
00078    * so don't do
00079    * ffword_delete(source);
00080    * ALSO don't do
00081    * ffword_finalize(source);
00082    * because ffstring_delete does it already
00083    */
00084 
00085   return 0;
00086 }
00087 
00088 ffint32 ffword_finalize(ffword* target) {
00089   ffstring_decinst();
00090   return 0;
00091 }
00092 

Generated on Thu Jun 2 23:16:59 2005 for FinFlect by  doxygen 1.4.2