--- sloccount-2.26.orig/xml_count.c +++ sloccount-2.26/xml_count.c @@ -0,0 +1,1929 @@ + +#line 3 "" + +#define YY_INT_ALIGNED short int + +/* A lexical scanner generated by flex */ + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 5 +#define YY_FLEX_SUBMINOR_VERSION 35 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif + +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C headers. */ +#include +#include +#include +#include + +/* end standard C headers. */ + +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have . Non-C99 systems may or may not. */ + +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + +/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, + * if you want the limit (max/min) macros for int types. + */ +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 +#endif + +#include +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + +#endif /* ! C99 */ + +#endif /* ! FLEXINT_H */ + +#ifdef __cplusplus + +/* The "const" storage-class-modifier is valid. */ +#define YY_USE_CONST + +#else /* ! __cplusplus */ + +/* C99 requires __STDC__ to be defined as 1. */ +#if defined (__STDC__) + +#define YY_USE_CONST + +#endif /* defined (__STDC__) */ +#endif /* ! __cplusplus */ + +#ifdef YY_USE_CONST +#define yyconst const +#else +#define yyconst +#endif + +/* Returned upon end-of-file. */ +#define YY_NULL 0 + +/* Promotes a possibly negative, possibly signed char to an unsigned + * integer for use as an array index. If the signed char is negative, + * we want to instead treat it as an 8-bit unsigned char, hence the + * double cast. + */ +#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) + +/* Enter a start condition. This macro really ought to take a parameter, + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ +#define BEGIN (yy_start) = 1 + 2 * + +/* Translate the current start state into a value that can be later handed + * to BEGIN to return to the state. The YYSTATE alias is for lex + * compatibility. + */ +#define YY_START (((yy_start) - 1) / 2) +#define YYSTATE YY_START + +/* Action number for EOF rule of a given start state. */ +#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) + +/* Special action meaning "start processing a new file". */ +#define YY_NEW_FILE yyrestart(yyin ) + +#define YY_END_OF_BUFFER_CHAR 0 + +/* Size of default input buffer. */ +#ifndef YY_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k. + * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. + * Ditto for the __ia64__ case accordingly. + */ +#define YY_BUF_SIZE 32768 +#else +#define YY_BUF_SIZE 16384 +#endif /* __ia64__ */ +#endif + +/* The state buf must be large enough to hold one state per character in the main buffer. + */ +#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) + +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE +typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif + +extern int yyleng; + +extern FILE *yyin, *yyout; + +#define EOB_ACT_CONTINUE_SCAN 0 +#define EOB_ACT_END_OF_FILE 1 +#define EOB_ACT_LAST_MATCH 2 + + #define YY_LESS_LINENO(n) + +/* Return all but the first "n" matched characters back to the input stream. */ +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + *yy_cp = (yy_hold_char); \ + YY_RESTORE_YY_MORE_OFFSET \ + (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) + +#define unput(c) yyunput( c, (yytext_ptr) ) + +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif + +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE +struct yy_buffer_state + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + yy_size_t yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; + +#define YY_BUFFER_NEW 0 +#define YY_BUFFER_NORMAL 1 + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. + */ +#define YY_BUFFER_EOF_PENDING 2 + + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +/* Stack of input buffers. */ +static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ +static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ +static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ + +/* We provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general + * "scanner state". + * + * Returns the top of the stack, or NULL. + */ +#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ + ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ + : NULL) + +/* Same as previous macro, but useful when we know that the buffer stack is not + * NULL or when we need an lvalue. For internal use only. + */ +#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] + +/* yy_hold_char holds the character lost when yytext is formed. */ +static char yy_hold_char; +static int yy_n_chars; /* number of characters read into yy_ch_buf */ +int yyleng; + +/* Points to current character in buffer. */ +static char *yy_c_buf_p = (char *) 0; +static int yy_init = 0; /* whether we need to initialize */ +static int yy_start = 0; /* start state number */ + +/* Flag which is used to allow yywrap()'s to do buffer switches + * instead of setting up a fresh yyin. A bit of a hack ... + */ +static int yy_did_buffer_switch_on_eof; + +void yyrestart (FILE *input_file ); +void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); +YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ); +void yy_delete_buffer (YY_BUFFER_STATE b ); +void yy_flush_buffer (YY_BUFFER_STATE b ); +void yypush_buffer_state (YY_BUFFER_STATE new_buffer ); +void yypop_buffer_state (void ); + +static void yyensure_buffer_stack (void ); +static void yy_load_buffer_state (void ); +static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); + +#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ) + +YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); +YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); +YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ); + +void *yyalloc (yy_size_t ); +void *yyrealloc (void *,yy_size_t ); +void yyfree (void * ); + +#define yy_new_buffer yy_create_buffer + +#define yy_set_interactive(is_interactive) \ + { \ + if ( ! YY_CURRENT_BUFFER ){ \ + yyensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer(yyin,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ + } + +#define yy_set_bol(at_bol) \ + { \ + if ( ! YY_CURRENT_BUFFER ){\ + yyensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer(yyin,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ + } + +#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) + +/* Begin user sect3 */ + +#define yywrap(n) 1 +#define YY_SKIP_YYWRAP + +typedef unsigned char YY_CHAR; + +FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; + +typedef int yy_state_type; + +extern int yylineno; + +int yylineno = 1; + +extern char *yytext; +#define yytext_ptr yytext +static yyconst flex_int16_t yy_nxt[][10] = + { + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + }, + + { + 7, 8, 9, 10, 8, 11, 12, 8, 13, 8 + }, + + { + 7, 8, 9, 10, 8, 11, 12, 8, 13, 8 + }, + + { + 7, 14, 14, 15, 14, 14, 14, 16, 14, 14 + }, + + { + 7, 14, 14, 15, 14, 14, 14, 16, 14, 14 + }, + + { + 7, 17, 17, 18, 17, 19, 17, 17, 17, 17 + }, + + { + 7, 17, 17, 18, 17, 19, 17, 17, 17, 17 + }, + + { + -7, -7, -7, -7, -7, -7, -7, -7, -7, -7 + }, + + { + 7, 20, 20, -8, 20, -8, 20, 20, -8, 20 + }, + + { + 7, -9, -9, -9, -9, -9, -9, -9, -9, -9 + + }, + + { + 7, -10, -10, -10, -10, -10, -10, -10, -10, -10 + }, + + { + 7, -11, -11, -11, -11, -11, -11, -11, -11, -11 + }, + + { + 7, -12, -12, -12, -12, -12, -12, -12, -12, -12 + }, + + { + 7, -13, -13, -13, 21, -13, -13, -13, -13, -13 + }, + + { + 7, -14, -14, -14, -14, -14, -14, -14, -14, -14 + }, + + { + 7, -15, -15, -15, -15, -15, -15, -15, -15, -15 + }, + + { + 7, -16, -16, -16, -16, -16, -16, 22, -16, -16 + }, + + { + 7, 23, 23, -17, 23, -17, 23, 23, 23, 23 + }, + + { + 7, -18, -18, -18, -18, -18, -18, -18, -18, -18 + }, + + { + 7, -19, -19, -19, -19, -19, -19, -19, -19, -19 + + }, + + { + 7, 20, 20, -20, 20, -20, 20, 20, -20, 20 + }, + + { + 7, -21, -21, -21, -21, -21, -21, 24, -21, -21 + }, + + { + 7, -22, -22, -22, -22, -22, -22, -22, -22, 25 + }, + + { + 7, 23, 23, -23, 23, -23, 23, 23, 23, 23 + }, + + { + 7, -24, -24, -24, -24, -24, -24, 26, -24, -24 + }, + + { + 7, -25, -25, -25, -25, -25, -25, -25, -25, -25 + }, + + { + 7, -26, -26, -26, -26, -26, -26, -26, -26, -26 + }, + + } ; + +static yy_state_type yy_get_previous_state (void ); +static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); +static int yy_get_next_buffer (void ); +static void yy_fatal_error (yyconst char msg[] ); + +/* Done after the current pattern has been matched and before the + * corresponding action - sets up yytext. + */ +#define YY_DO_BEFORE_ACTION \ + (yytext_ptr) = yy_bp; \ + yyleng = (size_t) (yy_cp - yy_bp); \ + (yy_hold_char) = *yy_cp; \ + *yy_cp = '\0'; \ + (yy_c_buf_p) = yy_cp; + +#define YY_NUM_RULES 13 +#define YY_END_OF_BUFFER 14 +/* This struct is not used in this scanner, + but its presence is necessary. */ +struct yy_trans_info + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +static yyconst flex_int16_t yy_accept[27] = + { 0, + 0, 0, 0, 0, 0, 0, 14, 5, 1, 3, + 4, 6, 6, 9, 8, 9, 10, 11, 12, 5, + 0, 0, 10, 0, 7, 2 + } ; + +static yyconst flex_int32_t yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 4, 5, 1, 1, 1, 1, 1, 6, + 1, 1, 1, 1, 7, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, + 1, 9, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1 + } ; + +static yy_state_type yy_last_accepting_state; +static char *yy_last_accepting_cpos; + +extern int yy_flex_debug; +int yy_flex_debug = 0; + +/* The intent behind this definition is that it'll catch + * any uses of REJECT which flex missed. + */ +#define REJECT reject_used_but_not_detected +#define yymore() yymore_used_but_not_detected +#define YY_MORE_ADJ 0 +#define YY_RESTORE_YY_MORE_OFFSET +char *yytext; +#line 1 "xml_count.l" +#line 2 "xml_count.l" + +/* +This is part of SLOCCount, a toolsuite that counts source lines of code (SLOC). +Copyright (C) 2001-2004 David A. Wheeler, Bob Brown and Elie De Brauwer +This is based on Bob Browns jsp_count.l, which was based on David A. Wheeler's +pascal_count.l. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +To contact David A. Wheeler, see his website at: + http://www.dwheeler.com. +*/ + +#include "driver.h" + +#define YY_NO_UNPUT + +/* 1 if we saw a non-comment, non-whitespace char on this line */ +int saw_char = 0; +static void count(void); + + + +#line 587 "" + +#define INITIAL 0 +#define chtml 1 +#define string 2 + +#ifndef YY_NO_UNISTD_H +/* Special case for "unistd.h", since it is non-ANSI. We include it way + * down here because we want the user's section 1 to have been scanned first. + * The user has a chance to override it with an option. + */ +#include +#endif + +#ifndef YY_EXTRA_TYPE +#define YY_EXTRA_TYPE void * +#endif + +static int yy_init_globals (void ); + +/* Accessor methods to globals. + These are made visible to non-reentrant scanners for convenience. */ + +int yylex_destroy (void ); + +int yyget_debug (void ); + +void yyset_debug (int debug_flag ); + +YY_EXTRA_TYPE yyget_extra (void ); + +void yyset_extra (YY_EXTRA_TYPE user_defined ); + +FILE *yyget_in (void ); + +void yyset_in (FILE * in_str ); + +FILE *yyget_out (void ); + +void yyset_out (FILE * out_str ); + +int yyget_leng (void ); + +char *yyget_text (void ); + +int yyget_lineno (void ); + +void yyset_lineno (int line_number ); + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int yywrap (void ); +#else +extern int yywrap (void ); +#endif +#endif + + static void yyunput (int c,char *buf_ptr ); + +#ifndef yytext_ptr +static void yy_flex_strncpy (char *,yyconst char *,int ); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * ); +#endif + +#ifndef YY_NO_INPUT + +#ifdef __cplusplus +static int yyinput (void ); +#else +static int input (void ); +#endif + +#endif + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k */ +#define YY_READ_BUF_SIZE 16384 +#else +#define YY_READ_BUF_SIZE 8192 +#endif /* __ia64__ */ +#endif + +/* Copy whatever the last rule matched to the standard output. */ +#ifndef ECHO +/* This used to be an fputs(), but since the string might contain NUL's, + * we now use fwrite(). + */ +#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) +#endif + +/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, + * is returned in "result". + */ +#ifndef YY_INPUT +#define YY_INPUT(buf,result,max_size) \ + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ + { \ + int c = '*'; \ + size_t n; \ + for ( n = 0; n < max_size && \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else \ + { \ + errno=0; \ + while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(yyin); \ + } \ + }\ +\ + +#endif + +/* No semi-colon after return; correct usage is to write "yyterminate();" - + * we don't want an extra ';' after the "return" because that will cause + * some compilers to complain about unreachable statements. + */ +#ifndef yyterminate +#define yyterminate() return YY_NULL +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Report a fatal error. */ +#ifndef YY_FATAL_ERROR +#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) +#endif + +/* end tables serialization structures and prototypes */ + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL_IS_OURS 1 + +extern int yylex (void); + +#define YY_DECL int yylex (void) +#endif /* !YY_DECL */ + +/* Code executed at the beginning of each rule, after yytext and yyleng + * have been set up. + */ +#ifndef YY_USER_ACTION +#define YY_USER_ACTION +#endif + +/* Code executed at the end of each rule. */ +#ifndef YY_BREAK +#define YY_BREAK break; +#endif + +#define YY_RULE_SETUP \ + YY_USER_ACTION + +/** The main scanner function which does all the work. + */ +YY_DECL +{ + register yy_state_type yy_current_state; + register char *yy_cp, *yy_bp; + register int yy_act; + +#line 44 "xml_count.l" + + line_number = 1; + saw_char = 0; + BEGIN(INITIAL); + +#line 782 "" + + if ( !(yy_init) ) + { + (yy_init) = 1; + +#ifdef YY_USER_INIT + YY_USER_INIT; +#endif + + if ( ! (yy_start) ) + (yy_start) = 1; /* first start state */ + + if ( ! yyin ) + yyin = stdin; + + if ( ! yyout ) + yyout = stdout; + + if ( ! YY_CURRENT_BUFFER ) { + yyensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer(yyin,YY_BUF_SIZE ); + } + + yy_load_buffer_state( ); + } + + while ( 1 ) /* loops until end-of-file is reached */ + { + yy_cp = (yy_c_buf_p); + + /* Support of yytext. */ + *yy_cp = (yy_hold_char); + + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; + + yy_current_state = (yy_start); +yy_match: + while ( (yy_current_state = yy_nxt[yy_current_state][ yy_ec[YY_SC_TO_UI(*yy_cp)] ]) > 0 ) + { + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + + ++yy_cp; + } + + yy_current_state = -yy_current_state; + +yy_find_action: + yy_act = yy_accept[yy_current_state]; + + YY_DO_BEFORE_ACTION; + +do_action: /* This label is used only to access EOF actions. */ + + switch ( yy_act ) + { /* beginning of action switch */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = (yy_hold_char); + yy_cp = (yy_last_accepting_cpos) + 1; + yy_current_state = (yy_last_accepting_state); + goto yy_find_action; + +case 1: +YY_RULE_SETUP +#line 49 "xml_count.l" +/* Do nothing */ + YY_BREAK +case 2: +YY_RULE_SETUP +#line 50 "xml_count.l" +{ BEGIN(chtml); } + YY_BREAK +case 3: +/* rule 3 can match eol */ +YY_RULE_SETUP +#line 51 "xml_count.l" +{ count(); } + YY_BREAK +case 4: +YY_RULE_SETUP +#line 53 "xml_count.l" +{saw_char = 1; BEGIN(string);} + YY_BREAK +case 5: +YY_RULE_SETUP +#line 55 "xml_count.l" +{saw_char = 1;} + YY_BREAK +case 6: +YY_RULE_SETUP +#line 56 "xml_count.l" +{saw_char = 1;} + YY_BREAK +case 7: +YY_RULE_SETUP +#line 59 "xml_count.l" +{ BEGIN(INITIAL); } + YY_BREAK +case 8: +/* rule 8 can match eol */ +YY_RULE_SETUP +#line 60 "xml_count.l" +{ count(); } + YY_BREAK +case 9: +YY_RULE_SETUP +#line 61 "xml_count.l" +/* no-op */ + YY_BREAK +case 10: +YY_RULE_SETUP +#line 63 "xml_count.l" +{saw_char = 1;} + YY_BREAK +case 11: +/* rule 11 can match eol */ +YY_RULE_SETUP +#line 64 "xml_count.l" +{ + fprintf(stderr, "Warning: newline in string - file %s, line %ld\n", + filename, line_number); + count(); + BEGIN(INITIAL); /* Switch back; this at least limits damage */ + } + YY_BREAK +case 12: +YY_RULE_SETUP +#line 70 "xml_count.l" +{ BEGIN(INITIAL);} + YY_BREAK +case 13: +YY_RULE_SETUP +#line 72 "xml_count.l" +ECHO; + YY_BREAK +#line 926 "" +case YY_STATE_EOF(INITIAL): +case YY_STATE_EOF(chtml): +case YY_STATE_EOF(string): + yyterminate(); + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = (yy_hold_char); + YY_RESTORE_YY_MORE_OFFSET + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed yyin at a new source and called + * yylex(). If so, then we have to assure + * consistency between YY_CURRENT_BUFFER and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state ); + + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++(yy_c_buf_p); + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { + yy_cp = (yy_c_buf_p); + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_END_OF_FILE: + { + (yy_did_buffer_switch_on_eof) = 0; + + if ( yywrap( ) ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = + (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + (yy_c_buf_p) = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ +} /* end of yylex */ + +/* yy_get_next_buffer - try to read in a new buffer + * + * Returns a code representing an action: + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ +static int yy_get_next_buffer (void) +{ + register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + register char *source = (yytext_ptr); + register int number_to_move, i; + int ret_val; + + if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; + + else + { + int num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ + + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = YY_CURRENT_BUFFER; + + int yy_c_buf_p_offset = + (int) ((yy_c_buf_p) - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { + int new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = 0; + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + + (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; + + num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - + number_to_move - 1; + + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), + (yy_n_chars), (size_t) num_to_read ); + + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + if ( (yy_n_chars) == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + yyrestart(yyin ); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + /* Extend the array by 50%, plus the number we really need. */ + yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); + if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + } + + (yy_n_chars) += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; + + (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + + return ret_val; +} + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + + static yy_state_type yy_get_previous_state (void) +{ + register yy_state_type yy_current_state; + register char *yy_cp; + + yy_current_state = (yy_start); + + for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) + { + yy_current_state = yy_nxt[yy_current_state][(*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1)]; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + } + + return yy_current_state; +} + +/* yy_try_NUL_trans - try to make a transition on the NUL character + * + * synopsis + * next_state = yy_try_NUL_trans( current_state ); + */ + static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) +{ + register int yy_is_jam; + register char *yy_cp = (yy_c_buf_p); + + yy_current_state = yy_nxt[yy_current_state][1]; + yy_is_jam = (yy_current_state <= 0); + + if ( ! yy_is_jam ) + { + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + } + + return yy_is_jam ? 0 : yy_current_state; +} + + static void yyunput (int c, register char * yy_bp ) +{ + register char *yy_cp; + + yy_cp = (yy_c_buf_p); + + /* undo effects of setting up yytext */ + *yy_cp = (yy_hold_char); + + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + { /* need to shift things up to make room */ + /* +2 for EOB chars. */ + register int number_to_move = (yy_n_chars) + 2; + register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; + register char *source = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; + + while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + *--dest = *--source; + + yy_cp += (int) (dest - source); + yy_bp += (int) (dest - source); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; + + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } + + *--yy_cp = (char) c; + + (yytext_ptr) = yy_bp; + (yy_hold_char) = *yy_cp; + (yy_c_buf_p) = yy_cp; +} + +#ifndef YY_NO_INPUT +#ifdef __cplusplus + static int yyinput (void) +#else + static int input (void) +#endif + +{ + int c; + + *(yy_c_buf_p) = (yy_hold_char); + + if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + /* This was really a NUL. */ + *(yy_c_buf_p) = '\0'; + + else + { /* need more input */ + int offset = (yy_c_buf_p) - (yytext_ptr); + ++(yy_c_buf_p); + + switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + yyrestart(yyin ); + + /*FALLTHROUGH*/ + + case EOB_ACT_END_OF_FILE: + { + if ( yywrap( ) ) + return EOF; + + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; +#ifdef __cplusplus + return yyinput(); +#else + return input(); +#endif + } + + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = (yytext_ptr) + offset; + break; + } + } + } + + c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ + *(yy_c_buf_p) = '\0'; /* preserve yytext */ + (yy_hold_char) = *++(yy_c_buf_p); + + return c; +} +#endif /* ifndef YY_NO_INPUT */ + +/** Immediately switch to a different input stream. + * @param input_file A readable stream. + * + * @note This function does not reset the start condition to @c INITIAL . + */ + void yyrestart (FILE * input_file ) +{ + + if ( ! YY_CURRENT_BUFFER ){ + yyensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer(yyin,YY_BUF_SIZE ); + } + + yy_init_buffer(YY_CURRENT_BUFFER,input_file ); + yy_load_buffer_state( ); +} + +/** Switch to a different input buffer. + * @param new_buffer The new input buffer. + * + */ + void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) +{ + + /* TODO. We should be able to replace this entire function body + * with + * yypop_buffer_state(); + * yypush_buffer_state(new_buffer); + */ + yyensure_buffer_stack (); + if ( YY_CURRENT_BUFFER == new_buffer ) + return; + + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + YY_CURRENT_BUFFER_LVALUE = new_buffer; + yy_load_buffer_state( ); + + /* We don't actually know whether we did this switch during + * EOF (yywrap()) processing, but the only time this flag + * is looked at is after yywrap() is called, so it's safe + * to go ahead and always set it. + */ + (yy_did_buffer_switch_on_eof) = 1; +} + +static void yy_load_buffer_state (void) +{ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; + yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + (yy_hold_char) = *(yy_c_buf_p); +} + +/** Allocate and initialize an input buffer state. + * @param file A readable stream. + * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. + * + * @return the allocated buffer state. + */ + YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) +{ + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_buf_size = size; + + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_is_our_buffer = 1; + + yy_init_buffer(b,file ); + + return b; +} + +/** Destroy the buffer. + * @param b a buffer created with yy_create_buffer() + * + */ + void yy_delete_buffer (YY_BUFFER_STATE b ) +{ + + if ( ! b ) + return; + + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + yyfree((void *) b->yy_ch_buf ); + + yyfree((void *) b ); +} + +#ifndef __cplusplus +extern int isatty (int ); +#endif /* __cplusplus */ + +/* Initializes or reinitializes a buffer. + * This function is sometimes called more than once on the same buffer, + * such as during a yyrestart() or at EOF. + */ + static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) + +{ + int oerrno = errno; + + yy_flush_buffer(b ); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + + /* If b is the current buffer, then yy_init_buffer was _probably_ + * called from yyrestart() or through yy_get_next_buffer. + * In that case, we don't want to reset the lineno or column. + */ + if (b != YY_CURRENT_BUFFER){ + b->yy_bs_lineno = 1; + b->yy_bs_column = 0; + } + + b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; + + errno = oerrno; +} + +/** Discard all buffered characters. On the next scan, YY_INPUT will be called. + * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. + * + */ + void yy_flush_buffer (YY_BUFFER_STATE b ) +{ + if ( ! b ) + return; + + b->yy_n_chars = 0; + + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + + b->yy_buf_pos = &b->yy_ch_buf[0]; + + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; + + if ( b == YY_CURRENT_BUFFER ) + yy_load_buffer_state( ); +} + +/** Pushes the new state onto the stack. The new state becomes + * the current state. This function will allocate the stack + * if necessary. + * @param new_buffer The new state. + * + */ +void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) +{ + if (new_buffer == NULL) + return; + + yyensure_buffer_stack(); + + /* This block is copied from yy_switch_to_buffer. */ + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + (yy_buffer_stack_top)++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from yy_switch_to_buffer. */ + yy_load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; +} + +/** Removes and deletes the top of the stack, if present. + * The next element becomes the new top. + * + */ +void yypop_buffer_state (void) +{ + if (!YY_CURRENT_BUFFER) + return; + + yy_delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + if ((yy_buffer_stack_top) > 0) + --(yy_buffer_stack_top); + + if (YY_CURRENT_BUFFER) { + yy_load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; + } +} + +/* Allocates the stack if it does not exist. + * Guarantees space for at least one push. + */ +static void yyensure_buffer_stack (void) +{ + int num_to_alloc; + + if (!(yy_buffer_stack)) { + + /* First allocation is just for 2 elements, since we don't know if this + * scanner will even need a stack. We use 2 instead of 1 to avoid an + * immediate realloc on the next call. + */ + num_to_alloc = 1; + (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); + + (yy_buffer_stack_max) = num_to_alloc; + (yy_buffer_stack_top) = 0; + return; + } + + if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ + + /* Increase the buffer to prepare for a possible push. */ + int grow_size = 8 /* arbitrary grow size */; + + num_to_alloc = (yy_buffer_stack_max) + grow_size; + (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc + ((yy_buffer_stack), + num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + + /* zero only the new slots.*/ + memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); + (yy_buffer_stack_max) = num_to_alloc; + } +} + +/** Setup the input buffer state to scan directly from a user-specified character buffer. + * @param base the character buffer + * @param size the size in bytes of the character buffer + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) +{ + YY_BUFFER_STATE b; + + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return 0; + + b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); + + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = 0; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + yy_switch_to_buffer(b ); + + return b; +} + +/** Setup the input buffer state to scan a string. The next call to yylex() will + * scan from a @e copy of @a str. + * @param yystr a NUL-terminated string to scan + * + * @return the newly allocated buffer state object. + * @note If you want to scan bytes that may contain NUL values, then use + * yy_scan_bytes() instead. + */ +YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) +{ + + return yy_scan_bytes(yystr,strlen(yystr) ); +} + +/** Setup the input buffer state to scan the given bytes. The next call to yylex() will + * scan from a @e copy of @a bytes. + * @param yybytes the byte buffer to scan + * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len ) +{ + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + int i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = _yybytes_len + 2; + buf = (char *) yyalloc(n ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + + for ( i = 0; i < _yybytes_len; ++i ) + buf[i] = yybytes[i]; + + buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; + + b = yy_scan_buffer(buf,n ); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); + + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; + + return b; +} + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif + +static void yy_fatal_error (yyconst char* msg ) +{ + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); +} + +/* Redefine yyless() so it works in section 3 code. */ + +#undef yyless +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + yytext[yyleng] = (yy_hold_char); \ + (yy_c_buf_p) = yytext + yyless_macro_arg; \ + (yy_hold_char) = *(yy_c_buf_p); \ + *(yy_c_buf_p) = '\0'; \ + yyleng = yyless_macro_arg; \ + } \ + while ( 0 ) + +/* Accessor methods (get/set functions) to struct members. */ + +/** Get the current line number. + * + */ +int yyget_lineno (void) +{ + + return yylineno; +} + +/** Get the input stream. + * + */ +FILE *yyget_in (void) +{ + return yyin; +} + +/** Get the output stream. + * + */ +FILE *yyget_out (void) +{ + return yyout; +} + +/** Get the length of the current token. + * + */ +int yyget_leng (void) +{ + return yyleng; +} + +/** Get the current token. + * + */ + +char *yyget_text (void) +{ + return yytext; +} + +/** Set the current line number. + * @param line_number + * + */ +void yyset_lineno (int line_number ) +{ + + yylineno = line_number; +} + +/** Set the input stream. This does not discard the current + * input buffer. + * @param in_str A readable stream. + * + * @see yy_switch_to_buffer + */ +void yyset_in (FILE * in_str ) +{ + yyin = in_str ; +} + +void yyset_out (FILE * out_str ) +{ + yyout = out_str ; +} + +int yyget_debug (void) +{ + return yy_flex_debug; +} + +void yyset_debug (int bdebug ) +{ + yy_flex_debug = bdebug ; +} + +static int yy_init_globals (void) +{ + /* Initialization is the same as for the non-reentrant scanner. + * This function is called from yylex_destroy(), so don't allocate here. + */ + + (yy_buffer_stack) = 0; + (yy_buffer_stack_top) = 0; + (yy_buffer_stack_max) = 0; + (yy_c_buf_p) = (char *) 0; + (yy_init) = 0; + (yy_start) = 0; + +/* Defined in main.c */ +#ifdef YY_STDINIT + yyin = stdin; + yyout = stdout; +#else + yyin = (FILE *) 0; + yyout = (FILE *) 0; +#endif + + /* For future reference: Set errno on error, since we are called by + * yylex_init() + */ + return 0; +} + +/* yylex_destroy is for both reentrant and non-reentrant scanners. */ +int yylex_destroy (void) +{ + + /* Pop the buffer stack, destroying each element. */ + while(YY_CURRENT_BUFFER){ + yy_delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + yypop_buffer_state(); + } + + /* Destroy the stack itself. */ + yyfree((yy_buffer_stack) ); + (yy_buffer_stack) = NULL; + + /* Reset the globals. This is important in a non-reentrant scanner so the next time + * yylex() is called, initialization will occur. */ + yy_init_globals( ); + + return 0; +} + +/* + * Internal utility routines. + */ + +#ifndef yytext_ptr +static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) +{ + register int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; +} +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * s ) +{ + register int n; + for ( n = 0; s[n]; ++n ) + ; + + return n; +} +#endif + +void *yyalloc (yy_size_t size ) +{ + return (void *) malloc( size ); +} + +void *yyrealloc (void * ptr, yy_size_t size ) +{ + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return (void *) realloc( (char *) ptr, size ); +} + +void yyfree (void * ptr ) +{ + free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ +} + +#define YYTABLES_NAME "yytables" + +#line 72 "xml_count.l" + + + +#include "driver.c" + +static void count(void) +{ + if ( saw_char ) { + sloc++; + saw_char = 0; + } + line_number++; +} + --- sloccount-2.26.orig/debian/compat +++ sloccount-2.26/debian/compat @@ -0,0 +1 @@ +5 --- sloccount-2.26.orig/debian/README.source +++ sloccount-2.26/debian/README.source @@ -0,0 +1,4 @@ +This package uses dpatch to handle patches against upstream source code; you +can find additional information about dpatch at + + /usr/share/doc/dpatch/ --- sloccount-2.26.orig/debian/rules +++ sloccount-2.26/debian/rules @@ -0,0 +1,124 @@ +#!/usr/bin/make -f +# GNU copyright 1997 to 1999 by Joey Hess. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +include /usr/share/dpatch/dpatch.make + +LINKMANPAGES= \ + break_filelist \ + compute_all \ + compute_sloc_lang \ + count_extensions \ + count_unknown_ext \ + get_sloc \ + get_sloc_details \ + jsp_count \ + lexcount1 \ + make_filelists \ + pascal_count \ + print_sum \ + show_filecount \ + vhdl_count \ + xml_count + +LINKMANPAGES_X = \ + asm_count \ + c_count \ + cobol_count \ + f90_count \ + fortran_count \ + haskell_count \ + java_count \ + lex_count \ + ml_count \ + modula3_count \ + objc_count \ + perl_count \ + php_count \ + python_count \ + sql_count + +# These ones will use generic_count.1 +LINKMANPAGES_GC= \ + ada_count \ + awk_count \ + csh_count \ + erlang_count \ + exp_count \ + lisp_count \ + makefile_count \ + ruby_count \ + sed_count \ + sh_count \ + tcl_count + +build: build-stamp +build-stamp: patch-stamp + dh_testdir + + # Add here commands to compile the package. + $(MAKE) + + touch build-stamp + +clean: unpatch + dh_testdir + dh_testroot + rm -f build-stamp + + # Add here commands to clean up after the build process. + [ ! -f Makefile ] || $(MAKE) clean + + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs usr/bin + + # Add here commands to install the package into debian/sloccount. + $(MAKE) install PREFIX=$(CURDIR)/debian/sloccount/usr + + +# Build architecture-independent files here. +binary-indep: build install +# We have nothing to do by default. + + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir + dh_testroot + dh_installdocs + dh_installexamples + dh_installman sloccount.1 debian/generic_count.1 debian/X_count.1 + # Make symlinks for manpages + (cd $(CURDIR)/debian/sloccount/usr/share/man/man1; \ + for executables in $(LINKMANPAGES); \ + do \ + ln -s sloccount.1.gz $$executables.1.gz ;\ + done ; \ + for executables in $(LINKMANPAGES_GC); \ + do \ + ln -s generic_count.1.gz $$executables.1.gz ;\ + done ; \ + for executables in $(LINKMANPAGES_X); \ + do \ + ln -s X_count.1.gz $$executables.1.gz ;\ + done ) + dh_installchangelogs ChangeLog + dh_link + dh_strip + dh_compress + dh_fixperms + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install --- sloccount-2.26.orig/debian/changelog +++ sloccount-2.26/debian/changelog @@ -0,0 +1,203 @@ +sloccount (2.26-5) lucid; urgency=low + + * Add javascript support + + -- Thomas Hervé Fri, 24 Sep 2010 09:01:09 +0200 + +sloccount (2.26-4) unstable; urgency=low + + * debian/control + - bump Standards-Version to 3.8.0 + + debian/README.source added + - updated my email address + - added ${misc:Depends} to bin package depends + - added VHDL and XML to supported language list in long description + * debian/rules + - added vhdl and xml manpage installation + * debian/patches/50_bts379448_ruby_recognize.dpatch + - changed to better match ruby shebang; thanks to Josef Spillner for the + notice; Closes: #379448 + * debian/patches/60_bts508557_vhdl_support.dpatch + - added VHDL support; thanks to Elie De Brauwer for the report and the + patch; Closes: #508557 + * debian/patches/70_bts508556_xml_support.dpatch + - added XML support; thanks to Elie De Brauwer for the report and the patch; + Closes: #508556 + * debian/patches/20_bts462392_erlang_support.dpatch + - added installation of "erlang_count" to upstream makefile + - fixed "erlang_count" since comments in Erlang start with '%%'; thanks to + George Prekas for the report and solution; Closes: #512577 + * debian/copyright + - added copyright for packaging + - using GPLv2 for reference to local license + * debian/sloccount.docs + - removed 'ChangeLog' installation, done by dh_installchangelog + * debian/README.Debian + - removed since no more needed and outdated + + -- Sandro Tosi Sat, 24 Jan 2009 01:17:58 +0100 + +sloccount (2.26-3) unstable; urgency=low + + * Adopting package (Closes: #465855) + * Acknowledging NMU (Closes: #414656) + * debian/control + - set myself as maintainer + - bump Standards-Version to 3.7.3 + - added Homepage field + - removed capitalization from short description + - long description paragraphs reformat + - fix spelling of Tcl in long description + - set debhelper build-dep version to 5 + - added dpatch build-dep + - include Erlang in long description languages list + * debian/compat + - added with value 5 + * debian/copyright + - upstream author indented with 4 spaces + - clear separation of copyright and license + - fixed copyright notice + - fixed license note + - added additional copyright notices for file with different ones + - added location of GPL license on debian system + * debian/rules + - removed DH_COMPAT + - removed configure target since unused + - removed commented dh_* calls + - doesn't ignore clean error anymore + - removed unneeded dh_* calls + - integration of debian/dirs + - added dpatch stuff + - added manpage installation for executables using generic_count + - added manpage installation for counting executables (Closes: #273479, + #273477) + * debian/watch + - added (thanks to DEHS) + * debian/sloccount.doc-base + - fixed section and abstract + * debian/dirs + - removed + * debian/patches/01_restore_pristine_code.dpatch + - added to restore pristine upstream code + * debian/patches/10_fix_manpage.dpatch + - fix manpage hyphen useage (lintian warning) + * debian/patches/20_bts462392_erlang_support.dpatch + - added support to Erlang; thanks to Michael Gebetsroither; (Closes: + #462392) + * debian/patches/30_bts466827_enhance_bison_flex.dpatch + - enhance bison/flex support; thanks to Ronald Aigner; (Closes: #466827) + * debian/patches/40_bts281293_ignore_autotools_files.dpatch + - ignore autotools generated files; thanks to Ronald Aigner; (Closes: + #281293) + * debian/patches/50_bts379448_ruby_recognize.dpatch + - recognize ruby script from shebang; thanks to Ronald Aigner; (Closes: + #379448) + * debian/generic_count.1 + - added to be used by script calling generic_count + * debian/X_count.1 + - added to be used by a set of SLOCCount binaries + + -- Sandro Tosi Sun, 23 Mar 2008 19:07:22 +0100 + +sloccount (2.26-2.1) unstable; urgency=low + + * Non-maintainer upload. + * Remove obsolete workaround about old Perl versions having trouble with + UTF-8 locales and LANG ending in ".UTF-8", since it makes current Perl + barf. (Closes: #414656) + + -- Adeodato Simó Tue, 07 Aug 2007 14:32:54 +0200 + +sloccount (2.26-2) unstable; urgency=low + + * Documentation now installs in /usr/share/doc/sloccount correctly + * This package no longer seems to be NMU (I hope) + + -- Jesus M. Gonzalez-Barahona Wed, 11 Aug 2004 18:29:06 +0200 + +sloccount (2.26-1) unstable; urgency=low + + * New upstream release + * Fixed some missing elements for "make clean" + * (closes: #173699) + * (closes: #159609) + * (closes: #251847) + + -- Jesus M. Gonzalez-Barahona Mon, 31 May 2004 00:39:03 +0200 + +sloccount (2.24-1) unstable; urgency=low + + * New upstream release + * (closes: #200348) + + -- Jesus M. Gonzalez-Barahona Sat, 29 May 2004 17:38:25 +0200 + +sloccount (2.23-1) unstable; urgency=low + + * New upstream release + * (Closes: #180597) + + -- Jesus M. Gonzalez-Barahona Sun, 25 Apr 2004 21:20:44 +0200 + +sloccount (2.14-2) unstable; urgency=low + + * Fixed bug with .pp files + + * Fixed bug in php_count.c (files were not being closed) + + * Fixed bug in break_filelist (files with at the end broke the script) + + -- Jesus M. Gonzalez-Barahona Fri, 23 Aug 2002 00:38:56 +0200 + +sloccount (2.14-1) unstable; urgency=low + + * New upstream release + + * Added patch to support .hh as a C++ header file thx to Sean Perry + * (Closes: #149390) + + * Modified to consider .pp as Pascal file (there are files like this + * in fpc, for instance) + + * When identifying Pascal files, allow ".end" to be anywhere in the + * file, not necesarily at the end (in particular, allow for a + * comment after the ".end", which is common in fpc) + + * Modified to check when .inc files are Pascal files (there are a lot + * of them in fpc) + + -- Jesus M. Gonzalez-Barahona Mon, 19 Aug 2002 23:47:00 +0200 + +sloccount (2.08-3) unstable; urgency=low + + * Fixed doc-base control file (Closes: #128187) + * Added a "suggests doc-base" + + -- Jesus M. Gonzalez-Barahona Wed, 9 Jan 2002 00:25:07 +0100 + +sloccount (2.08-2) unstable; urgency=low + + * Fixed problem with modula3_count. + * Added support for ML (ml_count) + + -- Jesus M. Gonzalez-Barahona Fri, 4 Jan 2002 19:47:16 +0100 + +sloccount (2.08-1) unstable; urgency=low + + * New upstream release. Includes all fixes and features added in 2.05-2. + + -- Jesus M. Gonzalez-Barahona Thu, 3 Jan 2002 23:23:13 +0000 + +sloccount (2.05-2) unstable; urgency=low + + * All *_count files now accept "-f filename" and "-f -" + * compute_sloc_lang modified accordingly + * Some small fixes here and there + + -- Jesus M. Gonzalez-Barahona Sun, 30 Dec 2001 22:08:35 +0100 + +sloccount (2.05-1) unstable; urgency=low + + * Initial Release (Closes: #126503) + + -- Jesus M. Gonzalez-Barahona Wed, 26 Dec 2001 01:08:10 +0100 --- sloccount-2.26.orig/debian/sloccount.doc-base +++ sloccount-2.26/debian/sloccount.doc-base @@ -0,0 +1,9 @@ +Document: sloccount +Title: sloccount Manual +Author: David A. Wheeler +Abstract: This manual describes what sloccount is and how it can be used. +Section: Programming + +Format: HTML +Index: /usr/share/doc/sloccount/sloccount.html +Files: /usr/share/doc/sloccount/*.html --- sloccount-2.26.orig/debian/sloccount.docs +++ sloccount-2.26/debian/sloccount.docs @@ -0,0 +1,3 @@ +README +TODO +sloccount.html --- sloccount-2.26.orig/debian/X_count.1 +++ sloccount-2.26/debian/X_count.1 @@ -0,0 +1,36 @@ +.TH *_COUNT 1 "23 March 2008" "*_count" "*_count" +.SH NAME +*_count \- count physical lines of code, in each input file +.SH SYNOPSIS +.B *_count +[ \fB--f\fR \fIfile\fR ] +.I files... +.SH DESCRIPTION +.PP +This is a generic manpage, written for the helper program for SLOCCount toolsuite. +It currently applies to: +.B asm_count, +.B c_count, +.B cobol_count, +.B f90_count, +.B fortran_count, +.B haskell_count, +.B lex_count, +.B ml_count, +.B modula3_count, +.B objc_count, +.B perl_count, +.B python_count +) + +.SH OPTIONS +.TP +.BI -f " file" +File with a list of files to count (if "-", read list from stdin). It can coexist with a list of files on command line. + +.SH "SEE ALSO" +See sloccount(1) for additional details about SLOCCount suite. + +.SH AUTHOR +This manual page was written by Sandro Tosi , +for the Debian project (but may be used by others) --- sloccount-2.26.orig/debian/copyright +++ sloccount-2.26/debian/copyright @@ -0,0 +1,49 @@ +This package was debianized by Jesus M. Gonzalez-Barahona on +Tue, 25 Dec 2001 23:43:39 +0000. + +It was downloaded from http://www.dwheeler.com/sloccount + +Upstream Author: + + David A. Wheeler + +Copyright: + + Copyright (C) 2001-2004 David A. Wheeler + +License: + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. + +On a Debian system the complete text of the GNU General Public License v2 +can be found in the file `/usr/share/common-licenses/GPL-2'. + +The Debian packaging is copyright 2008-2009, Sandro Tosi and +is licensed under the same license as upstream code (see above). + +These files have different copyright notices: + +jsp_count.c: + + Copyright (C) 2001-2004 David A. Wheeler and Bob Brown. + +jsp_count.l: + + Copyright (C) 2001-2004 David A. Wheeler and Bob Brown. + +ml_count.c: + + Copyright (C) 2001-2004 David A. Wheeler and Michal Moskal + (C) Copyright 2000 David A. Wheeler --- sloccount-2.26.orig/debian/control +++ sloccount-2.26/debian/control @@ -0,0 +1,28 @@ +Source: sloccount +Section: devel +Priority: optional +Maintainer: Sandro Tosi +Build-Depends: debhelper (>= 5), flex, dpatch +Standards-Version: 3.8.0 +Homepage: http://www.dwheeler.com/sloccount/ + +Package: sloccount +Architecture: any +Depends: ${misc:Depends}, ${shlibs:Depends}, perl +Suggests: doc-base +Description: programs for counting physical source lines of code (SLOC) + SLOCCount (pronounced "sloc-count") is a suite of programs for + counting physical source lines of code (SLOC) in potentially large + software systems (thus, SLOCCount is a "software metrics tool" or + "software measurement tool"). SLOCCount can count physical SLOC for + a wide number of languages; listed alphabetically, they are: Ada, + Assembly, awk, Bourne shell, C, C++, C shell, COBOL, C#, Erlang, + Expect, Fortran, Java, lex/flex, LISP (including Scheme), Makefile, + Modula3, Objective-C, Pascal, Perl, PHP, Python, Ruby, sed, SQL, Tcl, + VHDL, XML, Yacc/Bison. + . + SLOCCount can automatically determine if a file is a source code file + or not, and if so, which language it's written in. As a result, you + can analyze large systems completely automatically. SLOCCount also + includes some report-generating tools to collect the data generated + and present it in several different formats. --- sloccount-2.26.orig/debian/generic_count.1 +++ sloccount-2.26/debian/generic_count.1 @@ -0,0 +1,40 @@ +.TH GENERIC_COUNT 1 "23 March 2008" "generic_count" "generic_count" +.SH NAME +generic_count \- count physical lines of code, given a comment marker +.SH SYNOPSIS +.B generic_count +.I commentstart +[ \fB--f\fR \fIfile\fR ] +.I files... +.SH DESCRIPTION +.PP +This is a trivial/naive program for scripts used for sloccount toolsuite. +This manpage is used for all the scripts using \fBgeneric_count\fR (currently: +.B ada_count, +.B awk_count, +.B csh_count, +.B erlang_count, +.B exp_count, +.B lisp_count, +.B makefile_count, +.B ruby_count, +.B sed_count, +.B sh_count, +.B tcl_count +) + +.SH OPTIONS +.TP 12 +.I commentstart +String that begins a comment (continuing until end-of-line). + +.TP +.BI -f " file" +File with a list of files to count (if "-", read list from stdin). It can coexist with a list of files on command line. + +.SH "SEE ALSO" +See sloccount(1) for additional details about SLOCCount suite. + +.SH AUTHOR +This manual page was written by Sandro Tosi , +for the Debian project (but may be used by others) --- sloccount-2.26.orig/debian/watch +++ sloccount-2.26/debian/watch @@ -0,0 +1,2 @@ +version=3 +http://www.dwheeler.com/sloccount sloccount-(.*)\.tar\.gz debian uupdate --- sloccount-2.26.orig/debian/patches/70_bts508556_xml_support.dpatch +++ sloccount-2.26/debian/patches/70_bts508556_xml_support.dpatch @@ -0,0 +1,146 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 70_bts508556_xml_support.dpatch by Elie De Brauwer +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Enable XML support + +@DPATCH@ +diff -urNad sloccount~/break_filelist sloccount/break_filelist +--- sloccount~/break_filelist 2009-01-23 23:59:58.843753006 +0100 ++++ sloccount/break_filelist 2009-01-24 00:01:05.027752302 +0100 +@@ -210,6 +210,7 @@ + # ???: .pco is Oracle Cobol + "jsp" => "jsp", # Java server pages + "vhd" => "vhdl", # VHDL code ++ "xml" => "xml", # XML files + ); + + +diff -urNad sloccount~/makefile sloccount/makefile +--- sloccount~/makefile 2009-01-23 23:59:58.843753006 +0100 ++++ sloccount/makefile 2009-01-23 23:59:58.919752430 +0100 +@@ -82,7 +82,8 @@ + pascal_count$(EXE_SUFFIX) \ + php_count$(EXE_SUFFIX) \ + jsp_count$(EXE_SUFFIX) \ +- ml_count$(EXE_SUFFIX) ++ ml_count$(EXE_SUFFIX) \ ++ xml_count$(EXE_SUFFIX) + + FLEX_GENERATED= \ + pascal_count \ +@@ -154,6 +155,12 @@ + jsp_count$(EXE_SUFFIX): jsp_count.c + $(CC) jsp_count.c -o jsp_count$(EXE_SUFFIX) + ++xml_count.c: xml_count.l driver.c driver.h ++ flex -Cfe -t xml_count.l > xml_count.c ++ ++xml_count$(EXE_SUFFIX): xml_count.c ++ $(CC) xml_count.c -o xml_count$(EXE_SUFFIX) ++ + ml_count$(EXE_SUFFIX): ml_count.c + $(CC) ml_count.c -o ml_count$(EXE_SUFFIX) + +diff -urNad sloccount~/testcode/test.xml sloccount/testcode/test.xml +--- sloccount~/testcode/test.xml 1970-01-01 01:00:00.000000000 +0100 ++++ sloccount/testcode/test.xml 2009-01-23 23:59:58.919752430 +0100 +@@ -0,0 +1,11 @@ ++ ++ ++ ++ ++ ++ Just some stuff ++ ++ ++ ++ ++ +diff -urNad sloccount~/xml_count.l sloccount/xml_count.l +--- sloccount~/xml_count.l 1970-01-01 01:00:00.000000000 +0100 ++++ sloccount/xml_count.l 2009-01-23 23:59:58.923752935 +0100 +@@ -0,0 +1,83 @@ ++%{ ++ ++/* ++This is part of SLOCCount, a toolsuite that counts source lines of code (SLOC). ++Copyright (C) 2001-2004 David A. Wheeler, Bob Brown and Elie De Brauwer ++This is based on Bob Browns jsp_count.l, which was based on David A. Wheeler's ++pascal_count.l. ++ ++This program is free software; you can redistribute it and/or modify ++it under the terms of the GNU General Public License as published by ++the Free Software Foundation; either version 2 of the License, or ++(at your option) any later version. ++ ++This program is distributed in the hope that it will be useful, ++but WITHOUT ANY WARRANTY; without even the implied warranty of ++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++GNU General Public License for more details. ++ ++You should have received a copy of the GNU General Public License ++along with this program; if not, write to the Free Software ++Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ ++To contact David A. Wheeler, see his website at: ++ http://www.dwheeler.com. ++*/ ++ ++#include "driver.h" ++ ++#define YY_NO_UNPUT ++ ++/* 1 if we saw a non-comment, non-whitespace char on this line */ ++int saw_char = 0; ++static void count(void); ++ ++%} ++ ++%option noyywrap ++ ++SPACE [ \t\n\r\f] ++ ++%x chtml ++%x string ++ ++%% ++ line_number = 1; ++ saw_char = 0; ++ BEGIN(INITIAL); ++ ++[ \t\r\f] /* Do nothing */ ++"" { BEGIN(INITIAL); } ++\n { count(); } ++. /* no-op */ ++ ++[^\"\n]+ {saw_char = 1;} ++\n { ++ fprintf(stderr, "Warning: newline in string - file %s, line %ld\n", ++ filename, line_number); ++ count(); ++ BEGIN(INITIAL); /* Switch back; this at least limits damage */ ++ } ++\" { BEGIN(INITIAL);} ++ ++%% ++ ++#include "driver.c" ++ ++static void count(void) ++{ ++ if ( saw_char ) { ++ sloc++; ++ saw_char = 0; ++ } ++ line_number++; ++} --- sloccount-2.26.orig/debian/patches/01_restore_pristine_code.dpatch +++ sloccount-2.26/debian/patches/01_restore_pristine_code.dpatch @@ -0,0 +1,4190 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 01_restore_pristine_code.dpatch by Sandro Tosi +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: New patch generated from sloccount 2.26-2.1 diff.gz + +@DPATCH@ + +--- sloccount-2.26.orig/jsp_count.c ++++ sloccount-2.26/jsp_count.c +@@ -1,32 +1,85 @@ +-/* A lexical scanner generated by flex */ + +-/* Scanner skeleton version: +- * $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.91 96/09/10 16:58:48 vern Exp $ +- */ ++#line 3 "" ++ ++#define YY_INT_ALIGNED short int ++ ++/* A lexical scanner generated by flex */ + + #define FLEX_SCANNER + #define YY_FLEX_MAJOR_VERSION 2 + #define YY_FLEX_MINOR_VERSION 5 ++#define YY_FLEX_SUBMINOR_VERSION 31 ++#if YY_FLEX_SUBMINOR_VERSION > 0 ++#define FLEX_BETA ++#endif + ++/* First, we deal with platform-specific or compiler-specific issues. */ ++ ++/* begin standard C headers. */ + #include +-#include ++#include ++#include ++#include + ++/* end standard C headers. */ + +-/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ +-#ifdef c_plusplus +-#ifndef __cplusplus +-#define __cplusplus ++/* flex integer type definitions */ ++ ++#ifndef FLEXINT_H ++#define FLEXINT_H ++ ++/* C99 systems have . Non-C99 systems may or may not. */ ++ ++#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L ++#include ++typedef int8_t flex_int8_t; ++typedef uint8_t flex_uint8_t; ++typedef int16_t flex_int16_t; ++typedef uint16_t flex_uint16_t; ++typedef int32_t flex_int32_t; ++typedef uint32_t flex_uint32_t; ++#else ++typedef signed char flex_int8_t; ++typedef short int flex_int16_t; ++typedef int flex_int32_t; ++typedef unsigned char flex_uint8_t; ++typedef unsigned short int flex_uint16_t; ++typedef unsigned int flex_uint32_t; ++#endif /* ! C99 */ ++ ++/* Limits of integral types. */ ++#ifndef INT8_MIN ++#define INT8_MIN (-128) ++#endif ++#ifndef INT16_MIN ++#define INT16_MIN (-32767-1) ++#endif ++#ifndef INT32_MIN ++#define INT32_MIN (-2147483647-1) ++#endif ++#ifndef INT8_MAX ++#define INT8_MAX (127) + #endif ++#ifndef INT16_MAX ++#define INT16_MAX (32767) ++#endif ++#ifndef INT32_MAX ++#define INT32_MAX (2147483647) ++#endif ++#ifndef UINT8_MAX ++#define UINT8_MAX (255U) ++#endif ++#ifndef UINT16_MAX ++#define UINT16_MAX (65535U) ++#endif ++#ifndef UINT32_MAX ++#define UINT32_MAX (4294967295U) + #endif + ++#endif /* ! FLEXINT_H */ + + #ifdef __cplusplus + +-#include +- +-/* Use prototypes in function declarations. */ +-#define YY_USE_PROTOS +- + /* The "const" storage-class-modifier is valid. */ + #define YY_USE_CONST + +@@ -34,34 +87,17 @@ + + #if __STDC__ + +-#define YY_USE_PROTOS + #define YY_USE_CONST + + #endif /* __STDC__ */ + #endif /* ! __cplusplus */ + +-#ifdef __TURBOC__ +- #pragma warn -rch +- #pragma warn -use +-#include +-#include +-#define YY_USE_CONST +-#define YY_USE_PROTOS +-#endif +- + #ifdef YY_USE_CONST + #define yyconst const + #else + #define yyconst + #endif + +- +-#ifdef YY_USE_PROTOS +-#define YY_PROTO(proto) proto +-#else +-#define YY_PROTO(proto) () +-#endif +- + /* Returned upon end-of-file. */ + #define YY_NULL 0 + +@@ -76,71 +112,71 @@ + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ +-#define BEGIN yy_start = 1 + 2 * ++#define BEGIN (yy_start) = 1 + 2 * + + /* Translate the current start state into a value that can be later handed + * to BEGIN to return to the state. The YYSTATE alias is for lex + * compatibility. + */ +-#define YY_START ((yy_start - 1) / 2) ++#define YY_START (((yy_start) - 1) / 2) + #define YYSTATE YY_START + + /* Action number for EOF rule of a given start state. */ + #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) + + /* Special action meaning "start processing a new file". */ +-#define YY_NEW_FILE yyrestart( yyin ) ++#define YY_NEW_FILE yyrestart(yyin ) + + #define YY_END_OF_BUFFER_CHAR 0 + + /* Size of default input buffer. */ ++#ifndef YY_BUF_SIZE + #define YY_BUF_SIZE 16384 ++#endif + ++#ifndef YY_TYPEDEF_YY_BUFFER_STATE ++#define YY_TYPEDEF_YY_BUFFER_STATE + typedef struct yy_buffer_state *YY_BUFFER_STATE; ++#endif + + extern int yyleng; ++ + extern FILE *yyin, *yyout; + + #define EOB_ACT_CONTINUE_SCAN 0 + #define EOB_ACT_END_OF_FILE 1 + #define EOB_ACT_LAST_MATCH 2 + +-/* The funky do-while in the following #define is used to turn the definition +- * int a single C statement (which needs a semi-colon terminator). This +- * avoids problems with code like: +- * +- * if ( condition_holds ) +- * yyless( 5 ); +- * else +- * do_something_else(); +- * +- * Prior to using the do-while the compiler would get upset at the +- * "else" because it interpreted the "if" statement as being all +- * done when it reached the ';' after the yyless() call. +- */ +- +-/* Return all but the first 'n' matched characters back to the input stream. */ +- ++ #define YY_LESS_LINENO(n) ++ ++/* Return all but the first "n" matched characters back to the input stream. */ + #define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ +- *yy_cp = yy_hold_char; \ ++ int yyless_macro_arg = (n); \ ++ YY_LESS_LINENO(yyless_macro_arg);\ ++ *yy_cp = (yy_hold_char); \ + YY_RESTORE_YY_MORE_OFFSET \ +- yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ ++ (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) + +-#define unput(c) yyunput( c, yytext_ptr ) ++#define unput(c) yyunput( c, (yytext_ptr) ) + + /* The following is because we cannot portably get our hands on size_t + * (without autoconf's help, which isn't available because we want + * flex-generated scanners to compile on their own). + */ +-typedef unsigned int yy_size_t; + ++#ifndef YY_TYPEDEF_YY_SIZE_T ++#define YY_TYPEDEF_YY_SIZE_T ++typedef unsigned int yy_size_t; ++#endif + ++#ifndef YY_STRUCT_YY_BUFFER_STATE ++#define YY_STRUCT_YY_BUFFER_STATE + struct yy_buffer_state + { + FILE *yy_input_file; +@@ -177,12 +213,16 @@ + */ + int yy_at_bol; + ++ int yy_bs_lineno; /**< The line count. */ ++ int yy_bs_column; /**< The column count. */ ++ + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; ++ + #define YY_BUFFER_NEW 0 + #define YY_BUFFER_NORMAL 1 + /* When an EOF's been seen but there's still some text to process +@@ -196,23 +236,33 @@ + * just pointing yyin at a new input file. + */ + #define YY_BUFFER_EOF_PENDING 2 ++ + }; ++#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +-static YY_BUFFER_STATE yy_current_buffer = 0; ++/* Stack of input buffers. */ ++static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ ++static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ ++static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ + + /* We provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general + * "scanner state". ++ * ++ * Returns the top of the stack, or NULL. + */ +-#define YY_CURRENT_BUFFER yy_current_buffer ++#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ ++ ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ ++ : NULL) + ++/* Same as previous macro, but useful when we know that the buffer stack is not ++ * NULL or when we need an lvalue. For internal use only. ++ */ ++#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] + + /* yy_hold_char holds the character lost when yytext is formed. */ + static char yy_hold_char; +- + static int yy_n_chars; /* number of characters read into yy_ch_buf */ +- +- + int yyleng; + + /* Points to current character in buffer. */ +@@ -225,51 +275,70 @@ + */ + static int yy_did_buffer_switch_on_eof; + +-void yyrestart YY_PROTO(( FILE *input_file )); +- +-void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); +-void yy_load_buffer_state YY_PROTO(( void )); +-YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); +-void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); +-void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); +-void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); +-#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) +- +-YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); +-YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str )); +-YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); +- +-static void *yy_flex_alloc YY_PROTO(( yy_size_t )); +-static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); +-static void yy_flex_free YY_PROTO(( void * )); ++void yyrestart (FILE *input_file ); ++void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); ++YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ); ++void yy_delete_buffer (YY_BUFFER_STATE b ); ++void yy_flush_buffer (YY_BUFFER_STATE b ); ++void yypush_buffer_state (YY_BUFFER_STATE new_buffer ); ++void yypop_buffer_state (void ); ++ ++static void yyensure_buffer_stack (void ); ++static void yy_load_buffer_state (void ); ++static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); ++ ++#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ) ++ ++YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); ++YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); ++YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ); ++ ++void *yyalloc (yy_size_t ); ++void *yyrealloc (void *,yy_size_t ); ++void yyfree (void * ); + + #define yy_new_buffer yy_create_buffer + + #define yy_set_interactive(is_interactive) \ + { \ +- if ( ! yy_current_buffer ) \ +- yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ +- yy_current_buffer->yy_is_interactive = is_interactive; \ ++ if ( ! YY_CURRENT_BUFFER ){ \ ++ yyensure_buffer_stack (); \ ++ YY_CURRENT_BUFFER_LVALUE = \ ++ yy_create_buffer(yyin,YY_BUF_SIZE ); \ ++ } \ ++ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ + } + + #define yy_set_bol(at_bol) \ + { \ +- if ( ! yy_current_buffer ) \ +- yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ +- yy_current_buffer->yy_at_bol = at_bol; \ ++ if ( ! YY_CURRENT_BUFFER ){\ ++ yyensure_buffer_stack (); \ ++ YY_CURRENT_BUFFER_LVALUE = \ ++ yy_create_buffer(yyin,YY_BUF_SIZE ); \ ++ } \ ++ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ + } + +-#define YY_AT_BOL() (yy_current_buffer->yy_at_bol) ++#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) + ++/* Begin user sect3 */ + +-#define yywrap() 1 ++#define yywrap(n) 1 + #define YY_SKIP_YYWRAP ++ + typedef unsigned char YY_CHAR; ++ + FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; ++ + typedef int yy_state_type; ++ ++extern int yylineno; ++ ++int yylineno = 1; ++ + extern char *yytext; + #define yytext_ptr yytext +-static yyconst short yy_nxt[][11] = ++static yyconst flex_int16_t yy_nxt[][11] = + { + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +@@ -470,25 +539,31 @@ + + } ; + +- +-static yy_state_type yy_get_previous_state YY_PROTO(( void )); +-static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); +-static int yy_get_next_buffer YY_PROTO(( void )); +-static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); ++static yy_state_type yy_get_previous_state (void ); ++static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); ++static int yy_get_next_buffer (void ); ++static void yy_fatal_error (yyconst char msg[] ); + + /* Done after the current pattern has been matched and before the + * corresponding action - sets up yytext. + */ + #define YY_DO_BEFORE_ACTION \ +- yytext_ptr = yy_bp; \ +- yyleng = (int) (yy_cp - yy_bp); \ +- yy_hold_char = *yy_cp; \ ++ (yytext_ptr) = yy_bp; \ ++ yyleng = (size_t) (yy_cp - yy_bp); \ ++ (yy_hold_char) = *yy_cp; \ + *yy_cp = '\0'; \ +- yy_c_buf_p = yy_cp; ++ (yy_c_buf_p) = yy_cp; + + #define YY_NUM_RULES 17 + #define YY_END_OF_BUFFER 18 +-static yyconst short int yy_accept[38] = ++/* This struct is not used in this scanner, ++ but its presence is necessary. */ ++struct yy_trans_info ++ { ++ flex_int32_t yy_verify; ++ flex_int32_t yy_nxt; ++ }; ++static yyconst flex_int16_t yy_accept[38] = + { 0, + 0, 0, 0, 0, 0, 0, 0, 0, 18, 6, + 1, 4, 5, 7, 7, 10, 9, 10, 13, 12, +@@ -496,7 +571,7 @@ + 0, 0, 8, 0, 2, 3, 11 + } ; + +-static yyconst int yy_ec[256] = ++static yyconst flex_int32_t yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, +@@ -531,6 +606,9 @@ + static yy_state_type yy_last_accepting_state; + static char *yy_last_accepting_cpos; + ++extern int yy_flex_debug; ++int yy_flex_debug = 0; ++ + /* The intent behind this definition is that it'll catch + * any uses of REJECT which flex missed. + */ +@@ -540,7 +618,6 @@ + #define YY_RESTORE_YY_MORE_OFFSET + char *yytext; + #line 1 "jsp_count.l" +-#define INITIAL 0 + #line 2 "jsp_count.l" + + /* +@@ -576,12 +653,27 @@ + int saw_char = 0; + static void count(void); + +-#define chtml 1 + +-#define cjsp 2 + ++ ++#line 660 "" ++ ++#define INITIAL 0 ++#define chtml 1 ++#define cjsp 2 + #define string 3 + ++#ifndef YY_NO_UNISTD_H ++/* Special case for "unistd.h", since it is non-ANSI. We include it way ++ * down here because we want the user's section 1 to have been scanned first. ++ * The user has a chance to override it with an option. ++ */ ++#include ++#endif ++ ++#ifndef YY_EXTRA_TYPE ++#define YY_EXTRA_TYPE void * ++#endif + + /* Macros after this point can all be overridden by user definitions in + * section 1. +@@ -589,65 +681,30 @@ + + #ifndef YY_SKIP_YYWRAP + #ifdef __cplusplus +-extern "C" int yywrap YY_PROTO(( void )); ++extern "C" int yywrap (void ); + #else +-extern int yywrap YY_PROTO(( void )); ++extern int yywrap (void ); + #endif + #endif + +-#ifndef YY_NO_UNPUT +-static void yyunput YY_PROTO(( int c, char *buf_ptr )); +-#endif +- ++ static void yyunput (int c,char *buf_ptr ); ++ + #ifndef yytext_ptr +-static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); ++static void yy_flex_strncpy (char *,yyconst char *,int ); + #endif + + #ifdef YY_NEED_STRLEN +-static int yy_flex_strlen YY_PROTO(( yyconst char * )); ++static int yy_flex_strlen (yyconst char * ); + #endif + + #ifndef YY_NO_INPUT +-#ifdef __cplusplus +-static int yyinput YY_PROTO(( void )); +-#else +-static int input YY_PROTO(( void )); +-#endif +-#endif +- +-#if YY_STACK_USED +-static int yy_start_stack_ptr = 0; +-static int yy_start_stack_depth = 0; +-static int *yy_start_stack = 0; +-#ifndef YY_NO_PUSH_STATE +-static void yy_push_state YY_PROTO(( int new_state )); +-#endif +-#ifndef YY_NO_POP_STATE +-static void yy_pop_state YY_PROTO(( void )); +-#endif +-#ifndef YY_NO_TOP_STATE +-static int yy_top_state YY_PROTO(( void )); +-#endif + ++#ifdef __cplusplus ++static int yyinput (void ); + #else +-#define YY_NO_PUSH_STATE 1 +-#define YY_NO_POP_STATE 1 +-#define YY_NO_TOP_STATE 1 ++static int input (void ); + #endif + +-#ifdef YY_MALLOC_DECL +-YY_MALLOC_DECL +-#else +-#if __STDC__ +-#ifndef __cplusplus +-#include +-#endif +-#else +-/* Just try to get by without declaring the routines. This will fail +- * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) +- * or sizeof(void*) != sizeof(int). +- */ +-#endif + #endif + + /* Amount of stuff to slurp up with each read. */ +@@ -656,7 +713,6 @@ + #endif + + /* Copy whatever the last rule matched to the standard output. */ +- + #ifndef ECHO + /* This used to be an fputs(), but since the string might contain NUL's, + * we now use fwrite(). +@@ -669,9 +725,10 @@ + */ + #ifndef YY_INPUT + #define YY_INPUT(buf,result,max_size) \ +- if ( yy_current_buffer->yy_is_interactive ) \ ++ if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ + { \ +- int c = '*', n; \ ++ int c = '*'; \ ++ size_t n; \ + for ( n = 0; n < max_size && \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ +@@ -681,9 +738,22 @@ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ +- else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \ +- && ferror( yyin ) ) \ +- YY_FATAL_ERROR( "input in flex scanner failed" ); ++ else \ ++ { \ ++ errno=0; \ ++ while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ ++ { \ ++ if( errno != EINTR) \ ++ { \ ++ YY_FATAL_ERROR( "input in flex scanner failed" ); \ ++ break; \ ++ } \ ++ errno=0; \ ++ clearerr(yyin); \ ++ } \ ++ }\ ++\ ++ + #endif + + /* No semi-colon after return; correct usage is to write "yyterminate();" - +@@ -704,12 +774,18 @@ + #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) + #endif + ++/* end tables serialization structures and prototypes */ ++ + /* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ + #ifndef YY_DECL +-#define YY_DECL int yylex YY_PROTO(( void )) +-#endif ++#define YY_DECL_IS_OURS 1 ++ ++extern int yylex (void); ++ ++#define YY_DECL int yylex (void) ++#endif /* !YY_DECL */ + + /* Code executed at the beginning of each rule, after yytext and yyleng + * have been set up. +@@ -726,29 +802,32 @@ + #define YY_RULE_SETUP \ + YY_USER_ACTION + ++/** The main scanner function which does all the work. ++ */ + YY_DECL +- { ++{ + register yy_state_type yy_current_state; +- register char *yy_cp = NULL, *yy_bp = NULL; ++ register char *yy_cp, *yy_bp; + register int yy_act; +- ++ + #line 46 "jsp_count.l" + + line_number = 1; + saw_char = 0; + BEGIN(INITIAL); + ++#line 820 "" + +- if ( yy_init ) ++ if ( (yy_init) ) + { +- yy_init = 0; ++ (yy_init) = 0; + + #ifdef YY_USER_INIT + YY_USER_INIT; + #endif + +- if ( ! yy_start ) +- yy_start = 1; /* first start state */ ++ if ( ! (yy_start) ) ++ (yy_start) = 1; /* first start state */ + + if ( ! yyin ) + yyin = stdin; +@@ -756,33 +835,35 @@ + if ( ! yyout ) + yyout = stdout; + +- if ( ! yy_current_buffer ) +- yy_current_buffer = +- yy_create_buffer( yyin, YY_BUF_SIZE ); ++ if ( ! YY_CURRENT_BUFFER ) { ++ yyensure_buffer_stack (); ++ YY_CURRENT_BUFFER_LVALUE = ++ yy_create_buffer(yyin,YY_BUF_SIZE ); ++ } + +- yy_load_buffer_state(); ++ yy_load_buffer_state( ); + } + + while ( 1 ) /* loops until end-of-file is reached */ + { +- yy_cp = yy_c_buf_p; ++ yy_cp = (yy_c_buf_p); + + /* Support of yytext. */ +- *yy_cp = yy_hold_char; ++ *yy_cp = (yy_hold_char); + + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; + +- yy_current_state = yy_start; ++ yy_current_state = (yy_start); + yy_match: +- while ( (yy_current_state = yy_nxt[yy_current_state][yy_ec[YY_SC_TO_UI(*yy_cp)]]) > 0 ) ++ while ( (yy_current_state = yy_nxt[yy_current_state][ yy_ec[YY_SC_TO_UI(*yy_cp)] ]) > 0 ) + { + if ( yy_accept[yy_current_state] ) + { +- yy_last_accepting_state = yy_current_state; +- yy_last_accepting_cpos = yy_cp; ++ (yy_last_accepting_state) = yy_current_state; ++ (yy_last_accepting_cpos) = yy_cp; + } + + ++yy_cp; +@@ -795,17 +876,15 @@ + + YY_DO_BEFORE_ACTION; + +- + do_action: /* This label is used only to access EOF actions. */ + +- + switch ( yy_act ) + { /* beginning of action switch */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ +- *yy_cp = yy_hold_char; +- yy_cp = yy_last_accepting_cpos + 1; +- yy_current_state = yy_last_accepting_state; ++ *yy_cp = (yy_hold_char); ++ yy_cp = (yy_last_accepting_cpos) + 1; ++ yy_current_state = (yy_last_accepting_state); + goto yy_find_action; + + case 1: +@@ -824,6 +903,7 @@ + { BEGIN(cjsp); } + YY_BREAK + case 4: ++/* rule 4 can match eol */ + YY_RULE_SETUP + #line 54 "jsp_count.l" + { count(); } +@@ -849,6 +929,7 @@ + { BEGIN(INITIAL); } + YY_BREAK + case 9: ++/* rule 9 can match eol */ + YY_RULE_SETUP + #line 63 "jsp_count.l" + { count(); } +@@ -864,6 +945,7 @@ + { BEGIN(INITIAL); } + YY_BREAK + case 12: ++/* rule 12 can match eol */ + YY_RULE_SETUP + #line 67 "jsp_count.l" + { count(); } +@@ -879,6 +961,7 @@ + {saw_char = 1;} + YY_BREAK + case 15: ++/* rule 15 can match eol */ + YY_RULE_SETUP + #line 71 "jsp_count.l" + { +@@ -898,6 +981,7 @@ + #line 79 "jsp_count.l" + ECHO; + YY_BREAK ++#line 985 "" + case YY_STATE_EOF(INITIAL): + case YY_STATE_EOF(chtml): + case YY_STATE_EOF(cjsp): +@@ -907,26 +991,26 @@ + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ +- int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; ++ int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ +- *yy_cp = yy_hold_char; ++ *yy_cp = (yy_hold_char); + YY_RESTORE_YY_MORE_OFFSET + +- if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) ++ if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed yyin at a new source and called + * yylex(). If so, then we have to assure +- * consistency between yy_current_buffer and our ++ * consistency between YY_CURRENT_BUFFER and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ +- yy_n_chars = yy_current_buffer->yy_n_chars; +- yy_current_buffer->yy_input_file = yyin; +- yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; ++ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; ++ YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; ++ YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position +@@ -936,13 +1020,13 @@ + * end-of-buffer state). Contrast this with the test + * in input(). + */ +- if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) ++ if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + +- yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; ++ (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; + +- yy_current_state = yy_get_previous_state(); ++ yy_current_state = yy_get_previous_state( ); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have +@@ -955,30 +1039,30 @@ + + yy_next_state = yy_try_NUL_trans( yy_current_state ); + +- yy_bp = yytext_ptr + YY_MORE_ADJ; ++ yy_bp = (yytext_ptr) + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ +- yy_cp = ++yy_c_buf_p; ++ yy_cp = ++(yy_c_buf_p); + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { +- yy_cp = yy_c_buf_p; ++ yy_cp = (yy_c_buf_p); + goto yy_find_action; + } + } + +- else switch ( yy_get_next_buffer() ) ++ else switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_END_OF_FILE: + { +- yy_did_buffer_switch_on_eof = 0; ++ (yy_did_buffer_switch_on_eof) = 0; + +- if ( yywrap() ) ++ if ( yywrap( ) ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up +@@ -989,7 +1073,7 @@ + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ +- yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; ++ (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; +@@ -997,30 +1081,30 @@ + + else + { +- if ( ! yy_did_buffer_switch_on_eof ) ++ if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: +- yy_c_buf_p = +- yytext_ptr + yy_amount_of_matched_text; ++ (yy_c_buf_p) = ++ (yytext_ptr) + yy_amount_of_matched_text; + +- yy_current_state = yy_get_previous_state(); ++ yy_current_state = yy_get_previous_state( ); + +- yy_cp = yy_c_buf_p; +- yy_bp = yytext_ptr + YY_MORE_ADJ; ++ yy_cp = (yy_c_buf_p); ++ yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: +- yy_c_buf_p = +- &yy_current_buffer->yy_ch_buf[yy_n_chars]; ++ (yy_c_buf_p) = ++ &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; + +- yy_current_state = yy_get_previous_state(); ++ yy_current_state = yy_get_previous_state( ); + +- yy_cp = yy_c_buf_p; +- yy_bp = yytext_ptr + YY_MORE_ADJ; ++ yy_cp = (yy_c_buf_p); ++ yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_find_action; + } + break; +@@ -1031,8 +1115,7 @@ + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ +- } /* end of yylex */ +- ++} /* end of yylex */ + + /* yy_get_next_buffer - try to read in a new buffer + * +@@ -1041,21 +1124,20 @@ + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ +- +-static int yy_get_next_buffer() +- { +- register char *dest = yy_current_buffer->yy_ch_buf; +- register char *source = yytext_ptr; ++static int yy_get_next_buffer (void) ++{ ++ register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; ++ register char *source = (yytext_ptr); + register int number_to_move, i; + int ret_val; + +- if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) ++ if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + +- if ( yy_current_buffer->yy_fill_buffer == 0 ) ++ if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ +- if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) ++ if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. +@@ -1075,34 +1157,30 @@ + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ +- number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; ++ number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + +- if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) ++ if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ +- yy_current_buffer->yy_n_chars = yy_n_chars = 0; ++ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; + + else + { +- int num_to_read = +- yy_current_buffer->yy_buf_size - number_to_move - 1; ++ size_t num_to_read = ++ YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ +-#ifdef YY_USES_REJECT +- YY_FATAL_ERROR( +-"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); +-#else + + /* just a shorter name for the current buffer */ +- YY_BUFFER_STATE b = yy_current_buffer; ++ YY_BUFFER_STATE b = YY_CURRENT_BUFFER; + + int yy_c_buf_p_offset = +- (int) (yy_c_buf_p - b->yy_ch_buf); ++ (int) ((yy_c_buf_p) - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { +@@ -1115,8 +1193,7 @@ + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ +- yy_flex_realloc( (void *) b->yy_ch_buf, +- b->yy_buf_size + 2 ); ++ yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); + } + else + /* Can't grow it, we don't own it. */ +@@ -1126,35 +1203,35 @@ + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + +- yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; ++ (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; + +- num_to_read = yy_current_buffer->yy_buf_size - ++ num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - + number_to_move - 1; +-#endif ++ + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ +- YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), +- yy_n_chars, num_to_read ); ++ YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), ++ (yy_n_chars), num_to_read ); + +- yy_current_buffer->yy_n_chars = yy_n_chars; ++ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + +- if ( yy_n_chars == 0 ) ++ if ( (yy_n_chars) == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; +- yyrestart( yyin ); ++ yyrestart(yyin ); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; +- yy_current_buffer->yy_buffer_status = ++ YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } +@@ -1162,54 +1239,46 @@ + else + ret_val = EOB_ACT_CONTINUE_SCAN; + +- yy_n_chars += number_to_move; +- yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; +- yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; ++ (yy_n_chars) += number_to_move; ++ YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; ++ YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; + +- yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; ++ (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + + return ret_val; +- } +- ++} + + /* yy_get_previous_state - get the state just before the EOB char was reached */ + +-static yy_state_type yy_get_previous_state() +- { ++ static yy_state_type yy_get_previous_state (void) ++{ + register yy_state_type yy_current_state; + register char *yy_cp; ++ ++ yy_current_state = (yy_start); + +- yy_current_state = yy_start; +- +- for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) ++ for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) + { + yy_current_state = yy_nxt[yy_current_state][(*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1)]; + if ( yy_accept[yy_current_state] ) + { +- yy_last_accepting_state = yy_current_state; +- yy_last_accepting_cpos = yy_cp; ++ (yy_last_accepting_state) = yy_current_state; ++ (yy_last_accepting_cpos) = yy_cp; + } + } + + return yy_current_state; +- } +- ++} + + /* yy_try_NUL_trans - try to make a transition on the NUL character + * + * synopsis + * next_state = yy_try_NUL_trans( current_state ); + */ +- +-#ifdef YY_USE_PROTOS +-static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) +-#else +-static yy_state_type yy_try_NUL_trans( yy_current_state ) +-yy_state_type yy_current_state; +-#endif +- { ++ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) ++{ + register int yy_is_jam; +- register char *yy_cp = yy_c_buf_p; ++ register char *yy_cp = (yy_c_buf_p); + + yy_current_state = yy_nxt[yy_current_state][1]; + yy_is_jam = (yy_current_state <= 0); +@@ -1218,87 +1287,79 @@ + { + if ( yy_accept[yy_current_state] ) + { +- yy_last_accepting_state = yy_current_state; +- yy_last_accepting_cpos = yy_cp; ++ (yy_last_accepting_state) = yy_current_state; ++ (yy_last_accepting_cpos) = yy_cp; + } + } + + return yy_is_jam ? 0 : yy_current_state; +- } +- ++} + +-#ifndef YY_NO_UNPUT +-#ifdef YY_USE_PROTOS +-static void yyunput( int c, register char *yy_bp ) +-#else +-static void yyunput( c, yy_bp ) +-int c; +-register char *yy_bp; +-#endif +- { +- register char *yy_cp = yy_c_buf_p; ++ static void yyunput (int c, register char * yy_bp ) ++{ ++ register char *yy_cp; ++ ++ yy_cp = (yy_c_buf_p); + + /* undo effects of setting up yytext */ +- *yy_cp = yy_hold_char; ++ *yy_cp = (yy_hold_char); + +- if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) ++ if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + { /* need to shift things up to make room */ + /* +2 for EOB chars. */ +- register int number_to_move = yy_n_chars + 2; +- register char *dest = &yy_current_buffer->yy_ch_buf[ +- yy_current_buffer->yy_buf_size + 2]; ++ register int number_to_move = (yy_n_chars) + 2; ++ register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ ++ YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; + register char *source = +- &yy_current_buffer->yy_ch_buf[number_to_move]; ++ &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; + +- while ( source > yy_current_buffer->yy_ch_buf ) ++ while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + *--dest = *--source; + + yy_cp += (int) (dest - source); + yy_bp += (int) (dest - source); +- yy_current_buffer->yy_n_chars = +- yy_n_chars = yy_current_buffer->yy_buf_size; ++ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = ++ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; + +- if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) ++ if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } + + *--yy_cp = (char) c; + +- +- yytext_ptr = yy_bp; +- yy_hold_char = *yy_cp; +- yy_c_buf_p = yy_cp; +- } +-#endif /* ifndef YY_NO_UNPUT */ +- ++ (yytext_ptr) = yy_bp; ++ (yy_hold_char) = *yy_cp; ++ (yy_c_buf_p) = yy_cp; ++} + + #ifndef YY_NO_INPUT + #ifdef __cplusplus +-static int yyinput() ++ static int yyinput (void) + #else +-static int input() ++ static int input (void) + #endif +- { +- int c; + +- *yy_c_buf_p = yy_hold_char; ++{ ++ int c; ++ ++ *(yy_c_buf_p) = (yy_hold_char); + +- if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) ++ if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ +- if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) ++ if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + /* This was really a NUL. */ +- *yy_c_buf_p = '\0'; ++ *(yy_c_buf_p) = '\0'; + + else + { /* need more input */ +- int offset = yy_c_buf_p - yytext_ptr; +- ++yy_c_buf_p; ++ int offset = (yy_c_buf_p) - (yytext_ptr); ++ ++(yy_c_buf_p); + +- switch ( yy_get_next_buffer() ) ++ switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() +@@ -1312,16 +1373,16 @@ + */ + + /* Reset buffer status. */ +- yyrestart( yyin ); ++ yyrestart(yyin ); + +- /* fall through */ ++ /*FALLTHROUGH*/ + + case EOB_ACT_END_OF_FILE: + { +- if ( yywrap() ) ++ if ( yywrap( ) ) + return EOF; + +- if ( ! yy_did_buffer_switch_on_eof ) ++ if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; + #ifdef __cplusplus + return yyinput(); +@@ -1331,90 +1392,92 @@ + } + + case EOB_ACT_CONTINUE_SCAN: +- yy_c_buf_p = yytext_ptr + offset; ++ (yy_c_buf_p) = (yytext_ptr) + offset; + break; + } + } + } + +- c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ +- *yy_c_buf_p = '\0'; /* preserve yytext */ +- yy_hold_char = *++yy_c_buf_p; +- ++ c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ ++ *(yy_c_buf_p) = '\0'; /* preserve yytext */ ++ (yy_hold_char) = *++(yy_c_buf_p); + + return c; +- } +-#endif /* YY_NO_INPUT */ +- +-#ifdef YY_USE_PROTOS +-void yyrestart( FILE *input_file ) +-#else +-void yyrestart( input_file ) +-FILE *input_file; +-#endif +- { +- if ( ! yy_current_buffer ) +- yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); ++} ++#endif /* ifndef YY_NO_INPUT */ + +- yy_init_buffer( yy_current_buffer, input_file ); +- yy_load_buffer_state(); ++/** Immediately switch to a different input stream. ++ * @param input_file A readable stream. ++ * ++ * @note This function does not reset the start condition to @c INITIAL . ++ */ ++ void yyrestart (FILE * input_file ) ++{ ++ ++ if ( ! YY_CURRENT_BUFFER ){ ++ yyensure_buffer_stack (); ++ YY_CURRENT_BUFFER_LVALUE = ++ yy_create_buffer(yyin,YY_BUF_SIZE ); + } + ++ yy_init_buffer(YY_CURRENT_BUFFER,input_file ); ++ yy_load_buffer_state( ); ++} + +-#ifdef YY_USE_PROTOS +-void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) +-#else +-void yy_switch_to_buffer( new_buffer ) +-YY_BUFFER_STATE new_buffer; +-#endif +- { +- if ( yy_current_buffer == new_buffer ) ++/** Switch to a different input buffer. ++ * @param new_buffer The new input buffer. ++ * ++ */ ++ void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) ++{ ++ ++ /* TODO. We should be able to replace this entire function body ++ * with ++ * yypop_buffer_state(); ++ * yypush_buffer_state(new_buffer); ++ */ ++ yyensure_buffer_stack (); ++ if ( YY_CURRENT_BUFFER == new_buffer ) + return; + +- if ( yy_current_buffer ) ++ if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ +- *yy_c_buf_p = yy_hold_char; +- yy_current_buffer->yy_buf_pos = yy_c_buf_p; +- yy_current_buffer->yy_n_chars = yy_n_chars; ++ *(yy_c_buf_p) = (yy_hold_char); ++ YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); ++ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + +- yy_current_buffer = new_buffer; +- yy_load_buffer_state(); ++ YY_CURRENT_BUFFER_LVALUE = new_buffer; ++ yy_load_buffer_state( ); + + /* We don't actually know whether we did this switch during + * EOF (yywrap()) processing, but the only time this flag + * is looked at is after yywrap() is called, so it's safe + * to go ahead and always set it. + */ +- yy_did_buffer_switch_on_eof = 1; +- } +- +- +-#ifdef YY_USE_PROTOS +-void yy_load_buffer_state( void ) +-#else +-void yy_load_buffer_state() +-#endif +- { +- yy_n_chars = yy_current_buffer->yy_n_chars; +- yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; +- yyin = yy_current_buffer->yy_input_file; +- yy_hold_char = *yy_c_buf_p; +- } ++ (yy_did_buffer_switch_on_eof) = 1; ++} + ++static void yy_load_buffer_state (void) ++{ ++ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; ++ (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; ++ yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; ++ (yy_hold_char) = *(yy_c_buf_p); ++} + +-#ifdef YY_USE_PROTOS +-YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) +-#else +-YY_BUFFER_STATE yy_create_buffer( file, size ) +-FILE *file; +-int size; +-#endif +- { ++/** Allocate and initialize an input buffer state. ++ * @param file A readable stream. ++ * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. ++ * ++ * @return the allocated buffer state. ++ */ ++ YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) ++{ + YY_BUFFER_STATE b; +- +- b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); ++ ++ b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + +@@ -1423,75 +1486,75 @@ + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ +- b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); ++ b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_is_our_buffer = 1; + +- yy_init_buffer( b, file ); ++ yy_init_buffer(b,file ); + + return b; +- } +- ++} + +-#ifdef YY_USE_PROTOS +-void yy_delete_buffer( YY_BUFFER_STATE b ) +-#else +-void yy_delete_buffer( b ) +-YY_BUFFER_STATE b; +-#endif +- { ++/** Destroy the buffer. ++ * @param b a buffer created with yy_create_buffer() ++ * ++ */ ++ void yy_delete_buffer (YY_BUFFER_STATE b ) ++{ ++ + if ( ! b ) + return; + +- if ( b == yy_current_buffer ) +- yy_current_buffer = (YY_BUFFER_STATE) 0; ++ if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ ++ YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) +- yy_flex_free( (void *) b->yy_ch_buf ); ++ yyfree((void *) b->yy_ch_buf ); + +- yy_flex_free( (void *) b ); +- } +- +- +- +-#ifdef YY_USE_PROTOS +-void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) +-#else +-void yy_init_buffer( b, file ) +-YY_BUFFER_STATE b; +-FILE *file; +-#endif ++ yyfree((void *) b ); ++} + ++#ifndef __cplusplus ++extern int isatty (int ); ++#endif /* __cplusplus */ ++ ++/* Initializes or reinitializes a buffer. ++ * This function is sometimes called more than once on the same buffer, ++ * such as during a yyrestart() or at EOF. ++ */ ++ static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) + +- { +- yy_flush_buffer( b ); ++{ ++ int oerrno = errno; ++ ++ yy_flush_buffer(b ); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + +-#if YY_ALWAYS_INTERACTIVE +- b->yy_is_interactive = 1; +-#else +-#if YY_NEVER_INTERACTIVE +- b->yy_is_interactive = 0; +-#else +- b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; +-#endif +-#endif +- } +- ++ /* If b is the current buffer, then yy_init_buffer was _probably_ ++ * called from yyrestart() or through yy_get_next_buffer. ++ * In that case, we don't want to reset the lineno or column. ++ */ ++ if (b != YY_CURRENT_BUFFER){ ++ b->yy_bs_lineno = 1; ++ b->yy_bs_column = 0; ++ } + +-#ifdef YY_USE_PROTOS +-void yy_flush_buffer( YY_BUFFER_STATE b ) +-#else +-void yy_flush_buffer( b ) +-YY_BUFFER_STATE b; +-#endif ++ b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; ++ ++ errno = oerrno; ++} + +- { +- if ( ! b ) ++/** Discard all buffered characters. On the next scan, YY_INPUT will be called. ++ * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. ++ * ++ */ ++ void yy_flush_buffer (YY_BUFFER_STATE b ) ++{ ++ if ( ! b ) + return; + + b->yy_n_chars = 0; +@@ -1508,29 +1571,121 @@ + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; + +- if ( b == yy_current_buffer ) +- yy_load_buffer_state(); ++ if ( b == YY_CURRENT_BUFFER ) ++ yy_load_buffer_state( ); ++} ++ ++/** Pushes the new state onto the stack. The new state becomes ++ * the current state. This function will allocate the stack ++ * if necessary. ++ * @param new_buffer The new state. ++ * ++ */ ++void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) ++{ ++ if (new_buffer == NULL) ++ return; ++ ++ yyensure_buffer_stack(); ++ ++ /* This block is copied from yy_switch_to_buffer. */ ++ if ( YY_CURRENT_BUFFER ) ++ { ++ /* Flush out information for old buffer. */ ++ *(yy_c_buf_p) = (yy_hold_char); ++ YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); ++ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); ++ } ++ ++ /* Only push if top exists. Otherwise, replace top. */ ++ if (YY_CURRENT_BUFFER) ++ (yy_buffer_stack_top)++; ++ YY_CURRENT_BUFFER_LVALUE = new_buffer; ++ ++ /* copied from yy_switch_to_buffer. */ ++ yy_load_buffer_state( ); ++ (yy_did_buffer_switch_on_eof) = 1; ++} ++ ++/** Removes and deletes the top of the stack, if present. ++ * The next element becomes the new top. ++ * ++ */ ++void yypop_buffer_state (void) ++{ ++ if (!YY_CURRENT_BUFFER) ++ return; ++ ++ yy_delete_buffer(YY_CURRENT_BUFFER ); ++ YY_CURRENT_BUFFER_LVALUE = NULL; ++ if ((yy_buffer_stack_top) > 0) ++ --(yy_buffer_stack_top); ++ ++ if (YY_CURRENT_BUFFER) { ++ yy_load_buffer_state( ); ++ (yy_did_buffer_switch_on_eof) = 1; ++ } ++} ++ ++/* Allocates the stack if it does not exist. ++ * Guarantees space for at least one push. ++ */ ++static void yyensure_buffer_stack (void) ++{ ++ int num_to_alloc; ++ ++ if (!(yy_buffer_stack)) { ++ ++ /* First allocation is just for 2 elements, since we don't know if this ++ * scanner will even need a stack. We use 2 instead of 1 to avoid an ++ * immediate realloc on the next call. ++ */ ++ num_to_alloc = 1; ++ (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc ++ (num_to_alloc * sizeof(struct yy_buffer_state*) ++ ); ++ ++ memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); ++ ++ (yy_buffer_stack_max) = num_to_alloc; ++ (yy_buffer_stack_top) = 0; ++ return; + } + ++ if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ + +-#ifndef YY_NO_SCAN_BUFFER +-#ifdef YY_USE_PROTOS +-YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) +-#else +-YY_BUFFER_STATE yy_scan_buffer( base, size ) +-char *base; +-yy_size_t size; +-#endif +- { +- YY_BUFFER_STATE b; ++ /* Increase the buffer to prepare for a possible push. */ ++ int grow_size = 8 /* arbitrary grow size */; + ++ num_to_alloc = (yy_buffer_stack_max) + grow_size; ++ (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc ++ ((yy_buffer_stack), ++ num_to_alloc * sizeof(struct yy_buffer_state*) ++ ); ++ ++ /* zero only the new slots.*/ ++ memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); ++ (yy_buffer_stack_max) = num_to_alloc; ++ } ++} ++ ++/** Setup the input buffer state to scan directly from a user-specified character buffer. ++ * @param base the character buffer ++ * @param size the size in bytes of the character buffer ++ * ++ * @return the newly allocated buffer state object. ++ */ ++YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) ++{ ++ YY_BUFFER_STATE b; ++ + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return 0; + +- b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); ++ b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); + +@@ -1544,47 +1699,42 @@ + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + +- yy_switch_to_buffer( b ); ++ yy_switch_to_buffer(b ); + + return b; +- } +-#endif +- +- +-#ifndef YY_NO_SCAN_STRING +-#ifdef YY_USE_PROTOS +-YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str ) +-#else +-YY_BUFFER_STATE yy_scan_string( yy_str ) +-yyconst char *yy_str; +-#endif +- { +- int len; +- for ( len = 0; yy_str[len]; ++len ) +- ; +- +- return yy_scan_bytes( yy_str, len ); +- } +-#endif ++} + ++/** Setup the input buffer state to scan a string. The next call to yylex() will ++ * scan from a @e copy of @a str. ++ * @param str a NUL-terminated string to scan ++ * ++ * @return the newly allocated buffer state object. ++ * @note If you want to scan bytes that may contain NUL values, then use ++ * yy_scan_bytes() instead. ++ */ ++YY_BUFFER_STATE yy_scan_string (yyconst char * yy_str ) ++{ ++ ++ return yy_scan_bytes(yy_str,strlen(yy_str) ); ++} + +-#ifndef YY_NO_SCAN_BYTES +-#ifdef YY_USE_PROTOS +-YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len ) +-#else +-YY_BUFFER_STATE yy_scan_bytes( bytes, len ) +-yyconst char *bytes; +-int len; +-#endif +- { ++/** Setup the input buffer state to scan the given bytes. The next call to yylex() will ++ * scan from a @e copy of @a bytes. ++ * @param bytes the byte buffer to scan ++ * @param len the number of bytes in the buffer pointed to by @a bytes. ++ * ++ * @return the newly allocated buffer state object. ++ */ ++YY_BUFFER_STATE yy_scan_bytes (yyconst char * bytes, int len ) ++{ + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + int i; +- ++ + /* Get memory for full buffer, including space for trailing EOB's. */ + n = len + 2; +- buf = (char *) yy_flex_alloc( n ); ++ buf = (char *) yyalloc(n ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + +@@ -1593,7 +1743,7 @@ + + buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; + +- b = yy_scan_buffer( buf, n ); ++ b = yy_scan_buffer(buf,n ); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); + +@@ -1603,148 +1753,164 @@ + b->yy_is_our_buffer = 1; + + return b; +- } +-#endif +- ++} + +-#ifndef YY_NO_PUSH_STATE +-#ifdef YY_USE_PROTOS +-static void yy_push_state( int new_state ) +-#else +-static void yy_push_state( new_state ) +-int new_state; ++#ifndef YY_EXIT_FAILURE ++#define YY_EXIT_FAILURE 2 + #endif +- { +- if ( yy_start_stack_ptr >= yy_start_stack_depth ) +- { +- yy_size_t new_size; + +- yy_start_stack_depth += YY_START_STACK_INCR; +- new_size = yy_start_stack_depth * sizeof( int ); ++static void yy_fatal_error (yyconst char* msg ) ++{ ++ (void) fprintf( stderr, "%s\n", msg ); ++ exit( YY_EXIT_FAILURE ); ++} + +- if ( ! yy_start_stack ) +- yy_start_stack = (int *) yy_flex_alloc( new_size ); ++/* Redefine yyless() so it works in section 3 code. */ + +- else +- yy_start_stack = (int *) yy_flex_realloc( +- (void *) yy_start_stack, new_size ); ++#undef yyless ++#define yyless(n) \ ++ do \ ++ { \ ++ /* Undo effects of setting up yytext. */ \ ++ int yyless_macro_arg = (n); \ ++ YY_LESS_LINENO(yyless_macro_arg);\ ++ yytext[yyleng] = (yy_hold_char); \ ++ (yy_c_buf_p) = yytext + yyless_macro_arg; \ ++ (yy_hold_char) = *(yy_c_buf_p); \ ++ *(yy_c_buf_p) = '\0'; \ ++ yyleng = yyless_macro_arg; \ ++ } \ ++ while ( 0 ) + +- if ( ! yy_start_stack ) +- YY_FATAL_ERROR( +- "out of memory expanding start-condition stack" ); +- } ++/* Accessor methods (get/set functions) to struct members. */ + +- yy_start_stack[yy_start_stack_ptr++] = YY_START; ++/** Get the current line number. ++ * ++ */ ++int yyget_lineno (void) ++{ ++ ++ return yylineno; ++} + +- BEGIN(new_state); +- } +-#endif ++/** Get the input stream. ++ * ++ */ ++FILE *yyget_in (void) ++{ ++ return yyin; ++} + ++/** Get the output stream. ++ * ++ */ ++FILE *yyget_out (void) ++{ ++ return yyout; ++} + +-#ifndef YY_NO_POP_STATE +-static void yy_pop_state() +- { +- if ( --yy_start_stack_ptr < 0 ) +- YY_FATAL_ERROR( "start-condition stack underflow" ); ++/** Get the length of the current token. ++ * ++ */ ++int yyget_leng (void) ++{ ++ return yyleng; ++} + +- BEGIN(yy_start_stack[yy_start_stack_ptr]); +- } +-#endif ++/** Get the current token. ++ * ++ */ + ++char *yyget_text (void) ++{ ++ return yytext; ++} + +-#ifndef YY_NO_TOP_STATE +-static int yy_top_state() +- { +- return yy_start_stack[yy_start_stack_ptr - 1]; +- } +-#endif ++/** Set the current line number. ++ * @param line_number ++ * ++ */ ++void yyset_lineno (int line_number ) ++{ ++ ++ yylineno = line_number; ++} + +-#ifndef YY_EXIT_FAILURE +-#define YY_EXIT_FAILURE 2 +-#endif ++/** Set the input stream. This does not discard the current ++ * input buffer. ++ * @param in_str A readable stream. ++ * ++ * @see yy_switch_to_buffer ++ */ ++void yyset_in (FILE * in_str ) ++{ ++ yyin = in_str ; ++} + +-#ifdef YY_USE_PROTOS +-static void yy_fatal_error( yyconst char msg[] ) +-#else +-static void yy_fatal_error( msg ) +-char msg[]; +-#endif +- { +- (void) fprintf( stderr, "%s\n", msg ); +- exit( YY_EXIT_FAILURE ); +- } ++void yyset_out (FILE * out_str ) ++{ ++ yyout = out_str ; ++} + ++int yyget_debug (void) ++{ ++ return yy_flex_debug; ++} + ++void yyset_debug (int bdebug ) ++{ ++ yy_flex_debug = bdebug ; ++} + +-/* Redefine yyless() so it works in section 3 code. */ ++/* yylex_destroy is for both reentrant and non-reentrant scanners. */ ++int yylex_destroy (void) ++{ ++ ++ /* Pop the buffer stack, destroying each element. */ ++ while(YY_CURRENT_BUFFER){ ++ yy_delete_buffer(YY_CURRENT_BUFFER ); ++ YY_CURRENT_BUFFER_LVALUE = NULL; ++ yypop_buffer_state(); ++ } + +-#undef yyless +-#define yyless(n) \ +- do \ +- { \ +- /* Undo effects of setting up yytext. */ \ +- yytext[yyleng] = yy_hold_char; \ +- yy_c_buf_p = yytext + n; \ +- yy_hold_char = *yy_c_buf_p; \ +- *yy_c_buf_p = '\0'; \ +- yyleng = n; \ +- } \ +- while ( 0 ) ++ /* Destroy the stack itself. */ ++ yyfree((yy_buffer_stack) ); ++ (yy_buffer_stack) = NULL; + ++ return 0; ++} + +-/* Internal utility routines. */ ++/* ++ * Internal utility routines. ++ */ + + #ifndef yytext_ptr +-#ifdef YY_USE_PROTOS +-static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) +-#else +-static void yy_flex_strncpy( s1, s2, n ) +-char *s1; +-yyconst char *s2; +-int n; +-#endif +- { ++static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) ++{ + register int i; +- for ( i = 0; i < n; ++i ) ++ for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; +- } ++} + #endif + + #ifdef YY_NEED_STRLEN +-#ifdef YY_USE_PROTOS +-static int yy_flex_strlen( yyconst char *s ) +-#else +-static int yy_flex_strlen( s ) +-yyconst char *s; +-#endif +- { ++static int yy_flex_strlen (yyconst char * s ) ++{ + register int n; +- for ( n = 0; s[n]; ++n ) ++ for ( n = 0; s[n]; ++n ) + ; + + return n; +- } ++} + #endif + +- +-#ifdef YY_USE_PROTOS +-static void *yy_flex_alloc( yy_size_t size ) +-#else +-static void *yy_flex_alloc( size ) +-yy_size_t size; +-#endif +- { ++void *yyalloc (yy_size_t size ) ++{ + return (void *) malloc( size ); +- } ++} + +-#ifdef YY_USE_PROTOS +-static void *yy_flex_realloc( void *ptr, yy_size_t size ) +-#else +-static void *yy_flex_realloc( ptr, size ) +-void *ptr; +-yy_size_t size; +-#endif +- { ++void *yyrealloc (void * ptr, yy_size_t size ) ++{ + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter +@@ -1753,28 +1919,31 @@ + * as though doing an assignment. + */ + return (void *) realloc( (char *) ptr, size ); +- } ++} + +-#ifdef YY_USE_PROTOS +-static void yy_flex_free( void *ptr ) +-#else +-static void yy_flex_free( ptr ) +-void *ptr; +-#endif +- { +- free( ptr ); +- } ++void yyfree (void * ptr ) ++{ ++ free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ ++} + +-#if YY_MAIN +-int main() +- { +- yylex(); +- return 0; +- } ++#define YYTABLES_NAME "yytables" ++ ++#undef YY_NEW_FILE ++#undef YY_FLUSH_BUFFER ++#undef yy_set_bol ++#undef yy_new_buffer ++#undef yy_set_interactive ++#undef yytext_ptr ++#undef YY_DO_BEFORE_ACTION ++ ++#ifdef YY_DECL_IS_OURS ++#undef YY_DECL_IS_OURS ++#undef YY_DECL + #endif + #line 79 "jsp_count.l" + + ++ + #include "driver.c" + + static void count(void) +@@ -1785,3 +1954,4 @@ + } + line_number++; + } ++ +--- sloccount-2.26.orig/pascal_count.c ++++ sloccount-2.26/pascal_count.c +@@ -1,32 +1,85 @@ +-/* A lexical scanner generated by flex */ + +-/* Scanner skeleton version: +- * $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.91 96/09/10 16:58:48 vern Exp $ +- */ ++#line 3 "" ++ ++#define YY_INT_ALIGNED short int ++ ++/* A lexical scanner generated by flex */ + + #define FLEX_SCANNER + #define YY_FLEX_MAJOR_VERSION 2 + #define YY_FLEX_MINOR_VERSION 5 ++#define YY_FLEX_SUBMINOR_VERSION 31 ++#if YY_FLEX_SUBMINOR_VERSION > 0 ++#define FLEX_BETA ++#endif + ++/* First, we deal with platform-specific or compiler-specific issues. */ ++ ++/* begin standard C headers. */ + #include +-#include ++#include ++#include ++#include + ++/* end standard C headers. */ + +-/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ +-#ifdef c_plusplus +-#ifndef __cplusplus +-#define __cplusplus ++/* flex integer type definitions */ ++ ++#ifndef FLEXINT_H ++#define FLEXINT_H ++ ++/* C99 systems have . Non-C99 systems may or may not. */ ++ ++#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L ++#include ++typedef int8_t flex_int8_t; ++typedef uint8_t flex_uint8_t; ++typedef int16_t flex_int16_t; ++typedef uint16_t flex_uint16_t; ++typedef int32_t flex_int32_t; ++typedef uint32_t flex_uint32_t; ++#else ++typedef signed char flex_int8_t; ++typedef short int flex_int16_t; ++typedef int flex_int32_t; ++typedef unsigned char flex_uint8_t; ++typedef unsigned short int flex_uint16_t; ++typedef unsigned int flex_uint32_t; ++#endif /* ! C99 */ ++ ++/* Limits of integral types. */ ++#ifndef INT8_MIN ++#define INT8_MIN (-128) ++#endif ++#ifndef INT16_MIN ++#define INT16_MIN (-32767-1) ++#endif ++#ifndef INT32_MIN ++#define INT32_MIN (-2147483647-1) ++#endif ++#ifndef INT8_MAX ++#define INT8_MAX (127) ++#endif ++#ifndef INT16_MAX ++#define INT16_MAX (32767) ++#endif ++#ifndef INT32_MAX ++#define INT32_MAX (2147483647) ++#endif ++#ifndef UINT8_MAX ++#define UINT8_MAX (255U) ++#endif ++#ifndef UINT16_MAX ++#define UINT16_MAX (65535U) + #endif ++#ifndef UINT32_MAX ++#define UINT32_MAX (4294967295U) + #endif + ++#endif /* ! FLEXINT_H */ + + #ifdef __cplusplus + +-#include +- +-/* Use prototypes in function declarations. */ +-#define YY_USE_PROTOS +- + /* The "const" storage-class-modifier is valid. */ + #define YY_USE_CONST + +@@ -34,34 +87,17 @@ + + #if __STDC__ + +-#define YY_USE_PROTOS + #define YY_USE_CONST + + #endif /* __STDC__ */ + #endif /* ! __cplusplus */ + +-#ifdef __TURBOC__ +- #pragma warn -rch +- #pragma warn -use +-#include +-#include +-#define YY_USE_CONST +-#define YY_USE_PROTOS +-#endif +- + #ifdef YY_USE_CONST + #define yyconst const + #else + #define yyconst + #endif + +- +-#ifdef YY_USE_PROTOS +-#define YY_PROTO(proto) proto +-#else +-#define YY_PROTO(proto) () +-#endif +- + /* Returned upon end-of-file. */ + #define YY_NULL 0 + +@@ -76,71 +112,71 @@ + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ +-#define BEGIN yy_start = 1 + 2 * ++#define BEGIN (yy_start) = 1 + 2 * + + /* Translate the current start state into a value that can be later handed + * to BEGIN to return to the state. The YYSTATE alias is for lex + * compatibility. + */ +-#define YY_START ((yy_start - 1) / 2) ++#define YY_START (((yy_start) - 1) / 2) + #define YYSTATE YY_START + + /* Action number for EOF rule of a given start state. */ + #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) + + /* Special action meaning "start processing a new file". */ +-#define YY_NEW_FILE yyrestart( yyin ) ++#define YY_NEW_FILE yyrestart(yyin ) + + #define YY_END_OF_BUFFER_CHAR 0 + + /* Size of default input buffer. */ ++#ifndef YY_BUF_SIZE + #define YY_BUF_SIZE 16384 ++#endif + ++#ifndef YY_TYPEDEF_YY_BUFFER_STATE ++#define YY_TYPEDEF_YY_BUFFER_STATE + typedef struct yy_buffer_state *YY_BUFFER_STATE; ++#endif + + extern int yyleng; ++ + extern FILE *yyin, *yyout; + + #define EOB_ACT_CONTINUE_SCAN 0 + #define EOB_ACT_END_OF_FILE 1 + #define EOB_ACT_LAST_MATCH 2 + +-/* The funky do-while in the following #define is used to turn the definition +- * int a single C statement (which needs a semi-colon terminator). This +- * avoids problems with code like: +- * +- * if ( condition_holds ) +- * yyless( 5 ); +- * else +- * do_something_else(); +- * +- * Prior to using the do-while the compiler would get upset at the +- * "else" because it interpreted the "if" statement as being all +- * done when it reached the ';' after the yyless() call. +- */ +- +-/* Return all but the first 'n' matched characters back to the input stream. */ +- ++ #define YY_LESS_LINENO(n) ++ ++/* Return all but the first "n" matched characters back to the input stream. */ + #define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ +- *yy_cp = yy_hold_char; \ ++ int yyless_macro_arg = (n); \ ++ YY_LESS_LINENO(yyless_macro_arg);\ ++ *yy_cp = (yy_hold_char); \ + YY_RESTORE_YY_MORE_OFFSET \ +- yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ ++ (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) + +-#define unput(c) yyunput( c, yytext_ptr ) ++#define unput(c) yyunput( c, (yytext_ptr) ) + + /* The following is because we cannot portably get our hands on size_t + * (without autoconf's help, which isn't available because we want + * flex-generated scanners to compile on their own). + */ +-typedef unsigned int yy_size_t; + ++#ifndef YY_TYPEDEF_YY_SIZE_T ++#define YY_TYPEDEF_YY_SIZE_T ++typedef unsigned int yy_size_t; ++#endif + ++#ifndef YY_STRUCT_YY_BUFFER_STATE ++#define YY_STRUCT_YY_BUFFER_STATE + struct yy_buffer_state + { + FILE *yy_input_file; +@@ -177,12 +213,16 @@ + */ + int yy_at_bol; + ++ int yy_bs_lineno; /**< The line count. */ ++ int yy_bs_column; /**< The column count. */ ++ + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; ++ + #define YY_BUFFER_NEW 0 + #define YY_BUFFER_NORMAL 1 + /* When an EOF's been seen but there's still some text to process +@@ -196,23 +236,33 @@ + * just pointing yyin at a new input file. + */ + #define YY_BUFFER_EOF_PENDING 2 ++ + }; ++#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +-static YY_BUFFER_STATE yy_current_buffer = 0; ++/* Stack of input buffers. */ ++static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ ++static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ ++static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ + + /* We provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general + * "scanner state". ++ * ++ * Returns the top of the stack, or NULL. + */ +-#define YY_CURRENT_BUFFER yy_current_buffer ++#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ ++ ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ ++ : NULL) + ++/* Same as previous macro, but useful when we know that the buffer stack is not ++ * NULL or when we need an lvalue. For internal use only. ++ */ ++#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] + + /* yy_hold_char holds the character lost when yytext is formed. */ + static char yy_hold_char; +- + static int yy_n_chars; /* number of characters read into yy_ch_buf */ +- +- + int yyleng; + + /* Points to current character in buffer. */ +@@ -225,51 +275,70 @@ + */ + static int yy_did_buffer_switch_on_eof; + +-void yyrestart YY_PROTO(( FILE *input_file )); +- +-void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); +-void yy_load_buffer_state YY_PROTO(( void )); +-YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); +-void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); +-void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); +-void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); +-#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) +- +-YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); +-YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str )); +-YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); +- +-static void *yy_flex_alloc YY_PROTO(( yy_size_t )); +-static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); +-static void yy_flex_free YY_PROTO(( void * )); ++void yyrestart (FILE *input_file ); ++void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); ++YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ); ++void yy_delete_buffer (YY_BUFFER_STATE b ); ++void yy_flush_buffer (YY_BUFFER_STATE b ); ++void yypush_buffer_state (YY_BUFFER_STATE new_buffer ); ++void yypop_buffer_state (void ); ++ ++static void yyensure_buffer_stack (void ); ++static void yy_load_buffer_state (void ); ++static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); ++ ++#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ) ++ ++YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); ++YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); ++YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ); ++ ++void *yyalloc (yy_size_t ); ++void *yyrealloc (void *,yy_size_t ); ++void yyfree (void * ); + + #define yy_new_buffer yy_create_buffer + + #define yy_set_interactive(is_interactive) \ + { \ +- if ( ! yy_current_buffer ) \ +- yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ +- yy_current_buffer->yy_is_interactive = is_interactive; \ ++ if ( ! YY_CURRENT_BUFFER ){ \ ++ yyensure_buffer_stack (); \ ++ YY_CURRENT_BUFFER_LVALUE = \ ++ yy_create_buffer(yyin,YY_BUF_SIZE ); \ ++ } \ ++ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ + } + + #define yy_set_bol(at_bol) \ + { \ +- if ( ! yy_current_buffer ) \ +- yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ +- yy_current_buffer->yy_at_bol = at_bol; \ ++ if ( ! YY_CURRENT_BUFFER ){\ ++ yyensure_buffer_stack (); \ ++ YY_CURRENT_BUFFER_LVALUE = \ ++ yy_create_buffer(yyin,YY_BUF_SIZE ); \ ++ } \ ++ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ + } + +-#define YY_AT_BOL() (yy_current_buffer->yy_at_bol) ++#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) + ++/* Begin user sect3 */ + +-#define yywrap() 1 ++#define yywrap(n) 1 + #define YY_SKIP_YYWRAP ++ + typedef unsigned char YY_CHAR; ++ + FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; ++ + typedef int yy_state_type; ++ ++extern int yylineno; ++ ++int yylineno = 1; ++ + extern char *yytext; + #define yytext_ptr yytext +-static yyconst short yy_nxt[][10] = ++static yyconst flex_int16_t yy_nxt[][10] = + { + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +@@ -424,25 +493,31 @@ + + } ; + +- +-static yy_state_type yy_get_previous_state YY_PROTO(( void )); +-static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); +-static int yy_get_next_buffer YY_PROTO(( void )); +-static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); ++static yy_state_type yy_get_previous_state (void ); ++static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); ++static int yy_get_next_buffer (void ); ++static void yy_fatal_error (yyconst char msg[] ); + + /* Done after the current pattern has been matched and before the + * corresponding action - sets up yytext. + */ + #define YY_DO_BEFORE_ACTION \ +- yytext_ptr = yy_bp; \ +- yyleng = (int) (yy_cp - yy_bp); \ +- yy_hold_char = *yy_cp; \ ++ (yytext_ptr) = yy_bp; \ ++ yyleng = (size_t) (yy_cp - yy_bp); \ ++ (yy_hold_char) = *yy_cp; \ + *yy_cp = '\0'; \ +- yy_c_buf_p = yy_cp; ++ (yy_c_buf_p) = yy_cp; + + #define YY_NUM_RULES 20 + #define YY_END_OF_BUFFER 21 +-static yyconst short int yy_accept[37] = ++/* This struct is not used in this scanner, ++ but its presence is necessary. */ ++struct yy_trans_info ++ { ++ flex_int32_t yy_verify; ++ flex_int32_t yy_nxt; ++ }; ++static yyconst flex_int16_t yy_accept[37] = + { 0, + 0, 0, 0, 0, 0, 0, 0, 0, 21, 6, + 1, 3, 5, 7, 4, 8, 9, 10, 13, 14, +@@ -450,7 +525,7 @@ + 12, 10, 13, 14, 16, 18 + } ; + +-static yyconst int yy_ec[256] = ++static yyconst flex_int32_t yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, +@@ -482,6 +557,9 @@ + 1, 1, 1, 1, 1 + } ; + ++extern int yy_flex_debug; ++int yy_flex_debug = 0; ++ + /* The intent behind this definition is that it'll catch + * any uses of REJECT which flex missed. + */ +@@ -491,7 +569,6 @@ + #define YY_RESTORE_YY_MORE_OFFSET + char *yytext; + #line 1 "pascal_count.l" +-#define INITIAL 0 + #line 2 "pascal_count.l" + + /* +@@ -524,12 +601,27 @@ + /* 1 if we saw a non-comment, non-whitespace char on this line */ + int saw_char = 0; + +-#define comment 1 + +-#define bcomment 2 + ++ ++#line 608 "" ++ ++#define INITIAL 0 ++#define comment 1 ++#define bcomment 2 + #define string 3 + ++#ifndef YY_NO_UNISTD_H ++/* Special case for "unistd.h", since it is non-ANSI. We include it way ++ * down here because we want the user's section 1 to have been scanned first. ++ * The user has a chance to override it with an option. ++ */ ++#include ++#endif ++ ++#ifndef YY_EXTRA_TYPE ++#define YY_EXTRA_TYPE void * ++#endif + + /* Macros after this point can all be overridden by user definitions in + * section 1. +@@ -537,65 +629,30 @@ + + #ifndef YY_SKIP_YYWRAP + #ifdef __cplusplus +-extern "C" int yywrap YY_PROTO(( void )); ++extern "C" int yywrap (void ); + #else +-extern int yywrap YY_PROTO(( void )); ++extern int yywrap (void ); + #endif + #endif + +-#ifndef YY_NO_UNPUT +-static void yyunput YY_PROTO(( int c, char *buf_ptr )); +-#endif +- ++ static void yyunput (int c,char *buf_ptr ); ++ + #ifndef yytext_ptr +-static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); ++static void yy_flex_strncpy (char *,yyconst char *,int ); + #endif + + #ifdef YY_NEED_STRLEN +-static int yy_flex_strlen YY_PROTO(( yyconst char * )); ++static int yy_flex_strlen (yyconst char * ); + #endif + + #ifndef YY_NO_INPUT ++ + #ifdef __cplusplus +-static int yyinput YY_PROTO(( void )); ++static int yyinput (void ); + #else +-static int input YY_PROTO(( void )); +-#endif +-#endif +- +-#if YY_STACK_USED +-static int yy_start_stack_ptr = 0; +-static int yy_start_stack_depth = 0; +-static int *yy_start_stack = 0; +-#ifndef YY_NO_PUSH_STATE +-static void yy_push_state YY_PROTO(( int new_state )); +-#endif +-#ifndef YY_NO_POP_STATE +-static void yy_pop_state YY_PROTO(( void )); +-#endif +-#ifndef YY_NO_TOP_STATE +-static int yy_top_state YY_PROTO(( void )); ++static int input (void ); + #endif + +-#else +-#define YY_NO_PUSH_STATE 1 +-#define YY_NO_POP_STATE 1 +-#define YY_NO_TOP_STATE 1 +-#endif +- +-#ifdef YY_MALLOC_DECL +-YY_MALLOC_DECL +-#else +-#if __STDC__ +-#ifndef __cplusplus +-#include +-#endif +-#else +-/* Just try to get by without declaring the routines. This will fail +- * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) +- * or sizeof(void*) != sizeof(int). +- */ +-#endif + #endif + + /* Amount of stuff to slurp up with each read. */ +@@ -604,7 +661,6 @@ + #endif + + /* Copy whatever the last rule matched to the standard output. */ +- + #ifndef ECHO + /* This used to be an fputs(), but since the string might contain NUL's, + * we now use fwrite(). +@@ -617,9 +673,10 @@ + */ + #ifndef YY_INPUT + #define YY_INPUT(buf,result,max_size) \ +- if ( yy_current_buffer->yy_is_interactive ) \ ++ if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ + { \ +- int c = '*', n; \ ++ int c = '*'; \ ++ size_t n; \ + for ( n = 0; n < max_size && \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ +@@ -629,9 +686,22 @@ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ +- else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \ +- && ferror( yyin ) ) \ +- YY_FATAL_ERROR( "input in flex scanner failed" ); ++ else \ ++ { \ ++ errno=0; \ ++ while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ ++ { \ ++ if( errno != EINTR) \ ++ { \ ++ YY_FATAL_ERROR( "input in flex scanner failed" ); \ ++ break; \ ++ } \ ++ errno=0; \ ++ clearerr(yyin); \ ++ } \ ++ }\ ++\ ++ + #endif + + /* No semi-colon after return; correct usage is to write "yyterminate();" - +@@ -652,12 +722,18 @@ + #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) + #endif + ++/* end tables serialization structures and prototypes */ ++ + /* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ + #ifndef YY_DECL +-#define YY_DECL int yylex YY_PROTO(( void )) +-#endif ++#define YY_DECL_IS_OURS 1 ++ ++extern int yylex (void); ++ ++#define YY_DECL int yylex (void) ++#endif /* !YY_DECL */ + + /* Code executed at the beginning of each rule, after yytext and yyleng + * have been set up. +@@ -674,29 +750,32 @@ + #define YY_RULE_SETUP \ + YY_USER_ACTION + ++/** The main scanner function which does all the work. ++ */ + YY_DECL +- { ++{ + register yy_state_type yy_current_state; +- register char *yy_cp = NULL, *yy_bp = NULL; ++ register char *yy_cp, *yy_bp; + register int yy_act; +- ++ + #line 43 "pascal_count.l" + + line_number = 1; + saw_char = 0; + BEGIN(INITIAL); + ++#line 768 "" + +- if ( yy_init ) ++ if ( (yy_init) ) + { +- yy_init = 0; ++ (yy_init) = 0; + + #ifdef YY_USER_INIT + YY_USER_INIT; + #endif + +- if ( ! yy_start ) +- yy_start = 1; /* first start state */ ++ if ( ! (yy_start) ) ++ (yy_start) = 1; /* first start state */ + + if ( ! yyin ) + yyin = stdin; +@@ -704,28 +783,30 @@ + if ( ! yyout ) + yyout = stdout; + +- if ( ! yy_current_buffer ) +- yy_current_buffer = +- yy_create_buffer( yyin, YY_BUF_SIZE ); ++ if ( ! YY_CURRENT_BUFFER ) { ++ yyensure_buffer_stack (); ++ YY_CURRENT_BUFFER_LVALUE = ++ yy_create_buffer(yyin,YY_BUF_SIZE ); ++ } + +- yy_load_buffer_state(); ++ yy_load_buffer_state( ); + } + + while ( 1 ) /* loops until end-of-file is reached */ + { +- yy_cp = yy_c_buf_p; ++ yy_cp = (yy_c_buf_p); + + /* Support of yytext. */ +- *yy_cp = yy_hold_char; ++ *yy_cp = (yy_hold_char); + + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; + +- yy_current_state = yy_start; ++ yy_current_state = (yy_start); + yy_match: +- while ( (yy_current_state = yy_nxt[yy_current_state][yy_ec[YY_SC_TO_UI(*yy_cp)]]) > 0 ) ++ while ( (yy_current_state = yy_nxt[yy_current_state][ yy_ec[YY_SC_TO_UI(*yy_cp)] ]) > 0 ) + ++yy_cp; + + yy_current_state = -yy_current_state; +@@ -735,10 +816,8 @@ + + YY_DO_BEFORE_ACTION; + +- + do_action: /* This label is used only to access EOF actions. */ + +- + switch ( yy_act ) + { /* beginning of action switch */ + case 1: +@@ -752,6 +831,7 @@ + {BEGIN(comment);} + YY_BREAK + case 3: ++/* rule 3 can match eol */ + YY_RULE_SETUP + #line 50 "pascal_count.l" + {if (saw_char) {sloc++; saw_char=0;}; line_number++;} +@@ -782,6 +862,7 @@ + /* Do nothing */ + YY_BREAK + case 9: ++/* rule 9 can match eol */ + YY_RULE_SETUP + #line 57 "pascal_count.l" + {if (saw_char) {sloc++; saw_char=0;}; line_number++;} +@@ -792,6 +873,7 @@ + /* Do nothing */ + YY_BREAK + case 11: ++/* rule 11 can match eol */ + YY_RULE_SETUP + #line 59 "pascal_count.l" + {if (saw_char) {sloc++; saw_char=0;}; line_number++;} +@@ -807,6 +889,7 @@ + /* Do nothing */ + YY_BREAK + case 14: ++/* rule 14 can match eol */ + YY_RULE_SETUP + #line 63 "pascal_count.l" + {if (saw_char) {sloc++; saw_char=0;}; line_number++;} +@@ -822,6 +905,7 @@ + {saw_char = 1;} + YY_BREAK + case 17: ++/* rule 17 can match eol */ + YY_RULE_SETUP + #line 67 "pascal_count.l" + { +@@ -847,6 +931,7 @@ + #line 77 "pascal_count.l" + ECHO; + YY_BREAK ++#line 935 "" + case YY_STATE_EOF(INITIAL): + case YY_STATE_EOF(comment): + case YY_STATE_EOF(bcomment): +@@ -856,26 +941,26 @@ + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ +- int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; ++ int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ +- *yy_cp = yy_hold_char; ++ *yy_cp = (yy_hold_char); + YY_RESTORE_YY_MORE_OFFSET + +- if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) ++ if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed yyin at a new source and called + * yylex(). If so, then we have to assure +- * consistency between yy_current_buffer and our ++ * consistency between YY_CURRENT_BUFFER and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ +- yy_n_chars = yy_current_buffer->yy_n_chars; +- yy_current_buffer->yy_input_file = yyin; +- yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; ++ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; ++ YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; ++ YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position +@@ -885,13 +970,13 @@ + * end-of-buffer state). Contrast this with the test + * in input(). + */ +- if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) ++ if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + +- yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; ++ (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; + +- yy_current_state = yy_get_previous_state(); ++ yy_current_state = yy_get_previous_state( ); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have +@@ -904,30 +989,30 @@ + + yy_next_state = yy_try_NUL_trans( yy_current_state ); + +- yy_bp = yytext_ptr + YY_MORE_ADJ; ++ yy_bp = (yytext_ptr) + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ +- yy_cp = ++yy_c_buf_p; ++ yy_cp = ++(yy_c_buf_p); + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { +- yy_cp = yy_c_buf_p; ++ yy_cp = (yy_c_buf_p); + goto yy_find_action; + } + } + +- else switch ( yy_get_next_buffer() ) ++ else switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_END_OF_FILE: + { +- yy_did_buffer_switch_on_eof = 0; ++ (yy_did_buffer_switch_on_eof) = 0; + +- if ( yywrap() ) ++ if ( yywrap( ) ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up +@@ -938,7 +1023,7 @@ + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ +- yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; ++ (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; +@@ -946,30 +1031,30 @@ + + else + { +- if ( ! yy_did_buffer_switch_on_eof ) ++ if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: +- yy_c_buf_p = +- yytext_ptr + yy_amount_of_matched_text; ++ (yy_c_buf_p) = ++ (yytext_ptr) + yy_amount_of_matched_text; + +- yy_current_state = yy_get_previous_state(); ++ yy_current_state = yy_get_previous_state( ); + +- yy_cp = yy_c_buf_p; +- yy_bp = yytext_ptr + YY_MORE_ADJ; ++ yy_cp = (yy_c_buf_p); ++ yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: +- yy_c_buf_p = +- &yy_current_buffer->yy_ch_buf[yy_n_chars]; ++ (yy_c_buf_p) = ++ &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; + +- yy_current_state = yy_get_previous_state(); ++ yy_current_state = yy_get_previous_state( ); + +- yy_cp = yy_c_buf_p; +- yy_bp = yytext_ptr + YY_MORE_ADJ; ++ yy_cp = (yy_c_buf_p); ++ yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_find_action; + } + break; +@@ -980,8 +1065,7 @@ + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ +- } /* end of yylex */ +- ++} /* end of yylex */ + + /* yy_get_next_buffer - try to read in a new buffer + * +@@ -990,21 +1074,20 @@ + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ +- +-static int yy_get_next_buffer() +- { +- register char *dest = yy_current_buffer->yy_ch_buf; +- register char *source = yytext_ptr; ++static int yy_get_next_buffer (void) ++{ ++ register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; ++ register char *source = (yytext_ptr); + register int number_to_move, i; + int ret_val; + +- if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) ++ if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + +- if ( yy_current_buffer->yy_fill_buffer == 0 ) ++ if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ +- if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) ++ if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. +@@ -1024,34 +1107,30 @@ + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ +- number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; ++ number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + +- if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) ++ if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ +- yy_current_buffer->yy_n_chars = yy_n_chars = 0; ++ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; + + else + { +- int num_to_read = +- yy_current_buffer->yy_buf_size - number_to_move - 1; ++ size_t num_to_read = ++ YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ +-#ifdef YY_USES_REJECT +- YY_FATAL_ERROR( +-"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); +-#else + + /* just a shorter name for the current buffer */ +- YY_BUFFER_STATE b = yy_current_buffer; ++ YY_BUFFER_STATE b = YY_CURRENT_BUFFER; + + int yy_c_buf_p_offset = +- (int) (yy_c_buf_p - b->yy_ch_buf); ++ (int) ((yy_c_buf_p) - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { +@@ -1064,8 +1143,7 @@ + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ +- yy_flex_realloc( (void *) b->yy_ch_buf, +- b->yy_buf_size + 2 ); ++ yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); + } + else + /* Can't grow it, we don't own it. */ +@@ -1075,35 +1153,35 @@ + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + +- yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; ++ (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; + +- num_to_read = yy_current_buffer->yy_buf_size - ++ num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - + number_to_move - 1; +-#endif ++ + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ +- YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), +- yy_n_chars, num_to_read ); ++ YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), ++ (yy_n_chars), num_to_read ); + +- yy_current_buffer->yy_n_chars = yy_n_chars; ++ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + +- if ( yy_n_chars == 0 ) ++ if ( (yy_n_chars) == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; +- yyrestart( yyin ); ++ yyrestart(yyin ); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; +- yy_current_buffer->yy_buffer_status = ++ YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } +@@ -1111,128 +1189,112 @@ + else + ret_val = EOB_ACT_CONTINUE_SCAN; + +- yy_n_chars += number_to_move; +- yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; +- yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; ++ (yy_n_chars) += number_to_move; ++ YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; ++ YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; + +- yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; ++ (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + + return ret_val; +- } +- ++} + + /* yy_get_previous_state - get the state just before the EOB char was reached */ + +-static yy_state_type yy_get_previous_state() +- { ++ static yy_state_type yy_get_previous_state (void) ++{ + register yy_state_type yy_current_state; + register char *yy_cp; ++ ++ yy_current_state = (yy_start); + +- yy_current_state = yy_start; +- +- for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) ++ for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) + { + yy_current_state = yy_nxt[yy_current_state][(*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1)]; + } + + return yy_current_state; +- } +- ++} + + /* yy_try_NUL_trans - try to make a transition on the NUL character + * + * synopsis + * next_state = yy_try_NUL_trans( current_state ); + */ +- +-#ifdef YY_USE_PROTOS +-static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) +-#else +-static yy_state_type yy_try_NUL_trans( yy_current_state ) +-yy_state_type yy_current_state; +-#endif +- { ++ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) ++{ + register int yy_is_jam; +- ++ + yy_current_state = yy_nxt[yy_current_state][1]; + yy_is_jam = (yy_current_state <= 0); + + return yy_is_jam ? 0 : yy_current_state; +- } +- ++} + +-#ifndef YY_NO_UNPUT +-#ifdef YY_USE_PROTOS +-static void yyunput( int c, register char *yy_bp ) +-#else +-static void yyunput( c, yy_bp ) +-int c; +-register char *yy_bp; +-#endif +- { +- register char *yy_cp = yy_c_buf_p; ++ static void yyunput (int c, register char * yy_bp ) ++{ ++ register char *yy_cp; ++ ++ yy_cp = (yy_c_buf_p); + + /* undo effects of setting up yytext */ +- *yy_cp = yy_hold_char; ++ *yy_cp = (yy_hold_char); + +- if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) ++ if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + { /* need to shift things up to make room */ + /* +2 for EOB chars. */ +- register int number_to_move = yy_n_chars + 2; +- register char *dest = &yy_current_buffer->yy_ch_buf[ +- yy_current_buffer->yy_buf_size + 2]; ++ register int number_to_move = (yy_n_chars) + 2; ++ register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ ++ YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; + register char *source = +- &yy_current_buffer->yy_ch_buf[number_to_move]; ++ &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; + +- while ( source > yy_current_buffer->yy_ch_buf ) ++ while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + *--dest = *--source; + + yy_cp += (int) (dest - source); + yy_bp += (int) (dest - source); +- yy_current_buffer->yy_n_chars = +- yy_n_chars = yy_current_buffer->yy_buf_size; ++ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = ++ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; + +- if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) ++ if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } + + *--yy_cp = (char) c; + +- +- yytext_ptr = yy_bp; +- yy_hold_char = *yy_cp; +- yy_c_buf_p = yy_cp; +- } +-#endif /* ifndef YY_NO_UNPUT */ +- ++ (yytext_ptr) = yy_bp; ++ (yy_hold_char) = *yy_cp; ++ (yy_c_buf_p) = yy_cp; ++} + + #ifndef YY_NO_INPUT + #ifdef __cplusplus +-static int yyinput() ++ static int yyinput (void) + #else +-static int input() ++ static int input (void) + #endif +- { +- int c; + +- *yy_c_buf_p = yy_hold_char; ++{ ++ int c; ++ ++ *(yy_c_buf_p) = (yy_hold_char); + +- if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) ++ if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ +- if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) ++ if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + /* This was really a NUL. */ +- *yy_c_buf_p = '\0'; ++ *(yy_c_buf_p) = '\0'; + + else + { /* need more input */ +- int offset = yy_c_buf_p - yytext_ptr; +- ++yy_c_buf_p; ++ int offset = (yy_c_buf_p) - (yytext_ptr); ++ ++(yy_c_buf_p); + +- switch ( yy_get_next_buffer() ) ++ switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() +@@ -1246,16 +1308,16 @@ + */ + + /* Reset buffer status. */ +- yyrestart( yyin ); ++ yyrestart(yyin ); + +- /* fall through */ ++ /*FALLTHROUGH*/ + + case EOB_ACT_END_OF_FILE: + { +- if ( yywrap() ) ++ if ( yywrap( ) ) + return EOF; + +- if ( ! yy_did_buffer_switch_on_eof ) ++ if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; + #ifdef __cplusplus + return yyinput(); +@@ -1265,90 +1327,92 @@ + } + + case EOB_ACT_CONTINUE_SCAN: +- yy_c_buf_p = yytext_ptr + offset; ++ (yy_c_buf_p) = (yytext_ptr) + offset; + break; + } + } + } + +- c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ +- *yy_c_buf_p = '\0'; /* preserve yytext */ +- yy_hold_char = *++yy_c_buf_p; +- ++ c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ ++ *(yy_c_buf_p) = '\0'; /* preserve yytext */ ++ (yy_hold_char) = *++(yy_c_buf_p); + + return c; +- } +-#endif /* YY_NO_INPUT */ ++} ++#endif /* ifndef YY_NO_INPUT */ + +-#ifdef YY_USE_PROTOS +-void yyrestart( FILE *input_file ) +-#else +-void yyrestart( input_file ) +-FILE *input_file; +-#endif +- { +- if ( ! yy_current_buffer ) +- yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); +- +- yy_init_buffer( yy_current_buffer, input_file ); +- yy_load_buffer_state(); ++/** Immediately switch to a different input stream. ++ * @param input_file A readable stream. ++ * ++ * @note This function does not reset the start condition to @c INITIAL . ++ */ ++ void yyrestart (FILE * input_file ) ++{ ++ ++ if ( ! YY_CURRENT_BUFFER ){ ++ yyensure_buffer_stack (); ++ YY_CURRENT_BUFFER_LVALUE = ++ yy_create_buffer(yyin,YY_BUF_SIZE ); + } + +- +-#ifdef YY_USE_PROTOS +-void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) +-#else +-void yy_switch_to_buffer( new_buffer ) +-YY_BUFFER_STATE new_buffer; +-#endif +- { +- if ( yy_current_buffer == new_buffer ) ++ yy_init_buffer(YY_CURRENT_BUFFER,input_file ); ++ yy_load_buffer_state( ); ++} ++ ++/** Switch to a different input buffer. ++ * @param new_buffer The new input buffer. ++ * ++ */ ++ void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) ++{ ++ ++ /* TODO. We should be able to replace this entire function body ++ * with ++ * yypop_buffer_state(); ++ * yypush_buffer_state(new_buffer); ++ */ ++ yyensure_buffer_stack (); ++ if ( YY_CURRENT_BUFFER == new_buffer ) + return; + +- if ( yy_current_buffer ) ++ if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ +- *yy_c_buf_p = yy_hold_char; +- yy_current_buffer->yy_buf_pos = yy_c_buf_p; +- yy_current_buffer->yy_n_chars = yy_n_chars; ++ *(yy_c_buf_p) = (yy_hold_char); ++ YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); ++ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + +- yy_current_buffer = new_buffer; +- yy_load_buffer_state(); ++ YY_CURRENT_BUFFER_LVALUE = new_buffer; ++ yy_load_buffer_state( ); + + /* We don't actually know whether we did this switch during + * EOF (yywrap()) processing, but the only time this flag + * is looked at is after yywrap() is called, so it's safe + * to go ahead and always set it. + */ +- yy_did_buffer_switch_on_eof = 1; +- } +- +- +-#ifdef YY_USE_PROTOS +-void yy_load_buffer_state( void ) +-#else +-void yy_load_buffer_state() +-#endif +- { +- yy_n_chars = yy_current_buffer->yy_n_chars; +- yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; +- yyin = yy_current_buffer->yy_input_file; +- yy_hold_char = *yy_c_buf_p; +- } ++ (yy_did_buffer_switch_on_eof) = 1; ++} + +- +-#ifdef YY_USE_PROTOS +-YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) +-#else +-YY_BUFFER_STATE yy_create_buffer( file, size ) +-FILE *file; +-int size; +-#endif +- { ++static void yy_load_buffer_state (void) ++{ ++ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; ++ (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; ++ yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; ++ (yy_hold_char) = *(yy_c_buf_p); ++} ++ ++/** Allocate and initialize an input buffer state. ++ * @param file A readable stream. ++ * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. ++ * ++ * @return the allocated buffer state. ++ */ ++ YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) ++{ + YY_BUFFER_STATE b; +- +- b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); ++ ++ b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + +@@ -1357,75 +1421,75 @@ + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ +- b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); ++ b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_is_our_buffer = 1; + +- yy_init_buffer( b, file ); ++ yy_init_buffer(b,file ); + + return b; +- } +- ++} + +-#ifdef YY_USE_PROTOS +-void yy_delete_buffer( YY_BUFFER_STATE b ) +-#else +-void yy_delete_buffer( b ) +-YY_BUFFER_STATE b; +-#endif +- { ++/** Destroy the buffer. ++ * @param b a buffer created with yy_create_buffer() ++ * ++ */ ++ void yy_delete_buffer (YY_BUFFER_STATE b ) ++{ ++ + if ( ! b ) + return; + +- if ( b == yy_current_buffer ) +- yy_current_buffer = (YY_BUFFER_STATE) 0; ++ if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ ++ YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) +- yy_flex_free( (void *) b->yy_ch_buf ); ++ yyfree((void *) b->yy_ch_buf ); + +- yy_flex_free( (void *) b ); +- } +- +- +- +-#ifdef YY_USE_PROTOS +-void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) +-#else +-void yy_init_buffer( b, file ) +-YY_BUFFER_STATE b; +-FILE *file; +-#endif ++ yyfree((void *) b ); ++} + ++#ifndef __cplusplus ++extern int isatty (int ); ++#endif /* __cplusplus */ ++ ++/* Initializes or reinitializes a buffer. ++ * This function is sometimes called more than once on the same buffer, ++ * such as during a yyrestart() or at EOF. ++ */ ++ static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) + +- { +- yy_flush_buffer( b ); ++{ ++ int oerrno = errno; ++ ++ yy_flush_buffer(b ); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + +-#if YY_ALWAYS_INTERACTIVE +- b->yy_is_interactive = 1; +-#else +-#if YY_NEVER_INTERACTIVE +- b->yy_is_interactive = 0; +-#else +- b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; +-#endif +-#endif +- } +- +- +-#ifdef YY_USE_PROTOS +-void yy_flush_buffer( YY_BUFFER_STATE b ) +-#else +-void yy_flush_buffer( b ) +-YY_BUFFER_STATE b; +-#endif +- +- { +- if ( ! b ) ++ /* If b is the current buffer, then yy_init_buffer was _probably_ ++ * called from yyrestart() or through yy_get_next_buffer. ++ * In that case, we don't want to reset the lineno or column. ++ */ ++ if (b != YY_CURRENT_BUFFER){ ++ b->yy_bs_lineno = 1; ++ b->yy_bs_column = 0; ++ } ++ ++ b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; ++ ++ errno = oerrno; ++} ++ ++/** Discard all buffered characters. On the next scan, YY_INPUT will be called. ++ * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. ++ * ++ */ ++ void yy_flush_buffer (YY_BUFFER_STATE b ) ++{ ++ if ( ! b ) + return; + + b->yy_n_chars = 0; +@@ -1442,29 +1506,121 @@ + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; + +- if ( b == yy_current_buffer ) +- yy_load_buffer_state(); ++ if ( b == YY_CURRENT_BUFFER ) ++ yy_load_buffer_state( ); ++} ++ ++/** Pushes the new state onto the stack. The new state becomes ++ * the current state. This function will allocate the stack ++ * if necessary. ++ * @param new_buffer The new state. ++ * ++ */ ++void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) ++{ ++ if (new_buffer == NULL) ++ return; ++ ++ yyensure_buffer_stack(); ++ ++ /* This block is copied from yy_switch_to_buffer. */ ++ if ( YY_CURRENT_BUFFER ) ++ { ++ /* Flush out information for old buffer. */ ++ *(yy_c_buf_p) = (yy_hold_char); ++ YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); ++ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); ++ } ++ ++ /* Only push if top exists. Otherwise, replace top. */ ++ if (YY_CURRENT_BUFFER) ++ (yy_buffer_stack_top)++; ++ YY_CURRENT_BUFFER_LVALUE = new_buffer; ++ ++ /* copied from yy_switch_to_buffer. */ ++ yy_load_buffer_state( ); ++ (yy_did_buffer_switch_on_eof) = 1; ++} ++ ++/** Removes and deletes the top of the stack, if present. ++ * The next element becomes the new top. ++ * ++ */ ++void yypop_buffer_state (void) ++{ ++ if (!YY_CURRENT_BUFFER) ++ return; ++ ++ yy_delete_buffer(YY_CURRENT_BUFFER ); ++ YY_CURRENT_BUFFER_LVALUE = NULL; ++ if ((yy_buffer_stack_top) > 0) ++ --(yy_buffer_stack_top); ++ ++ if (YY_CURRENT_BUFFER) { ++ yy_load_buffer_state( ); ++ (yy_did_buffer_switch_on_eof) = 1; + } ++} + ++/* Allocates the stack if it does not exist. ++ * Guarantees space for at least one push. ++ */ ++static void yyensure_buffer_stack (void) ++{ ++ int num_to_alloc; ++ ++ if (!(yy_buffer_stack)) { ++ ++ /* First allocation is just for 2 elements, since we don't know if this ++ * scanner will even need a stack. We use 2 instead of 1 to avoid an ++ * immediate realloc on the next call. ++ */ ++ num_to_alloc = 1; ++ (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc ++ (num_to_alloc * sizeof(struct yy_buffer_state*) ++ ); ++ ++ memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); ++ ++ (yy_buffer_stack_max) = num_to_alloc; ++ (yy_buffer_stack_top) = 0; ++ return; ++ } + +-#ifndef YY_NO_SCAN_BUFFER +-#ifdef YY_USE_PROTOS +-YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) +-#else +-YY_BUFFER_STATE yy_scan_buffer( base, size ) +-char *base; +-yy_size_t size; +-#endif +- { +- YY_BUFFER_STATE b; ++ if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ ++ ++ /* Increase the buffer to prepare for a possible push. */ ++ int grow_size = 8 /* arbitrary grow size */; + ++ num_to_alloc = (yy_buffer_stack_max) + grow_size; ++ (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc ++ ((yy_buffer_stack), ++ num_to_alloc * sizeof(struct yy_buffer_state*) ++ ); ++ ++ /* zero only the new slots.*/ ++ memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); ++ (yy_buffer_stack_max) = num_to_alloc; ++ } ++} ++ ++/** Setup the input buffer state to scan directly from a user-specified character buffer. ++ * @param base the character buffer ++ * @param size the size in bytes of the character buffer ++ * ++ * @return the newly allocated buffer state object. ++ */ ++YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) ++{ ++ YY_BUFFER_STATE b; ++ + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return 0; + +- b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); ++ b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); + +@@ -1478,47 +1634,42 @@ + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + +- yy_switch_to_buffer( b ); ++ yy_switch_to_buffer(b ); + + return b; +- } +-#endif ++} + +- +-#ifndef YY_NO_SCAN_STRING +-#ifdef YY_USE_PROTOS +-YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str ) +-#else +-YY_BUFFER_STATE yy_scan_string( yy_str ) +-yyconst char *yy_str; +-#endif +- { +- int len; +- for ( len = 0; yy_str[len]; ++len ) +- ; +- +- return yy_scan_bytes( yy_str, len ); +- } +-#endif +- +- +-#ifndef YY_NO_SCAN_BYTES +-#ifdef YY_USE_PROTOS +-YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len ) +-#else +-YY_BUFFER_STATE yy_scan_bytes( bytes, len ) +-yyconst char *bytes; +-int len; +-#endif +- { ++/** Setup the input buffer state to scan a string. The next call to yylex() will ++ * scan from a @e copy of @a str. ++ * @param str a NUL-terminated string to scan ++ * ++ * @return the newly allocated buffer state object. ++ * @note If you want to scan bytes that may contain NUL values, then use ++ * yy_scan_bytes() instead. ++ */ ++YY_BUFFER_STATE yy_scan_string (yyconst char * yy_str ) ++{ ++ ++ return yy_scan_bytes(yy_str,strlen(yy_str) ); ++} ++ ++/** Setup the input buffer state to scan the given bytes. The next call to yylex() will ++ * scan from a @e copy of @a bytes. ++ * @param bytes the byte buffer to scan ++ * @param len the number of bytes in the buffer pointed to by @a bytes. ++ * ++ * @return the newly allocated buffer state object. ++ */ ++YY_BUFFER_STATE yy_scan_bytes (yyconst char * bytes, int len ) ++{ + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + int i; +- ++ + /* Get memory for full buffer, including space for trailing EOB's. */ + n = len + 2; +- buf = (char *) yy_flex_alloc( n ); ++ buf = (char *) yyalloc(n ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + +@@ -1527,7 +1678,7 @@ + + buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; + +- b = yy_scan_buffer( buf, n ); ++ b = yy_scan_buffer(buf,n ); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); + +@@ -1537,148 +1688,164 @@ + b->yy_is_our_buffer = 1; + + return b; +- } +-#endif +- ++} + +-#ifndef YY_NO_PUSH_STATE +-#ifdef YY_USE_PROTOS +-static void yy_push_state( int new_state ) +-#else +-static void yy_push_state( new_state ) +-int new_state; ++#ifndef YY_EXIT_FAILURE ++#define YY_EXIT_FAILURE 2 + #endif +- { +- if ( yy_start_stack_ptr >= yy_start_stack_depth ) +- { +- yy_size_t new_size; +- +- yy_start_stack_depth += YY_START_STACK_INCR; +- new_size = yy_start_stack_depth * sizeof( int ); + +- if ( ! yy_start_stack ) +- yy_start_stack = (int *) yy_flex_alloc( new_size ); ++static void yy_fatal_error (yyconst char* msg ) ++{ ++ (void) fprintf( stderr, "%s\n", msg ); ++ exit( YY_EXIT_FAILURE ); ++} + +- else +- yy_start_stack = (int *) yy_flex_realloc( +- (void *) yy_start_stack, new_size ); ++/* Redefine yyless() so it works in section 3 code. */ + +- if ( ! yy_start_stack ) +- YY_FATAL_ERROR( +- "out of memory expanding start-condition stack" ); +- } ++#undef yyless ++#define yyless(n) \ ++ do \ ++ { \ ++ /* Undo effects of setting up yytext. */ \ ++ int yyless_macro_arg = (n); \ ++ YY_LESS_LINENO(yyless_macro_arg);\ ++ yytext[yyleng] = (yy_hold_char); \ ++ (yy_c_buf_p) = yytext + yyless_macro_arg; \ ++ (yy_hold_char) = *(yy_c_buf_p); \ ++ *(yy_c_buf_p) = '\0'; \ ++ yyleng = yyless_macro_arg; \ ++ } \ ++ while ( 0 ) + +- yy_start_stack[yy_start_stack_ptr++] = YY_START; ++/* Accessor methods (get/set functions) to struct members. */ + +- BEGIN(new_state); +- } +-#endif ++/** Get the current line number. ++ * ++ */ ++int yyget_lineno (void) ++{ ++ ++ return yylineno; ++} + ++/** Get the input stream. ++ * ++ */ ++FILE *yyget_in (void) ++{ ++ return yyin; ++} + +-#ifndef YY_NO_POP_STATE +-static void yy_pop_state() +- { +- if ( --yy_start_stack_ptr < 0 ) +- YY_FATAL_ERROR( "start-condition stack underflow" ); ++/** Get the output stream. ++ * ++ */ ++FILE *yyget_out (void) ++{ ++ return yyout; ++} + +- BEGIN(yy_start_stack[yy_start_stack_ptr]); +- } +-#endif ++/** Get the length of the current token. ++ * ++ */ ++int yyget_leng (void) ++{ ++ return yyleng; ++} + ++/** Get the current token. ++ * ++ */ + +-#ifndef YY_NO_TOP_STATE +-static int yy_top_state() +- { +- return yy_start_stack[yy_start_stack_ptr - 1]; +- } +-#endif ++char *yyget_text (void) ++{ ++ return yytext; ++} + +-#ifndef YY_EXIT_FAILURE +-#define YY_EXIT_FAILURE 2 +-#endif ++/** Set the current line number. ++ * @param line_number ++ * ++ */ ++void yyset_lineno (int line_number ) ++{ ++ ++ yylineno = line_number; ++} ++ ++/** Set the input stream. This does not discard the current ++ * input buffer. ++ * @param in_str A readable stream. ++ * ++ * @see yy_switch_to_buffer ++ */ ++void yyset_in (FILE * in_str ) ++{ ++ yyin = in_str ; ++} + +-#ifdef YY_USE_PROTOS +-static void yy_fatal_error( yyconst char msg[] ) +-#else +-static void yy_fatal_error( msg ) +-char msg[]; +-#endif +- { +- (void) fprintf( stderr, "%s\n", msg ); +- exit( YY_EXIT_FAILURE ); +- } ++void yyset_out (FILE * out_str ) ++{ ++ yyout = out_str ; ++} + ++int yyget_debug (void) ++{ ++ return yy_flex_debug; ++} + ++void yyset_debug (int bdebug ) ++{ ++ yy_flex_debug = bdebug ; ++} + +-/* Redefine yyless() so it works in section 3 code. */ ++/* yylex_destroy is for both reentrant and non-reentrant scanners. */ ++int yylex_destroy (void) ++{ ++ ++ /* Pop the buffer stack, destroying each element. */ ++ while(YY_CURRENT_BUFFER){ ++ yy_delete_buffer(YY_CURRENT_BUFFER ); ++ YY_CURRENT_BUFFER_LVALUE = NULL; ++ yypop_buffer_state(); ++ } + +-#undef yyless +-#define yyless(n) \ +- do \ +- { \ +- /* Undo effects of setting up yytext. */ \ +- yytext[yyleng] = yy_hold_char; \ +- yy_c_buf_p = yytext + n; \ +- yy_hold_char = *yy_c_buf_p; \ +- *yy_c_buf_p = '\0'; \ +- yyleng = n; \ +- } \ +- while ( 0 ) ++ /* Destroy the stack itself. */ ++ yyfree((yy_buffer_stack) ); ++ (yy_buffer_stack) = NULL; + ++ return 0; ++} + +-/* Internal utility routines. */ ++/* ++ * Internal utility routines. ++ */ + + #ifndef yytext_ptr +-#ifdef YY_USE_PROTOS +-static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) +-#else +-static void yy_flex_strncpy( s1, s2, n ) +-char *s1; +-yyconst char *s2; +-int n; +-#endif +- { ++static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) ++{ + register int i; +- for ( i = 0; i < n; ++i ) ++ for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; +- } ++} + #endif + + #ifdef YY_NEED_STRLEN +-#ifdef YY_USE_PROTOS +-static int yy_flex_strlen( yyconst char *s ) +-#else +-static int yy_flex_strlen( s ) +-yyconst char *s; +-#endif +- { ++static int yy_flex_strlen (yyconst char * s ) ++{ + register int n; +- for ( n = 0; s[n]; ++n ) ++ for ( n = 0; s[n]; ++n ) + ; + + return n; +- } ++} + #endif + +- +-#ifdef YY_USE_PROTOS +-static void *yy_flex_alloc( yy_size_t size ) +-#else +-static void *yy_flex_alloc( size ) +-yy_size_t size; +-#endif +- { ++void *yyalloc (yy_size_t size ) ++{ + return (void *) malloc( size ); +- } ++} + +-#ifdef YY_USE_PROTOS +-static void *yy_flex_realloc( void *ptr, yy_size_t size ) +-#else +-static void *yy_flex_realloc( ptr, size ) +-void *ptr; +-yy_size_t size; +-#endif +- { ++void *yyrealloc (void * ptr, yy_size_t size ) ++{ + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter +@@ -1687,28 +1854,32 @@ + * as though doing an assignment. + */ + return (void *) realloc( (char *) ptr, size ); +- } ++} + +-#ifdef YY_USE_PROTOS +-static void yy_flex_free( void *ptr ) +-#else +-static void yy_flex_free( ptr ) +-void *ptr; +-#endif +- { +- free( ptr ); +- } ++void yyfree (void * ptr ) ++{ ++ free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ ++} + +-#if YY_MAIN +-int main() +- { +- yylex(); +- return 0; +- } ++#define YYTABLES_NAME "yytables" ++ ++#undef YY_NEW_FILE ++#undef YY_FLUSH_BUFFER ++#undef yy_set_bol ++#undef yy_new_buffer ++#undef yy_set_interactive ++#undef yytext_ptr ++#undef YY_DO_BEFORE_ACTION ++ ++#ifdef YY_DECL_IS_OURS ++#undef YY_DECL_IS_OURS ++#undef YY_DECL + #endif + #line 77 "pascal_count.l" + + ++ + #include "driver.c" + + ++ +--- sloccount-2.26.orig/makefile ++++ sloccount-2.26/makefile +@@ -84,6 +84,10 @@ + jsp_count$(EXE_SUFFIX) \ + ml_count$(EXE_SUFFIX) + ++FLEX_GENERATED= \ ++ pascal_count \ ++ jsp_count ++ + EXECUTABLES= \ + ada_count \ + asm_count \ +@@ -184,13 +188,13 @@ + rm -fr $(DOC_DIR) + + +-install: install_programs install_man install_docs ++install: install_programs install_man + + uninstall: uninstall_programs uninstall_docs uninstall_man + + + clean: +- -rm -f $(COMPILED_EXECUTABLES) core sloccount.1.gz ++ -rm -f $(COMPILED_EXECUTABLES) $(FLEX_GENERATED) core sloccount.1.gz + + phptest: php_count + ./php_count *.php +--- sloccount-2.26.orig/sloccount ++++ sloccount-2.26/sloccount +@@ -60,17 +60,6 @@ + notopfollow="" + showother="" + +-# Perl 5.8.0 handles the "LANG" environment variable oddly; +-# if it includes ".UTF-8" (which is does in Red Hat Linux 9 and others) +-# then it will bitterly complain about ordinary text. +-# So, we'll need to filter ".UTF-8" out of LANG. +-if [ x"$LANG" != x ] +-then +- LANG=`echo "$LANG" | sed -e 's/\.UTF-8//'` +- export LANG +- # echo "New LANG variable: $LANG" +-fi +- + while [ "$#" -gt 0 ] + do + case "$1" --- sloccount-2.26.orig/debian/patches/40_bts281293_ignore_autotools_files.dpatch +++ sloccount-2.26/debian/patches/40_bts281293_ignore_autotools_files.dpatch @@ -0,0 +1,51 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 40_bts281293_ignore_autotools_files.dpatch by Ronald Aigner +## +## DP: Ignore autotools generated files + +@DPATCH@ + +diff -u sloccount-2.26/break_filelist sloccount-2.26-autotool/break_filelist +--- sloccount-2.26/break_filelist 2004-08-01 06:17:28.000000000 +0200 ++++ sloccount-2.26-autotool/break_filelist 2008-02-20 13:21:20.000000000 +0100 +@@ -149,6 +149,7 @@ + # .am automake input + + %file_extensions = ( ++ "am" => "makefile", + "c" => "ansic", + "ec" => "ansic", # Informix C. + "ecp" => "ansic", # Informix C. +@@ -966,6 +967,23 @@ + return "auto"; + } + ++ # Skip files generated by auto-* tools. These can be identified by a ++ # matching file with an ".in" or ".am" extension. ++ if (-s "${file_to_examine}.in") { ++ print "Note: Auto-generated file $file_to_examine\n" ++ if $noisy; ++ return "auto"; ++ } ++ if ($file_to_examine =~ m/\.in$/) { ++ $possible_auto = $file_to_examine; ++ $possible_auto =~ s/\.in$/\.am/; ++ if (-s "$possible_auto") { ++ print "Note: Auto-generated file $file_to_examine\n" ++ if $noisy; ++ return "auto"; ++ } ++ } ++ + if (($basename eq "lex.yy.c") || # Flex/Lex output! + ($basename eq "lex.yy.cc") || # Flex/Lex output - C++ scanner. + ($basename eq "y.code.c") || # yacc/bison output. +@@ -1013,6 +1031,8 @@ + if (($file_to_examine =~ m/\bmakefile$/i) || + ($file_to_examine =~ m/\bmakefile\.txt$/i) || + ($file_to_examine =~ m/\bmakefile\.pc$/i) || ++ ($file_to_examine =~ m/\bmakefile\.in$/i) || ++ ($file_to_examine =~ m/\bmakefile\.am$/i) || + ($file_to_examine =~ m/\bdebian\/rules$/i)) { # "debian/rules" too. + return "makefile"; + } --- sloccount-2.26.orig/debian/patches/80_javascript_support.dpatch +++ sloccount-2.26/debian/patches/80_javascript_support.dpatch @@ -0,0 +1,29 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 80_javascript_support.dpatch by +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Enable javascript support + +@DPATCH@ +diff -urNad sloccount-2.26~/break_filelist sloccount-2.26/break_filelist +--- sloccount-2.26~/break_filelist 2010-09-24 08:59:27.635996115 +0200 ++++ sloccount-2.26/break_filelist 2010-09-24 08:59:51.259995846 +0200 +@@ -209,6 +209,7 @@ + "hs" => "haskell", "lhs" => "haskell", + # ???: .pco is Oracle Cobol + "jsp" => "jsp", # Java server pages ++ "js" => "javascript", # Java server pages + "vhd" => "vhdl", # VHDL code + "xml" => "xml", # XML files + ); +diff -urNad sloccount-2.26~/compute_sloc_lang sloccount-2.26/compute_sloc_lang +--- sloccount-2.26~/compute_sloc_lang 2004-08-01 05:02:54.000000000 +0200 ++++ sloccount-2.26/compute_sloc_lang 2010-09-24 09:00:04.823996140 +0200 +@@ -43,6 +43,7 @@ + ansic) use_c_count="y" ;; + cpp) use_c_count="y" ;; + java) use_c_count="y" ;; ++ javascript) use_c_count="y" ;; + yacc) use_c_count="y" ;; + cs) use_c_count="y" ;; + *) use_c_count="n" ;; --- sloccount-2.26.orig/debian/patches/00list +++ sloccount-2.26/debian/patches/00list @@ -0,0 +1,9 @@ +01_restore_pristine_code +10_fix_manpage +20_bts462392_erlang_support +30_bts466827_enhance_bison_flex +40_bts281293_ignore_autotools_files +50_bts379448_ruby_recognize +60_bts508557_vhdl_support +70_bts508556_xml_support +80_javascript_support.dpatch --- sloccount-2.26.orig/debian/patches/50_bts379448_ruby_recognize.dpatch +++ sloccount-2.26/debian/patches/50_bts379448_ruby_recognize.dpatch @@ -0,0 +1,20 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 50_bts379448_ruby_recognize.dpatch by Ronald Aigner +## +## DP: Recognize ruby script by shebang + +@DPATCH@ + +diff -u sloccount-2.26/break_filelist sloccount-2.26-ruby/break_filelist +--- sloccount-2.26/break_filelist 2004-08-01 06:17:28.000000000 +0200 ++++ sloccount-2.26-ruby/break_filelist 2008-02-20 14:15:59.000000000 +0100 +@@ -903,6 +903,9 @@ + if ($command =~ m/^python[0-9\.]*(\.exe)?$/i) { + return "python"; + } ++ if ($command =~ m/^ruby[0-9\.]*(\.exe)?$/i) { ++ return "ruby"; ++ } + if ($command =~ m/^(tcl|tclsh|bltwish|wish|wishx|WISH)[0-9\.]*(\.exe)?$/i) { + return "tcl"; + } --- sloccount-2.26.orig/debian/patches/30_bts466827_enhance_bison_flex.dpatch +++ sloccount-2.26/debian/patches/30_bts466827_enhance_bison_flex.dpatch @@ -0,0 +1,71 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 30_bts466827_enhance_bison_flex.dpatch by Ronald Aigner +## +## DP: Enhance the recognition of bison/flex source files + +@DPATCH@ + +diff -u sloccount-2.26/break_filelist sloccount-2.26-bison-flex/break_filelist +--- sloccount-2.26/break_filelist 2004-08-01 06:17:28.000000000 +0200 ++++ sloccount-2.26-bison-flex/break_filelist 2008-02-20 13:27:10.000000000 +0100 +@@ -189,7 +189,9 @@ + "awk" => "awk", + "sed" => "sed", + "y" => "yacc", ++ "yy" => "yacc", + "l" => "lex", ++ "ll" => "lex", + "makefile" => "makefile", + "sql" => "sql", + "php" => "php", "php3" => "php", "php4" => "php", "php5" => "php", +@@ -850,6 +852,12 @@ + if (($firstline =~ m@^[,.]\\"@) && + $filename =~ m@\.(c|cpp|C|cxx|cc)$@) {return "not";} + ++ # Make some more tests for Bison-generated files ++ if ($firstline =~ m@A Bison parser, made by GNU Bison@) { ++ print "Note: found bison-generated file $filename\n" ++ if $noisy; ++ return "auto"; ++ } + + if (!($firstline =~ m@^#!@)) {return "";} # No script indicator here. + +@@ -990,6 +998,37 @@ + return "auto"; + } + } ++ if ($basename =~ m/\.tab\.[ch]{2}$/) { ++ $possible_bison = $file_to_examine; ++ $possible_bison =~ s/\.tab\.[ch]{2}$/\.yy/; ++ if (-s "$possible_bison") { ++ print "Note: found bison-generated file $file_to_examine\n" ++ if $noisy; ++ return "auto"; ++ } ++ } ++ ++ # Flex may generate arbitraty files. Try to be a bit clever about the ++ # generated file. (Flex generates only C/C++ files - no header files.) ++ if ($basename =~ m/.c$/) { ++ $possible_flex = $file_to_examine; ++ $possible_flex =~ s/.c$/\.l/; ++ if (-s "$possible_flex") { ++ print "Note: found flex-generated file $file_to_examine\n" ++ if $noisy; ++ return "auto"; ++ } ++ } ++ if ($basename =~ m/.cc$/) { ++ $possible_flex = $file_to_examine; ++ $possible_flex =~ s/.cc$/\.ll/; ++ if (-s "$possible_flex") { ++ print "Note: found flex-generated file $file_to_examine\n" ++ if $noisy; ++ return "auto"; ++ } ++ } ++ + + # If there's a corresponding ".MASTER" file, treat this file + # as automatically-generated derivative. This handles "exmh". --- sloccount-2.26.orig/debian/patches/10_fix_manpage.dpatch +++ sloccount-2.26/debian/patches/10_fix_manpage.dpatch @@ -0,0 +1,36 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 10_fix_manpage.dpatch by Sandro Tosi +## +## DP: Fix minus signes used as hyphen (lintian warning + +@DPATCH@ +diff -urNad sloccount~/sloccount.1 sloccount/sloccount.1 +--- sloccount~/sloccount.1 2008-02-17 16:49:52.000000000 +0100 ++++ sloccount/sloccount.1 2008-03-16 14:49:07.188245715 +0100 +@@ -101,7 +101,7 @@ + .TP 12 + .BI --cached + Do not recalculate; instead, use cached results from a previous execution. +-Without the --cached or --append option, ++Without the \-\-cached or \-\-append option, + sloccount automatically removes the data directory + and recreates it. + +@@ -191,7 +191,7 @@ + are not normally included in the SLOC counts, although their SLOCs are + internally calculated and they are shown in the file counts. + If you want to include more than one such language, do it by +-passing --addlang more than once, e.g., --addlang makefile --addlang sql. ++passing \-\-addlang more than once, e.g., \-\-addlang makefile \-\-addlang sql. + + .TP + .BI --addlangall +@@ -214,7 +214,7 @@ + Such filenames are exceedingly rare in source code because they're a pain + to work with using other tools, too. + Future versions of sloccount may internally use NUL-separated filenames +-(like GNU find's -print0 command) to fix this. ++(like GNU find's \-print0 command) to fix this. + + There are many more languages not yet handled by SLOCCount. + --- sloccount-2.26.orig/debian/patches/60_bts508557_vhdl_support.dpatch +++ sloccount-2.26/debian/patches/60_bts508557_vhdl_support.dpatch @@ -0,0 +1,60 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 60_bts508557_vhdl_support.dpatch by Elie De Brauwer +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Enable VHDL support + +@DPATCH@ +diff -urNad sloccount~/break_filelist sloccount/break_filelist +--- sloccount~/break_filelist 2009-01-23 23:53:57.091752874 +0100 ++++ sloccount/break_filelist 2009-01-23 23:53:57.183752871 +0100 +@@ -209,6 +209,7 @@ + "hs" => "haskell", "lhs" => "haskell", + # ???: .pco is Oracle Cobol + "jsp" => "jsp", # Java server pages ++ "vhd" => "vhdl", # VHDL code + ); + + +diff -urNad sloccount~/makefile sloccount/makefile +--- sloccount~/makefile 2009-01-23 23:53:57.067752431 +0100 ++++ sloccount/makefile 2009-01-23 23:54:32.327752659 +0100 +@@ -123,6 +123,7 @@ + sloccount \ + sql_count \ + tcl_count \ ++ vhdl_count \ + $(COMPILED_EXECUTABLES) + + MANPAGES=sloccount.1.gz +diff -urNad sloccount~/vhdl_count sloccount/vhdl_count +--- sloccount~/vhdl_count 1970-01-01 01:00:00.000000000 +0100 ++++ sloccount/vhdl_count 2009-01-23 23:53:57.183752871 +0100 +@@ -0,0 +1,27 @@ ++#!/bin/sh ++# ++# This is part of SLOCCount, a toolsuite that counts ++# source lines of code (SLOC). ++# Copyright (C) 2001-2004 David A. Wheeler. ++# ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 2 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program; if not, write to the Free Software ++# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++# ++# To contact David A. Wheeler, see his website at: ++# http://www.dwheeler.com. ++# ++# ++ ++generic_count '--' $@ ++ --- sloccount-2.26.orig/debian/patches/20_bts462392_erlang_support.dpatch +++ sloccount-2.26/debian/patches/20_bts462392_erlang_support.dpatch @@ -0,0 +1,58 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 20_bts462392_erlang_support.dpatch by Michael Gebetsroither +## +## DP: BTS 462392: add support to Erlang + +@DPATCH@ +diff -urNad sloccount~/break_filelist sloccount/break_filelist +--- sloccount~/break_filelist 2008-02-17 16:49:52.000000000 +0100 ++++ sloccount/break_filelist 2009-01-23 23:35:43.507253080 +0100 +@@ -166,6 +166,7 @@ + # can be separated. + "h" => "h", "H" => "h", "hpp" => "h", "hh" => "h", + "ada" => "ada", "adb" => "ada", "ads" => "ada", ++ "erl" => "erlang", + "pad" => "ada", # Oracle Ada preprocessor. + "f" => "fortran", "F" => "fortran", # This catches "wokka.F" as Fortran. + # Warning: "Freeze" format also uses .f. Haven't heard of problems, +diff -urNad sloccount~/erlang_count sloccount/erlang_count +--- sloccount~/erlang_count 1970-01-01 01:00:00.000000000 +0100 ++++ sloccount/erlang_count 2009-01-23 23:35:58.527252219 +0100 +@@ -0,0 +1,26 @@ ++#!/bin/sh ++# ++# This is part of SLOCCount, a toolsuite that counts ++# source lines of code (SLOC). ++# Copyright (C) 2001-2004 David A. Wheeler. ++# ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 2 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program; if not, write to the Free Software ++# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++# ++# To contact David A. Wheeler, see his website at: ++# http://www.dwheeler.com. ++# ++# ++ ++generic_count '%%' $@ +diff -urNad sloccount~/makefile sloccount/makefile +--- sloccount~/makefile 2009-01-23 23:35:43.423252870 +0100 ++++ sloccount/makefile 2009-01-23 23:35:43.507253080 +0100 +@@ -99,6 +99,7 @@ + count_extensions \ + count_unknown_ext \ + csh_count \ ++ erlang_count \ + exp_count \ + fortran_count \ + f90_count \