coan 4.2.4
|
00001 /*************************************************************************** 00002 * Copyright (C) 2007-2011 Mike Kinghan, imk@strudl.org * 00003 * All rights reserved. * 00004 * * 00005 * Originally contributed 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 name 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 "eval_result.h" 00037 #include <stdlib.h> 00038 00039 /* API */ 00040 00048 00051 /* API */ 00052 00053 00055 int_spec_t const int_spec_false = {INT_UNION_INITOR,INT_INT}; 00056 00058 int_spec_t const int_spec_true = {{1},INT_INT}; 00059 00060 void 00061 eval_result_set_value(eval_result_t *result, int_spec_t const * int_spec) 00062 { 00063 result->value = *int_spec; 00064 SET_FLAGS(*result,int_spec->val.ull ? EVAL_TRUE : EVAL_FALSE); 00065 } 00066 00067 void 00068 eval_result_clear(eval_result_t *result) 00069 { 00070 static eval_result_t initor = EVAL_RESULT_INITOR; 00071 if (result) { 00072 if (result->sym_name) { 00073 free(result->sym_name); 00074 result->sym_name = NULL; 00075 } 00076 if (result->sym_def) { 00077 canonical_string_dispose(result->sym_def); 00078 result->sym_def = NULL; 00079 } 00080 if (result->most_resolved) { 00081 canonical_string_dispose(result->most_resolved); 00082 result->most_resolved = NULL; 00083 } 00084 *result = initor; 00085 } 00086 } 00087 00088 bool 00089 eval_result_parsed(eval_result_t *result) 00090 { 00091 return RESOLVED(*result) || KEEP(*result); 00092 } 00093 00094 00095 00096 /* EOF */ 00097