coan 4.2.4
|
00001 /*************************************************************************** 00002 * Copyright (C) 2007-2011 Mike Kinghan, imk@strudl.org * 00003 * All rights reserved. * 00004 * * 00005 * Contributed originally by Mike Kinghan, imk@strudl.org * 00006 * * 00007 * Redistribution and use in source and binary forms, with or without * 00008 * modification, are permitted provided that the following conditions * 00009 * are met: * 00010 * * 00011 * Redistributions of source code must retain the above copyright * 00012 * notice, this list of conditions and the following disclaimer. * 00013 * * 00014 * Redistributions in binary form must reproduce the above copyright * 00015 * notice, this list of conditions and the following disclaimer in the * 00016 * documentation and/or other materials provided with the distribution. * 00017 * * 00018 * Neither the arg of Symbian Software Ltd. nor the names of its * 00019 * contributors may be used to endorse or promote products derived from * 00020 * this software without specific prior written permission. * 00021 * * 00022 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * 00023 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * 00024 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * 00025 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * 00026 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * 00027 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * 00028 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * 00029 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED * 00030 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,* 00031 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF * 00032 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH * 00033 * DAMAGE. * 00034 * * 00035 **************************************************************************/ 00036 #include "platform.h" 00037 #include "report.h" 00038 00044 /* API */ 00045 00046 hash_include_h 00047 hash_include_new(char const *arg, size_t arglen) 00048 { 00049 hash_include_h inc_arg; 00050 assert(arg); 00051 assert(arglen); 00052 inc_arg = symbol_new(arg,arglen); 00053 return inc_arg; 00054 } 00055 00056 int 00057 hash_include_compare(hash_include_const_h lhs, void const * rhs, size_t arglen) 00058 { 00059 int cmp; 00060 assert(lhs); 00061 assert(rhs); 00062 if (arglen) { 00063 cmp = STRNICMP(lhs->sym_name,rhs,arglen); 00064 if (!cmp && lhs->sym_name[arglen]) { 00065 cmp = 1; 00066 } 00067 } else { 00068 hash_include_const_h rarg = rhs; 00069 cmp = STRICMP(lhs->sym_name,rarg->sym_name); 00070 } 00071 return cmp; 00072 } 00073 00074 00075 void 00076 hash_include_define(hash_include_h hi, canonical_string_const_h def) 00077 { 00078 assert(hi); 00079 if (hi->sym_def) { 00080 canonical_string_assign(hi->sym_def,def); 00081 } else { 00082 hi->sym_def = canonical_string_copy(def); 00083 } 00084 } 00085 /* EOF */ 00086 00087 00088 00089 00090