coan 4.2.4
|
00001 /*************************************************************************** 00002 * Copyright (C) 2007-2011 Mike Kinghan, imk@strudl.org * 00003 * All rights reserved. * 00004 * * 00005 * Redistribution and use in source and binary forms, with or without * 00006 * modification, are permitted provided that the following conditions * 00007 * are met: * 00008 * * 00009 * Redistributions of source code must retain the above copyright * 00010 * notice, this list of conditions and the following disclaimer. * 00011 * * 00012 * Redistributions in binary form must reproduce the above copyright * 00013 * notice, this list of conditions and the following disclaimer in the * 00014 * documentation and/or other materials provided with the distribution. * 00015 * * 00016 * Neither the name of Symbian Software Ltd. nor the names of its * 00017 * contributors may be used to endorse or promote products derived from * 00018 * this software without specific prior written permission. * 00019 * * 00020 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * 00021 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * 00022 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * 00023 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * 00024 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * 00025 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * 00026 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * 00027 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED * 00028 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,* 00029 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF * 00030 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH * 00031 * DAMAGE. * 00032 * * 00033 **************************************************************************/ 00034 00035 #include "line_select.h" 00036 #include "args.h" 00037 #include "if_control.h" 00038 #include "directives_tally.h" 00039 #include "io.h" 00040 00049 NO_PRIVATE_STATE(line_select); 00050 IMPLEMENT(line_select,ZERO_INITABLE); 00054 /* API */ 00055 00056 bool 00057 dropping_line(void) 00058 { 00059 return INSOURCE && (dead_line() ^ GET_PUBLIC(args,complement)); 00060 } 00061 00062 bool 00063 eligible_line(int cmd_code, int directive) 00064 { 00065 bool verdict = false; 00066 if (((1 << (cmd_code - 1)) & GET_PUBLIC(args,command)->cmd_mask) != 0) { 00067 if (GET_PUBLIC(args,list_only_inactive)) { 00068 verdict = GET_PUBLIC(line_select,dropping_line) && 00069 !is_unconditional_line(); 00070 } else if (GET_PUBLIC(args,list_only_active)) { 00071 verdict = !GET_PUBLIC(line_select,dropping_line) && 00072 is_unconditional_line(); 00073 } else { 00074 verdict = true; 00075 } 00076 if (verdict && cmd_code == CMD_SYMBOLS) { 00077 switch(directive) { 00078 case HASH_IFDEF: 00079 case HASH_IFNDEF: 00080 case HASH_IF: 00081 verdict = GET_PUBLIC(args,list_symbols_in_ifs); 00082 break; 00083 case HASH_DEFINE: 00084 verdict = GET_PUBLIC(args,list_symbols_in_defs); 00085 break; 00086 case HASH_UNDEF: 00087 verdict = GET_PUBLIC(args,list_symbols_in_undefs); 00088 break; 00089 case HASH_INCLUDE: 00090 verdict = GET_PUBLIC(args,list_symbols_in_includes); 00091 break; 00092 default: 00093 ; 00094 } 00095 } 00096 } 00097 return verdict; 00098 } 00099 00100 00101 /* EOF */