00001 /* M R O . C 00002 * BRL-CAD 00003 * 00004 * Copyright (c) 2001-2006 United States Government as represented by 00005 * the U.S. Army Research Laboratory. 00006 * 00007 * This library is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU Lesser General Public License 00009 * as published by the Free Software Foundation; either version 2 of 00010 * the License, or (at your option) any later version. 00011 * 00012 * This library is distributed in the hope that it will be useful, but 00013 * WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 * Library General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU Lesser General Public 00018 * License along with this file; see the file named COPYING for more 00019 * information. 00020 */ 00021 00022 /** \addtogroup mro */ 00023 /*@{*/ 00024 00025 /** @file mro.c 00026 * @brief The Multiply Represented Object package. 00027 * 00028 * 00029 * @author John R. Anderson 00030 * 00031 * @par Source - 00032 * The U. S. Army Research Laboratory 00033 * @n Aberdeen Proving Ground, Maryland 21005-5068 USA 00034 */ 00035 00036 static const char libbu_vls_RCSid[] = "@(#)$Header: /cvsroot/brlcad/brlcad/src/libbu/mro.c,v 14.12 2006/09/03 15:14:07 lbutler Exp $ (BRL)"; 00037 00038 #include "common.h" 00039 00040 00041 00042 #include <stdio.h> 00043 #include <ctype.h> 00044 #ifdef HAVE_STRING_H 00045 #include <string.h> 00046 #else 00047 #include <strings.h> 00048 #endif 00049 #if defined(HAVE_STDARG_H) 00050 /* ANSI C */ 00051 # include <stdarg.h> 00052 #endif 00053 #if !defined(HAVE_STDARG_H) && defined(HAVE_VARARGS_H) 00054 /* VARARGS */ 00055 # include <varargs.h> 00056 #endif 00057 00058 #include "machine.h" 00059 #include "bu.h" 00060 00061 /** 00062 * 00063 */ 00064 void 00065 bu_mro_init( struct bu_mro *mrop ) 00066 { 00067 mrop->magic = BU_MRO_MAGIC; 00068 bu_vls_init( &mrop->string_rep ); 00069 BU_MRO_INVALIDATE( mrop ); 00070 } 00071 00072 00073 /** 00074 * 00075 */ 00076 void 00077 bu_mro_free( struct bu_mro *mrop ) 00078 { 00079 BU_CK_MRO( mrop ); 00080 00081 bu_vls_free( &mrop->string_rep ); 00082 BU_MRO_INVALIDATE( mrop ); 00083 } 00084 00085 00086 /** 00087 * 00088 */ 00089 void 00090 bu_mro_set( struct bu_mro *mrop, const char *string ) 00091 { 00092 BU_CK_MRO( mrop ); 00093 00094 bu_vls_trunc( &mrop->string_rep, 0 ); 00095 bu_vls_strcpy( &mrop->string_rep, string ); 00096 BU_MRO_INVALIDATE( mrop ); 00097 } 00098 00099 00100 /** 00101 * 00102 */ 00103 void 00104 bu_mro_init_with_string( struct bu_mro *mrop, const char *string ) 00105 { 00106 mrop->magic = BU_MRO_MAGIC; 00107 bu_vls_init( &mrop->string_rep ); 00108 bu_vls_strcpy( &mrop->string_rep, string ); 00109 BU_MRO_INVALIDATE( mrop ); 00110 } 00111 00112 /*@}*/ 00113 /* 00114 * Local Variables: 00115 * mode: C 00116 * tab-width: 8 00117 * c-basic-offset: 4 00118 * indent-tabs-mode: t 00119 * End: 00120 * ex: shiftwidth=4 tabstop=8 00121 */