00001 /* Copyright (c) 2011-2013, Take Vos 00002 * All rights reserved. 00003 * 00004 * Redistribution and use in source and binary forms, with or without 00005 * modification, are permitted provided that the following conditions are met: 00006 * 00007 * - Redistributions of source code must retain the above copyright notice, 00008 * this list of conditions and the following disclaimer. 00009 * - Redistributions in binary form must reproduce the above copyright notice, 00010 * this list of conditions and the following disclaimer in the documentation 00011 * and/or other materials provided with the distribution. 00012 * 00013 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00014 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00015 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00016 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 00017 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00018 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00019 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00020 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00021 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00022 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00023 * POSSIBILITY OF SUCH DAMAGE. 00024 */ 00025 #ifndef YA_COUNT_H 00026 #define YA_COUNT_H 00027 00028 #include <yyast/types.h> 00029 00032 #define YA_MAX_NR_FILENAMES 65536 00033 00034 extern ya_position_t ya_previous_position; 00035 extern ya_position_t ya_current_position; 00036 00046 ya_t ya_count(char *s, size_t s_length); 00047 00054 uint32_t ya_get_file_nr(char *filename); 00055 00063 void ya_reposition(char *s, size_t s_length); 00064 00068 ya_t ya_get_filenames(void); 00069 00073 void ya_clear_position(ya_t *node); 00074 00077 #define YY_USER_ACTION { yylval = ya_count(yytext, yyleng); } 00078 00079 #endif