diff -Nru python-bibtex-1.2.5/accents.c python-bibtex-1.2.7/accents.c --- python-bibtex-1.2.5/accents.c 2010-02-15 20:54:46.000000000 +0000 +++ python-bibtex-1.2.7/accents.c 2014-03-04 08:45:20.000000000 +0000 @@ -43,108 +43,108 @@ StringMapping; CharMapping acute [] = { - {'A', 'Á'}, - {'E', 'É'}, - {'I', 'Í'}, - {'O', 'Ó'}, - {'U', 'Ú'}, - {'Y', 'Ý'}, - {'a', 'á'}, - {'e', 'é'}, - {'i', 'í'}, - {'o', 'ó'}, - {'u', 'ú'}, - {'y', 'ý'}, + {'A', '\xC1'}, + {'E', '\xC9'}, + {'I', '\xCD'}, + {'O', '\xD3'}, + {'U', '\xDA'}, + {'Y', '\xDD'}, + {'a', '\xE1'}, + {'e', '\xE9'}, + {'i', '\xED'}, + {'o', '\xF3'}, + {'u', '\xFA'}, + {'y', '\xFD'}, {0, 0} }; CharMapping grave [] = { - {'A', 'À'}, - {'E', 'È'}, - {'I', 'Ì'}, - {'O', 'Ò'}, - {'U', 'Ù'}, - {'a', 'à'}, - {'e', 'è'}, - {'i', 'ì'}, - {'o', 'ò'}, - {'u', 'ù'}, + {'A', '\xC0'}, + {'E', '\xC8'}, + {'I', '\xCC'}, + {'O', '\xD2'}, + {'U', '\xD9'}, + {'a', '\xE0'}, + {'e', '\xE8'}, + {'i', '\xEC'}, + {'o', '\xF2'}, + {'u', '\xF9'}, {0, 0} }; CharMapping hat [] = { - {'A', 'Â'}, - {'E', 'Ê'}, - {'I', 'Î'}, - {'O', 'Ô'}, - {'U', 'Û'}, - {'a', 'â'}, - {'e', 'ê'}, - {'i', 'î'}, - {'o', 'ô'}, - {'u', 'û'}, + {'A', '\xC2'}, + {'E', '\xCA'}, + {'I', '\xCE'}, + {'O', '\xD4'}, + {'U', '\xDB'}, + {'a', '\xE2'}, + {'e', '\xEA'}, + {'i', '\xEE'}, + {'o', '\xF4'}, + {'u', '\xFB'}, {0, 0} }; CharMapping trema [] = { - {'A', 'Ä'}, - {'E', 'Ë'}, - {'I', 'Ï'}, - {'O', 'Ö'}, - {'U', 'Ü'}, - {'a', 'ä'}, - {'e', 'ë'}, - {'i', 'ï'}, - {'o', 'ö'}, - {'u', 'ü'}, - {'y', 'ÿ'}, + {'A', '\xC4'}, + {'E', '\xCB'}, + {'I', '\xCF'}, + {'O', '\xD6'}, + {'U', '\xDC'}, + {'a', '\xE4'}, + {'e', '\xEB'}, + {'i', '\xEF'}, + {'o', '\xF6'}, + {'u', '\xFC'}, + {'y', '\xFF'}, {0, 0} }; CharMapping cedilla [] = { - {'C', 'Ç'}, - {'c', 'ç'}, + {'C', '\xC7'}, + {'c', '\xE7'}, {0, 0} }; CharMapping tilda [] = { - {'A', 'Ã'}, - {'O', 'Õ'}, - {'a', 'ã'}, - {'o', 'õ'}, - {'n', 'ñ'}, - {'N', 'Ñ'}, + {'A', '\xC3'}, + {'O', '\xD5'}, + {'a', '\xE3'}, + {'o', '\xF5'}, + {'n', '\xF1'}, + {'N', '\xD1'}, {0, 0} }; StringMapping commands [] = { {"backslash", "\\"}, - {"S", "§"}, - {"ss", "ß"}, - {"DH", "Ð"}, - {"dh", "ð"}, - {"AE", "Æ"}, - {"ae", "æ"}, - {"O", "Ø"}, - {"o", "ø"}, - {"TH", "Þ"}, - {"th", "þ"}, - {"aa", "å"}, - {"AA", "Å"}, - {"guillemotleft", "«"}, - {"guillemotright", "»"}, - {"flqq", "«"}, - {"frqq", "»"}, + {"S", "\xA7"}, + {"ss", "\xDF"}, + {"DH", "\xD0"}, + {"dh", "\xF0"}, + {"AE", "\xC6"}, + {"ae", "\xE6"}, + {"O", "\xD8"}, + {"o", "\xF8"}, + {"TH", "\xDE"}, + {"th", "\xFE"}, + {"aa", "\xE5"}, + {"AA", "\xC5"}, + {"guillemotleft", "\xAB"}, + {"guillemotright", "\xBB"}, + {"flqq", "\xAB"}, + {"frqq", "\xBB"}, {"guilsingleft", "<"}, {"guilsingright", ">"}, - {"textquestiondown", "¿"}, - {"textexclamdown", "¡"}, - {"copyright", "©"}, - {"pound", "£"}, - {"neg", "¬"}, - {"-", "­"}, - {"cdotp", "·"}, - {",", "¸"}, + {"textquestiondown", "\xBF"}, + {"textexclamdown", "\xA1"}, + {"copyright", "\xA9"}, + {"pound", "\xA3"}, + {"neg", "\xAC"}, + {"-", "\xAD"}, + {"cdotp", "\xB7"}, + {",", "\xB8"}, {NULL, NULL} }; @@ -340,7 +340,8 @@ /* Put everything lowercase */ if (is_noun) { - g_strdown (text); + gchar* c = text; + for (; *c != '\0'; *c = g_ascii_tolower(*c), c++); } current = text; diff -Nru python-bibtex-1.2.5/author.c python-bibtex-1.2.7/author.c --- python-bibtex-1.2.5/author.c 2010-02-15 20:54:46.000000000 +0000 +++ python-bibtex-1.2.7/author.c 2014-03-04 08:45:20.000000000 +0000 @@ -119,21 +119,11 @@ guint level; } BTGroup; -static GMemChunk * chunk = NULL; - static BTGroup * btgroup_new (gchar * text, guint level) { - BTGroup * group; - - if (chunk == NULL) { - chunk = g_mem_chunk_new ("BTGroup", - sizeof (BTGroup), - sizeof (BTGroup) * 16, - G_ALLOC_AND_FREE); - } + BTGroup * group = g_new (BTGroup, 1); - group = g_chunk_new (BTGroup, chunk); group->text = text; group->level = level; @@ -142,8 +132,7 @@ static void btgroup_destroy (BTGroup * group) { - - g_chunk_free (group, chunk); + g_free (group); } /* this function adds the comma separated blocks to the token list */ @@ -153,14 +142,11 @@ gchar * data, guint level) { gchar * text, * courant, sep; - gboolean one = TRUE; text = data; courant = data; while ((text = strchr (text, ',')) != NULL) { - one = FALSE; - sep = * text; * text = '\0'; @@ -375,7 +361,9 @@ lastname_section = sections; - g_strdown (text); + gchar *c = text; + for (; *c != '\0'; *c = g_ascii_tolower(*c), c++); + g_ptr_array_add (array, text); continue; } @@ -494,7 +482,7 @@ gboolean skip; GList * target; BTGroup * group, * tmp_g; - gboolean compact, first_pass; + gboolean compact; g_return_val_if_fail (s != NULL, NULL); @@ -518,7 +506,6 @@ Compact the strings as much as possible -------------------------------------------------- */ compact = FALSE; - first_pass = TRUE; while (! compact) { compact = TRUE; @@ -598,7 +585,6 @@ g_list_free (toremove); /* ...and eventually start again */ - first_pass = FALSE; } /* -------------------------------------------------- @@ -614,7 +600,7 @@ list = list->next; - if (g_strcasecmp (text, "and") == 0) { + if (g_ascii_strcasecmp (text, "and") == 0) { if (aut_elem == NULL) { bibtex_warning ("double `and' in author field"); } diff -Nru python-bibtex-1.2.5/biblex.c python-bibtex-1.2.7/biblex.c --- python-bibtex-1.2.5/biblex.c 2010-07-12 22:10:46.000000000 +0000 +++ python-bibtex-1.2.7/biblex.c 2014-03-28 10:02:00.000000000 +0000 @@ -538,8 +538,9 @@ #define YY_USER_ACTION current_source->offset += bibtex_parser_leng; +#define YY_NO_INPUT 1 -#line 543 "lex.bibtex_parser_.c" +#line 544 "lex.bibtex_parser_.c" #define INITIAL 0 #define comment 1 @@ -600,8 +601,6 @@ #endif #endif - static void yyunput (int c,char *buf_ptr ); - #ifndef yytext_ptr static void yy_flex_strncpy (char *,yyconst char *,int ); #endif @@ -630,7 +629,7 @@ /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO fwrite( bibtex_parser_text, bibtex_parser_leng, 1, bibtex_parser_out ) +#define ECHO do { if (fwrite( bibtex_parser_text, bibtex_parser_leng, 1, bibtex_parser_out )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -726,11 +725,11 @@ register char *yy_cp, *yy_bp; register int yy_act; -#line 50 "biblex.l" +#line 52 "biblex.l" if (YY_START == INITIAL) { BEGIN(comment); } -#line 734 "lex.bibtex_parser_.c" +#line 733 "lex.bibtex_parser_.c" if ( !(yy_init) ) { @@ -825,23 +824,23 @@ { /* beginning of action switch */ case 1: YY_RULE_SETUP -#line 53 "biblex.l" +#line 55 "biblex.l" BEGIN(entry); return ('@'); /* Match begin of entry */ YY_BREAK case 2: /* rule 2 can match eol */ YY_RULE_SETUP -#line 55 "biblex.l" +#line 57 "biblex.l" bibtex_next_line (); /* Increment line number */ YY_BREAK case 3: YY_RULE_SETUP -#line 57 "biblex.l" +#line 59 "biblex.l" YY_BREAK case YY_STATE_EOF(comment): case YY_STATE_EOF(entry): -#line 60 "biblex.l" +#line 62 "biblex.l" { /* Indicate EOF */ return (end_of_file); @@ -850,7 +849,7 @@ case 4: /* rule 4 can match eol */ YY_RULE_SETUP -#line 65 "biblex.l" +#line 67 "biblex.l" { /* Gestion du caractere \ */ @@ -862,7 +861,7 @@ YY_BREAK case 5: YY_RULE_SETUP -#line 74 "biblex.l" +#line 76 "biblex.l" { if (bibtex_parser_is_content) { /* Word in the text */ @@ -879,7 +878,7 @@ case 6: /* rule 6 can match eol */ YY_RULE_SETUP -#line 88 "biblex.l" +#line 90 "biblex.l" { /* Spaces handling */ char * tmp = bibtex_parser_text; @@ -900,7 +899,7 @@ YY_BREAK case 7: YY_RULE_SETUP -#line 107 "biblex.l" +#line 109 "biblex.l" { /* Lecture d'un nombre */ @@ -912,7 +911,7 @@ YY_BREAK case 8: YY_RULE_SETUP -#line 117 "biblex.l" +#line 119 "biblex.l" { /* Lecture d'un nom simple */ @@ -924,17 +923,17 @@ YY_BREAK case 9: YY_RULE_SETUP -#line 126 "biblex.l" +#line 128 "biblex.l" { return bibtex_parser_text [0]; } YY_BREAK case 10: YY_RULE_SETUP -#line 129 "biblex.l" +#line 131 "biblex.l" ECHO; YY_BREAK -#line 938 "lex.bibtex_parser_.c" +#line 937 "lex.bibtex_parser_.c" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -1230,43 +1229,6 @@ 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 bibtex_parser_text */ - *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) @@ -1909,7 +1871,7 @@ #define YYTABLES_NAME "yytables" -#line 129 "biblex.l" +#line 131 "biblex.l" diff -Nru python-bibtex-1.2.5/biblex.l python-bibtex-1.2.7/biblex.l --- python-bibtex-1.2.5/biblex.l 2010-02-15 20:54:46.000000000 +0000 +++ python-bibtex-1.2.7/biblex.l 2014-03-06 09:05:37.000000000 +0000 @@ -45,6 +45,8 @@ BODY [^{}\\\" \n\t\r~]+ %option noyywrap +%option nounput +%option noinput %x comment entry %% diff -Nru python-bibtex-1.2.5/bibparse.c python-bibtex-1.2.7/bibparse.c --- python-bibtex-1.2.5/bibparse.c 2010-07-12 22:10:45.000000000 +0000 +++ python-bibtex-1.2.7/bibparse.c 2014-03-28 10:02:00.000000000 +0000 @@ -1,24 +1,21 @@ -/* A Bison parser, made by GNU Bison 2.3. */ +/* A Bison parser, made by GNU Bison 2.5. */ -/* Skeleton implementation for Bison's Yacc-like parsers in C - - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 - Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify +/* Bison implementation for Yacc-like parsers in C + + Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc. + + 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, or (at your option) - any later version. - + the Free Software Foundation, either version 3 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 Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ + along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -29,7 +26,7 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ @@ -47,7 +44,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.3" +#define YYBISON_VERSION "2.5" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -55,47 +52,28 @@ /* Pure parsers. */ #define YYPURE 0 +/* Push parsers. */ +#define YYPUSH 0 + +/* Pull parsers. */ +#define YYPULL 1 + /* Using locations. */ #define YYLSP_NEEDED 0 /* Substitute the variable and function names. */ -#define yyparse bibtex_parser_parse -#define yylex bibtex_parser_lex -#define yyerror bibtex_parser_error -#define yylval bibtex_parser_lval -#define yychar bibtex_parser_char -#define yydebug bibtex_parser_debug -#define yynerrs bibtex_parser_nerrs - - -/* Tokens. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - end_of_file = 258, - L_NAME = 259, - L_DIGIT = 260, - L_COMMAND = 261, - L_BODY = 262, - L_SPACE = 263, - L_UBSPACE = 264 - }; -#endif -/* Tokens. */ -#define end_of_file 258 -#define L_NAME 259 -#define L_DIGIT 260 -#define L_COMMAND 261 -#define L_BODY 262 -#define L_SPACE 263 -#define L_UBSPACE 264 - - +#define yyparse bibtex_parser_parse +#define yylex bibtex_parser_lex +#define yyerror bibtex_parser_error +#define yylval bibtex_parser_lval +#define yychar bibtex_parser_char +#define yydebug bibtex_parser_debug +#define yynerrs bibtex_parser_nerrs /* Copy the first part of user declarations. */ + +/* Line 268 of yacc.c */ #line 1 "bibparse.y" @@ -202,14 +180,14 @@ is_comment = (entry->type && (strcasecmp (entry->type, "comment") == 0)); if (warning_string && ! is_comment) { - bibtex_warning (warning_string); + bibtex_warning ("%s", warning_string); } if (ret != 0) { source->line += entry->length; if (error_string && ! is_comment) { - bibtex_error (error_string); + bibtex_error ("%s", error_string); } bibtex_entry_destroy (entry, TRUE); @@ -289,6 +267,9 @@ +/* Line 268 of yacc.c */ +#line 272 "y.tab.c" + /* Enabling traces. */ #ifndef YYDEBUG # define YYDEBUG 1 @@ -307,28 +288,60 @@ # define YYTOKEN_TABLE 0 #endif + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + end_of_file = 258, + L_NAME = 259, + L_DIGIT = 260, + L_COMMAND = 261, + L_BODY = 262, + L_SPACE = 263, + L_UBSPACE = 264 + }; +#endif +/* Tokens. */ +#define end_of_file 258 +#define L_NAME 259 +#define L_DIGIT 260 +#define L_COMMAND 261 +#define L_BODY 262 +#define L_SPACE 263 +#define L_UBSPACE 264 + + + + #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 193 "bibparse.y" { + +/* Line 293 of yacc.c */ +#line 193 "bibparse.y" + gchar * text; BibtexStruct * body; -} -/* Line 187 of yacc.c. */ -#line 319 "y.tab.c" - YYSTYPE; + + + +/* Line 293 of yacc.c */ +#line 333 "y.tab.c" +} YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 #endif - /* Copy the second part of user declarations. */ -/* Line 216 of yacc.c. */ -#line 332 "y.tab.c" +/* Line 343 of yacc.c */ +#line 345 "y.tab.c" #ifdef short # undef short @@ -378,7 +391,7 @@ #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) #ifndef YY_ -# if YYENABLE_NLS +# if defined YYENABLE_NLS && YYENABLE_NLS # if ENABLE_NLS # include /* INFRINGES ON USER NAME SPACE */ # define YY_(msgid) dgettext ("bison-runtime", msgid) @@ -403,14 +416,14 @@ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static int -YYID (int i) +YYID (int yyi) #else static int -YYID (i) - int i; +YYID (yyi) + int yyi; #endif { - return i; + return yyi; } #endif @@ -431,11 +444,11 @@ # define alloca _alloca # else # define YYSTACK_ALLOC alloca -# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ +# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) # include /* INFRINGES ON USER NAME SPACE */ -# ifndef _STDLIB_H -# define _STDLIB_H 1 +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 # endif # endif # endif @@ -458,24 +471,24 @@ # ifndef YYSTACK_ALLOC_MAXIMUM # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM # endif -# if (defined __cplusplus && ! defined _STDLIB_H \ +# if (defined __cplusplus && ! defined EXIT_SUCCESS \ && ! ((defined YYMALLOC || defined malloc) \ && (defined YYFREE || defined free))) # include /* INFRINGES ON USER NAME SPACE */ -# ifndef _STDLIB_H -# define _STDLIB_H 1 +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 # endif # endif # ifndef YYMALLOC # define YYMALLOC malloc -# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ +# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free -# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ +# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif @@ -491,9 +504,9 @@ /* A type that is properly aligned for any stack member. */ union yyalloc { - yytype_int16 yyss; - YYSTYPE yyvs; - }; + yytype_int16 yyss_alloc; + YYSTYPE yyvs_alloc; +}; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) @@ -504,6 +517,27 @@ ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) +# define YYCOPY_NEEDED 1 + +/* Relocate STACK from its old location to the new one. The + local variables YYSIZE and YYSTACKSIZE give the old and new number of + elements in the stack, and YYPTR gives the new location of the + stack. Advance YYPTR to a properly aligned location for the next + stack. */ +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (YYID (0)) + +#endif + +#if defined YYCOPY_NEEDED && YYCOPY_NEEDED /* Copy COUNT objects from FROM to TO. The source and destination do not overlap. */ # ifndef YYCOPY @@ -521,24 +555,7 @@ while (YYID (0)) # endif # endif - -/* Relocate STACK from its old location to the new one. The - local variables YYSIZE and YYSTACKSIZE give the old and new number of - elements in the stack, and YYPTR gives the new location of the - stack. Advance YYPTR to a properly aligned location for the next - stack. */ -# define YYSTACK_RELOCATE(Stack) \ - do \ - { \ - YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack, Stack, yysize); \ - Stack = &yyptr->Stack; \ - yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ - yyptr += yynewbytes / sizeof (*yyptr); \ - } \ - while (YYID (0)) - -#endif +#endif /* !YYCOPY_NEEDED */ /* YYFINAL -- State number of the termination state. */ #define YYFINAL 5 @@ -623,10 +640,10 @@ /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 222, 222, 231, 240, 247, 273, 299, 306, 320, - 326, 332, 344, 393, 411, 417, 430, 430, 446, 446, - 459, 466, 475, 481, 491, 498, 506, 512, 519, 532, - 537, 546, 558, 563 + 0, 222, 222, 230, 238, 245, 269, 293, 300, 314, + 320, 326, 338, 381, 399, 405, 418, 418, 434, 434, + 447, 454, 463, 469, 479, 486, 494, 500, 507, 520, + 525, 534, 546, 551 }; #endif @@ -638,7 +655,7 @@ "$end", "error", "$undefined", "end_of_file", "L_NAME", "L_DIGIT", "L_COMMAND", "L_BODY", "L_SPACE", "L_UBSPACE", "'@'", "'{'", "'}'", "'('", "')'", "','", "'='", "'#'", "'\"'", "$accept", "entry", "values", - "value", "content", "content_brace", "@1", "content_quote", "@2", + "value", "content", "content_brace", "$@1", "content_quote", "$@2", "simple_content", "text_part", "text_brace", "text_quote", 0 }; #endif @@ -671,8 +688,8 @@ 2, 2, 0, 2 }; -/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state - STATE-NUM when YYTABLE doesn't specify something else to do. Zero +/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM. + Performed when YYTABLE doesn't specify something else to do. Zero means the default is an error. */ static const yytype_uint8 yydefact[] = { @@ -713,8 +730,7 @@ /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which - number is the opposite. If zero, do what YYDEFACT says. - If YYTABLE_NINF, syntax error. */ + number is the opposite. If YYTABLE_NINF, syntax error. */ #define YYTABLE_NINF -1 static const yytype_uint8 yytable[] = { @@ -726,6 +742,12 @@ 26, 27, 0, 49, 31, 52, 28, 50 }; +#define yypact_value_is_default(yystate) \ + ((yystate) == (-24)) + +#define yytable_value_is_error(yytable_value) \ + YYID (0) + static const yytype_int8 yycheck[] = { 7, 1, 25, 4, 4, 5, 1, 4, 5, 4, @@ -760,9 +782,18 @@ /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. - Once GCC version 2 has supplanted version 1, this can go. */ + Once GCC version 2 has supplanted version 1, this can go. However, + YYFAIL appears to be in use. Nevertheless, it is formally deprecated + in Bison 2.4.2's NEWS entry, where a plan to phase it out is + discussed. */ #define YYFAIL goto yyerrlab +#if defined YYFAIL + /* This is here to suppress warnings from the GCC cpp's + -Wunused-macros. Normally we don't worry about that warning, but + some users do, and we want to make it easy for users to remove + YYFAIL uses, which will produce warnings from Bison 2.5. */ +#endif #define YYRECOVERING() (!!yyerrstatus) @@ -772,7 +803,6 @@ { \ yychar = (Token); \ yylval = (Value); \ - yytoken = YYTRANSLATE (yychar); \ YYPOPSTACK (1); \ goto yybackup; \ } \ @@ -814,19 +844,10 @@ #endif -/* YY_LOCATION_PRINT -- Print the location on the stream. - This macro was not mandated originally: define only if we know - we won't break user code: when these are the locations we know. */ +/* This macro is provided for backward compatibility. */ #ifndef YY_LOCATION_PRINT -# if YYLTYPE_IS_TRIVIAL -# define YY_LOCATION_PRINT(File, Loc) \ - fprintf (File, "%d.%d-%d.%d", \ - (Loc).first_line, (Loc).first_column, \ - (Loc).last_line, (Loc).last_column) -# else -# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -# endif +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) #endif @@ -930,17 +951,20 @@ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void -yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) #else static void -yy_stack_print (bottom, top) - yytype_int16 *bottom; - yytype_int16 *top; +yy_stack_print (yybottom, yytop) + yytype_int16 *yybottom; + yytype_int16 *yytop; #endif { YYFPRINTF (stderr, "Stack now"); - for (; bottom <= top; ++bottom) - YYFPRINTF (stderr, " %d", *bottom); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } YYFPRINTF (stderr, "\n"); } @@ -974,11 +998,11 @@ /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { - fprintf (stderr, " $%d = ", yyi + 1); + YYFPRINTF (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], &(yyvsp[(yyi + 1) - (yynrhs)]) ); - fprintf (stderr, "\n"); + YYFPRINTF (stderr, "\n"); } } @@ -1015,7 +1039,6 @@ # define YYMAXDEPTH 10000 #endif - #if YYERROR_VERBOSE @@ -1118,115 +1141,142 @@ } # endif -/* Copy into YYRESULT an error message about the unexpected token - YYCHAR while in state YYSTATE. Return the number of bytes copied, - including the terminating null byte. If YYRESULT is null, do not - copy anything; just return the number of bytes that would be - copied. As a special case, return 0 if an ordinary "syntax error" - message will do. Return YYSIZE_MAXIMUM if overflow occurs during - size calculation. */ -static YYSIZE_T -yysyntax_error (char *yyresult, int yystate, int yychar) +/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message + about the unexpected token YYTOKEN for the state stack whose top is + YYSSP. + + Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is + not large enough to hold the message. In that case, also set + *YYMSG_ALLOC to the required number of bytes. Return 2 if the + required number of bytes is too large to store. */ +static int +yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, + yytype_int16 *yyssp, int yytoken) { - int yyn = yypact[yystate]; - - if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) - return 0; - else - { - int yytype = YYTRANSLATE (yychar); - YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); - YYSIZE_T yysize = yysize0; - YYSIZE_T yysize1; - int yysize_overflow = 0; - enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; - char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - int yyx; - -# if 0 - /* This is so xgettext sees the translatable formats that are - constructed on the fly. */ - YY_("syntax error, unexpected %s"); - YY_("syntax error, unexpected %s, expecting %s"); - YY_("syntax error, unexpected %s, expecting %s or %s"); - YY_("syntax error, unexpected %s, expecting %s or %s or %s"); - YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); -# endif - char *yyfmt; - char const *yyf; - static char const yyunexpected[] = "syntax error, unexpected %s"; - static char const yyexpecting[] = ", expecting %s"; - static char const yyor[] = " or %s"; - char yyformat[sizeof yyunexpected - + sizeof yyexpecting - 1 - + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) - * (sizeof yyor - 1))]; - char const *yyprefix = yyexpecting; - - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. */ - int yyxbegin = yyn < 0 ? -yyn : 0; - - /* Stay within bounds of both yycheck and yytname. */ - int yychecklim = YYLAST - yyn + 1; - int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yycount = 1; - - yyarg[0] = yytname[yytype]; - yyfmt = yystpcpy (yyformat, yyunexpected); - - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) - { - if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) - { - yycount = 1; - yysize = yysize0; - yyformat[sizeof yyunexpected - 1] = '\0'; - break; - } - yyarg[yycount++] = yytname[yyx]; - yysize1 = yysize + yytnamerr (0, yytname[yyx]); - yysize_overflow |= (yysize1 < yysize); - yysize = yysize1; - yyfmt = yystpcpy (yyfmt, yyprefix); - yyprefix = yyor; - } - - yyf = YY_(yyformat); - yysize1 = yysize + yystrlen (yyf); - yysize_overflow |= (yysize1 < yysize); - yysize = yysize1; - - if (yysize_overflow) - return YYSIZE_MAXIMUM; - - if (yyresult) - { - /* Avoid sprintf, as that infringes on the user's name space. - Don't have undefined behavior even if the translation - produced a string with the wrong number of "%s"s. */ - char *yyp = yyresult; - int yyi = 0; - while ((*yyp = *yyf) != '\0') - { - if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) - { - yyp += yytnamerr (yyp, yyarg[yyi++]); - yyf += 2; - } - else - { - yyp++; - yyf++; - } - } - } - return yysize; - } + YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]); + YYSIZE_T yysize = yysize0; + YYSIZE_T yysize1; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + /* Internationalized format string. */ + const char *yyformat = 0; + /* Arguments of yyformat. */ + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + /* Number of reported tokens (one for the "unexpected", one per + "expected"). */ + int yycount = 0; + + /* There are many possibilities here to consider: + - Assume YYFAIL is not used. It's too flawed to consider. See + + for details. YYERROR is fine as it does not invoke this + function. + - If this state is a consistent state with a default action, then + the only way this function was invoked is if the default action + is an error action. In that case, don't check for expected + tokens because there are none. + - The only way there can be no lookahead present (in yychar) is if + this state is a consistent state with a default action. Thus, + detecting the absence of a lookahead is sufficient to determine + that there is no unexpected or expected token to report. In that + case, just report a simple "syntax error". + - Don't assume there isn't a lookahead just because this state is a + consistent state with a default action. There might have been a + previous inconsistent state, consistent state with a non-default + action, or user semantic action that manipulated yychar. + - Of course, the expected token list depends on states to have + correct lookahead information, and it depends on the parser not + to perform extra reductions after fetching a lookahead from the + scanner and before detecting a syntax error. Thus, state merging + (from LALR or IELR) and default reductions corrupt the expected + token list. However, the list is correct for canonical LR with + one exception: it will still contain any token that will not be + accepted due to an error action in a later state. + */ + if (yytoken != YYEMPTY) + { + int yyn = yypact[*yyssp]; + yyarg[yycount++] = yytname[yytoken]; + if (!yypact_value_is_default (yyn)) + { + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. In other words, skip the first -YYN actions for + this state because they are default actions. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yyx; + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR + && !yytable_value_is_error (yytable[yyx + yyn])) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + break; + } + yyarg[yycount++] = yytname[yyx]; + yysize1 = yysize + yytnamerr (0, yytname[yyx]); + if (! (yysize <= yysize1 + && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } + } + } + + switch (yycount) + { +# define YYCASE_(N, S) \ + case N: \ + yyformat = S; \ + break + YYCASE_(0, YY_("syntax error")); + YYCASE_(1, YY_("syntax error, unexpected %s")); + YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); + YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); + YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); + YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); +# undef YYCASE_ + } + + yysize1 = yysize + yystrlen (yyformat); + if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + + if (*yymsg_alloc < yysize) + { + *yymsg_alloc = 2 * yysize; + if (! (yysize <= *yymsg_alloc + && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) + *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; + return 1; + } + + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + { + char *yyp = *yymsg; + int yyi = 0; + while ((*yyp = *yyformat) != '\0') + if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyformat += 2; + } + else + { + yyp++; + yyformat++; + } + } + return 0; } #endif /* YYERROR_VERBOSE */ - /*-----------------------------------------------. | Release the memory associated to this symbol. | @@ -1258,10 +1308,9 @@ break; } } - -/* Prevent warnings from -Wmissing-prototypes. */ +/* Prevent warnings from -Wmissing-prototypes. */ #ifdef YYPARSE_PARAM #if defined __STDC__ || defined __cplusplus int yyparse (void *YYPARSE_PARAM); @@ -1277,18 +1326,16 @@ #endif /* ! YYPARSE_PARAM */ - -/* The look-ahead symbol. */ +/* The lookahead symbol. */ int yychar; -/* The semantic value of the look-ahead symbol. */ +/* The semantic value of the lookahead symbol. */ YYSTYPE yylval; /* Number of syntax errors so far. */ int yynerrs; - /*----------. | yyparse. | `----------*/ @@ -1315,14 +1362,37 @@ #endif #endif { - - int yystate; + int yystate; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + + /* The stacks and their tools: + `yyss': related to states. + `yyvs': related to semantic values. + + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; + + YYSIZE_T yystacksize; + int yyn; int yyresult; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - /* Look-ahead token as an internal (translated) token number. */ - int yytoken = 0; + /* Lookahead token as an internal (translated) token number. */ + int yytoken; + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + #if YYERROR_VERBOSE /* Buffer for error messages, and its allocated size. */ char yymsgbuf[128]; @@ -1330,51 +1400,28 @@ YYSIZE_T yymsg_alloc = sizeof yymsgbuf; #endif - /* Three stacks and their tools: - `yyss': related to states, - `yyvs': related to semantic values, - `yyls': related to locations. - - Refer to the stacks thru separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ - - /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss = yyssa; - yytype_int16 *yyssp; - - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs = yyvsa; - YYSTYPE *yyvsp; - - - #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) - YYSIZE_T yystacksize = YYINITDEPTH; - - /* The variables used to return semantic value and location from the - action routines. */ - YYSTYPE yyval; - - /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; + yytoken = 0; + yyss = yyssa; + yyvs = yyvsa; + yystacksize = YYINITDEPTH; + YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ + yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ - yyssp = yyss; yyvsp = yyvs; @@ -1404,7 +1451,6 @@ YYSTYPE *yyvs1 = yyvs; yytype_int16 *yyss1 = yyss; - /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might @@ -1412,7 +1458,6 @@ yyoverflow (YY_("memory exhausted"), &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), - &yystacksize); yyss = yyss1; @@ -1435,9 +1480,8 @@ (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss); - YYSTACK_RELOCATE (yyvs); - + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); @@ -1448,7 +1492,6 @@ yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; - YYDPRINTF ((stderr, "Stack size increased to %lu\n", (unsigned long int) yystacksize)); @@ -1458,6 +1501,9 @@ YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + if (yystate == YYFINAL) + YYACCEPT; + goto yybackup; /*-----------. @@ -1466,16 +1512,16 @@ yybackup: /* Do appropriate processing given the current state. Read a - look-ahead token if we need one and don't already have one. */ + lookahead token if we need one and don't already have one. */ - /* First try to decide what to do without reference to look-ahead token. */ + /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; - if (yyn == YYPACT_NINF) + if (yypact_value_is_default (yyn)) goto yydefault; - /* Not known => get a look-ahead token if don't already have one. */ + /* Not known => get a lookahead token if don't already have one. */ - /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); @@ -1501,26 +1547,22 @@ yyn = yytable[yyn]; if (yyn <= 0) { - if (yyn == 0 || yyn == YYTABLE_NINF) - goto yyerrlab; + if (yytable_value_is_error (yyn)) + goto yyerrlab; yyn = -yyn; goto yyreduce; } - if (yyn == YYFINAL) - YYACCEPT; - /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; - /* Shift the look-ahead token. */ + /* Shift the lookahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - /* Discard the shifted token unless it is eof. */ - if (yychar != YYEOF) - yychar = YYEMPTY; + /* Discard the shifted token. */ + yychar = YYEMPTY; yystate = yyn; *++yyvsp = yylval; @@ -1560,27 +1602,31 @@ switch (yyn) { case 2: + +/* Line 1806 of yacc.c */ #line 224 "bibparse.y" { - entry->type = g_strdup ((yyvsp[(2) - (5)].text)); - g_strdown (entry->type); + entry->type = g_ascii_strdown((yyvsp[(2) - (5)].text), -1); YYACCEPT; } break; case 3: -#line 233 "bibparse.y" + +/* Line 1806 of yacc.c */ +#line 232 "bibparse.y" { - entry->type = g_strdup ((yyvsp[(2) - (5)].text)); - g_strdown (entry->type); + entry->type = g_ascii_strdown((yyvsp[(2) - (5)].text), -1); YYACCEPT; } break; case 4: -#line 242 "bibparse.y" + +/* Line 1806 of yacc.c */ +#line 240 "bibparse.y" { current_source->eof = TRUE; YYABORT; @@ -1588,11 +1634,12 @@ break; case 5: -#line 249 "bibparse.y" + +/* Line 1806 of yacc.c */ +#line 247 "bibparse.y" { if (strcasecmp ((yyvsp[(2) - (5)].text), "comment") == 0) { - entry->type = g_strdup ((yyvsp[(2) - (5)].text)); - g_strdown (entry->type); + entry->type = g_ascii_strdown((yyvsp[(2) - (5)].text), -1); yyclearin; YYACCEPT; @@ -1605,8 +1652,7 @@ else { bibtex_parser_start_warning ("perhaps a missing coma."); - entry->type = g_strdup ((yyvsp[(2) - (5)].text)); - g_strdown (entry->type); + entry->type = g_ascii_strdown((yyvsp[(2) - (5)].text), -1); yyclearin; YYACCEPT; @@ -1615,11 +1661,12 @@ break; case 6: -#line 275 "bibparse.y" + +/* Line 1806 of yacc.c */ +#line 271 "bibparse.y" { if (strcasecmp ((yyvsp[(2) - (5)].text), "comment") == 0) { - entry->type = g_strdup ((yyvsp[(2) - (5)].text)); - g_strdown (entry->type); + entry->type = g_ascii_strdown((yyvsp[(2) - (5)].text), -1); yyclearin; YYACCEPT; @@ -1632,8 +1679,7 @@ else { bibtex_parser_start_warning ("perhaps a missing coma"); - entry->type = g_strdup ((yyvsp[(2) - (5)].text)); - g_strdown (entry->type); + entry->type = g_ascii_strdown((yyvsp[(2) - (5)].text), -1); yyclearin; YYACCEPT; @@ -1642,7 +1688,9 @@ break; case 7: -#line 301 "bibparse.y" + +/* Line 1806 of yacc.c */ +#line 295 "bibparse.y" { bibtex_parser_start_error ("end of file during processing"); YYABORT; @@ -1650,7 +1698,9 @@ break; case 8: -#line 308 "bibparse.y" + +/* Line 1806 of yacc.c */ +#line 302 "bibparse.y" { bibtex_parser_start_error ("end of file during processing"); YYABORT; @@ -1658,46 +1708,48 @@ break; case 9: -#line 322 "bibparse.y" + +/* Line 1806 of yacc.c */ +#line 316 "bibparse.y" { nop (); } break; case 10: -#line 328 "bibparse.y" + +/* Line 1806 of yacc.c */ +#line 322 "bibparse.y" { nop (); } break; case 11: -#line 334 "bibparse.y" + +/* Line 1806 of yacc.c */ +#line 328 "bibparse.y" { nop (); } break; case 12: -#line 346 "bibparse.y" + +/* Line 1806 of yacc.c */ +#line 340 "bibparse.y" { char * name; BibtexField * field; BibtexFieldType type = BIBTEX_OTHER; - g_strdown ((yyvsp[(1) - (3)].text)); - field = g_hash_table_lookup (entry->table, (yyvsp[(1) - (3)].text)); + name = g_ascii_strdown ((yyvsp[(1) - (3)].text), -1); + field = g_hash_table_lookup (entry->table, name); /* Get a new instance of a field name */ if (field) { g_string_sprintf (tmp_string, "field `%s' is already defined", (yyvsp[(1) - (3)].text)); bibtex_parser_warning (tmp_string->str); - - bibtex_field_destroy (field, TRUE); - name = (yyvsp[(1) - (3)].text); - } - else { - name = g_strdup ((yyvsp[(1) - (3)].text)); } /* Search its type */ @@ -1724,12 +1776,14 @@ field = bibtex_struct_as_field (bibtex_struct_flatten ((yyvsp[(3) - (3)].body)), type); - g_hash_table_insert (entry->table, name, field); + g_hash_table_replace(entry->table, name, field); } break; case 13: -#line 395 "bibparse.y" + +/* Line 1806 of yacc.c */ +#line 383 "bibparse.y" { entry_start = start_line + entry->length; @@ -1743,26 +1797,34 @@ break; case 14: -#line 413 "bibparse.y" + +/* Line 1806 of yacc.c */ +#line 401 "bibparse.y" { (yyval.body) = bibtex_struct_append ((yyvsp[(1) - (3)].body), (yyvsp[(3) - (3)].body)); } break; case 15: -#line 419 "bibparse.y" + +/* Line 1806 of yacc.c */ +#line 407 "bibparse.y" { (yyval.body) = (yyvsp[(1) - (1)].body); } break; case 16: -#line 430 "bibparse.y" + +/* Line 1806 of yacc.c */ +#line 418 "bibparse.y" { bibtex_parser_is_content = TRUE; } break; case 17: -#line 433 "bibparse.y" + +/* Line 1806 of yacc.c */ +#line 421 "bibparse.y" { bibtex_parser_is_content = FALSE; (yyval.body) = bibtex_struct_new (BIBTEX_STRUCT_SUB); @@ -1773,12 +1835,16 @@ break; case 18: -#line 446 "bibparse.y" + +/* Line 1806 of yacc.c */ +#line 434 "bibparse.y" { bibtex_parser_is_content = TRUE; } break; case 19: -#line 449 "bibparse.y" + +/* Line 1806 of yacc.c */ +#line 437 "bibparse.y" { bibtex_parser_is_content = FALSE; (yyval.body) = bibtex_struct_new (BIBTEX_STRUCT_SUB); @@ -1789,7 +1855,9 @@ break; case 20: -#line 461 "bibparse.y" + +/* Line 1806 of yacc.c */ +#line 449 "bibparse.y" { (yyval.body) = bibtex_struct_new (BIBTEX_STRUCT_TEXT); (yyval.body)->value.text = g_strdup ((yyvsp[(1) - (1)].text)); @@ -1797,31 +1865,39 @@ break; case 21: -#line 468 "bibparse.y" + +/* Line 1806 of yacc.c */ +#line 456 "bibparse.y" { (yyval.body) = bibtex_struct_new (BIBTEX_STRUCT_REF); (yyval.body)->value.ref = g_strdup ((yyvsp[(1) - (1)].text)); - /* g_strdown ($$->value.ref); */ + /* g_ascii_strdown ($$->value.ref, -1); */ } break; case 22: -#line 477 "bibparse.y" + +/* Line 1806 of yacc.c */ +#line 465 "bibparse.y" { (yyval.body) = (yyvsp[(1) - (1)].body); } break; case 23: -#line 483 "bibparse.y" + +/* Line 1806 of yacc.c */ +#line 471 "bibparse.y" { (yyval.body) = (yyvsp[(1) - (1)].body); } break; case 24: -#line 493 "bibparse.y" + +/* Line 1806 of yacc.c */ +#line 481 "bibparse.y" { (yyval.body) = bibtex_struct_new (BIBTEX_STRUCT_COMMAND); (yyval.body)->value.com = g_strdup ((yyvsp[(1) - (1)].text) + 1); @@ -1829,7 +1905,9 @@ break; case 25: -#line 500 "bibparse.y" + +/* Line 1806 of yacc.c */ +#line 488 "bibparse.y" { (yyval.body) = bibtex_struct_new (BIBTEX_STRUCT_SUB); (yyval.body)->value.sub->encloser = BIBTEX_ENCLOSER_BRACE; @@ -1838,14 +1916,18 @@ break; case 26: -#line 508 "bibparse.y" + +/* Line 1806 of yacc.c */ +#line 496 "bibparse.y" { (yyval.body) = bibtex_struct_new (BIBTEX_STRUCT_SPACE); } break; case 27: -#line 514 "bibparse.y" + +/* Line 1806 of yacc.c */ +#line 502 "bibparse.y" { (yyval.body) = bibtex_struct_new (BIBTEX_STRUCT_SPACE); (yyval.body)->value.unbreakable = TRUE; @@ -1853,7 +1935,9 @@ break; case 28: -#line 521 "bibparse.y" + +/* Line 1806 of yacc.c */ +#line 509 "bibparse.y" { (yyval.body) = bibtex_struct_new (BIBTEX_STRUCT_TEXT); (yyval.body)->value.text = g_strdup ((yyvsp[(1) - (1)].text)); @@ -1861,7 +1945,9 @@ break; case 29: -#line 532 "bibparse.y" + +/* Line 1806 of yacc.c */ +#line 520 "bibparse.y" { (yyval.body) = bibtex_struct_new (BIBTEX_STRUCT_TEXT); (yyval.body)->value.text = g_strdup (""); @@ -1869,7 +1955,9 @@ break; case 30: -#line 539 "bibparse.y" + +/* Line 1806 of yacc.c */ +#line 527 "bibparse.y" { (yyval.body) = bibtex_struct_new (BIBTEX_STRUCT_TEXT); (yyval.body)->value.text = g_strdup ("\""); @@ -1879,14 +1967,18 @@ break; case 31: -#line 548 "bibparse.y" + +/* Line 1806 of yacc.c */ +#line 536 "bibparse.y" { (yyval.body) = bibtex_struct_append ((yyvsp[(1) - (2)].body), (yyvsp[(2) - (2)].body)); } break; case 32: -#line 558 "bibparse.y" + +/* Line 1806 of yacc.c */ +#line 546 "bibparse.y" { (yyval.body) = bibtex_struct_new (BIBTEX_STRUCT_TEXT); (yyval.body)->value.text = g_strdup (""); @@ -1894,17 +1986,31 @@ break; case 33: -#line 565 "bibparse.y" + +/* Line 1806 of yacc.c */ +#line 553 "bibparse.y" { (yyval.body) = bibtex_struct_append ((yyvsp[(1) - (2)].body), (yyvsp[(2) - (2)].body)); } break; -/* Line 1267 of yacc.c. */ -#line 1906 "y.tab.c" + +/* Line 1806 of yacc.c */ +#line 2001 "y.tab.c" default: break; } + /* User semantic actions sometimes alter yychar, and that requires + that yytoken be updated with the new translation. We take the + approach of translating immediately before every use of yytoken. + One alternative is translating here after every semantic action, + but that translation would be missed if the semantic action invokes + YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or + if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an + incorrect destructor might then be invoked immediately. In the + case of YYERROR or YYBACKUP, subsequent parser actions might lead + to an incorrect destructor call or verbose syntax error message + before the lookahead is translated. */ YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); YYPOPSTACK (yylen); @@ -1913,7 +2019,6 @@ *++yyvsp = yyval; - /* Now `shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ @@ -1933,6 +2038,10 @@ | yyerrlab -- here on detecting error | `------------------------------------*/ yyerrlab: + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); + /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { @@ -1940,37 +2049,36 @@ #if ! YYERROR_VERBOSE yyerror (YY_("syntax error")); #else +# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ + yyssp, yytoken) { - YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); - if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) - { - YYSIZE_T yyalloc = 2 * yysize; - if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) - yyalloc = YYSTACK_ALLOC_MAXIMUM; - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); - yymsg = (char *) YYSTACK_ALLOC (yyalloc); - if (yymsg) - yymsg_alloc = yyalloc; - else - { - yymsg = yymsgbuf; - yymsg_alloc = sizeof yymsgbuf; - } - } - - if (0 < yysize && yysize <= yymsg_alloc) - { - (void) yysyntax_error (yymsg, yystate, yychar); - yyerror (yymsg); - } - else - { - yyerror (YY_("syntax error")); - if (yysize != 0) - goto yyexhaustedlab; - } + char const *yymsgp = YY_("syntax error"); + int yysyntax_error_status; + yysyntax_error_status = YYSYNTAX_ERROR; + if (yysyntax_error_status == 0) + yymsgp = yymsg; + else if (yysyntax_error_status == 1) + { + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); + yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); + if (!yymsg) + { + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + yysyntax_error_status = 2; + } + else + { + yysyntax_error_status = YYSYNTAX_ERROR; + yymsgp = yymsg; + } + } + yyerror (yymsgp); + if (yysyntax_error_status == 2) + goto yyexhaustedlab; } +# undef YYSYNTAX_ERROR #endif } @@ -1978,7 +2086,7 @@ if (yyerrstatus == 3) { - /* If just tried and failed to reuse look-ahead token after an + /* If just tried and failed to reuse lookahead token after an error, discard it. */ if (yychar <= YYEOF) @@ -1995,7 +2103,7 @@ } } - /* Else will try to reuse look-ahead token after shifting the error + /* Else will try to reuse lookahead token after shifting the error token. */ goto yyerrlab1; @@ -2029,7 +2137,7 @@ for (;;) { yyn = yypact[yystate]; - if (yyn != YYPACT_NINF) + if (!yypact_value_is_default (yyn)) { yyn += YYTERROR; if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) @@ -2052,9 +2160,6 @@ YY_STACK_PRINT (yyss, yyssp); } - if (yyn == YYFINAL) - YYACCEPT; - *++yyvsp = yylval; @@ -2079,7 +2184,7 @@ yyresult = 1; goto yyreturn; -#ifndef yyoverflow +#if !defined(yyoverflow) || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ @@ -2090,9 +2195,14 @@ #endif yyreturn: - if (yychar != YYEOF && yychar != YYEMPTY) - yydestruct ("Cleanup: discarding lookahead", - yytoken, &yylval); + if (yychar != YYEMPTY) + { + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = YYTRANSLATE (yychar); + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval); + } /* Do not reclaim the symbols of the rule which action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); @@ -2116,7 +2226,9 @@ } -#line 572 "bibparse.y" + +/* Line 2067 of yacc.c */ +#line 560 "bibparse.y" diff -Nru python-bibtex-1.2.5/bibparse.h python-bibtex-1.2.7/bibparse.h --- python-bibtex-1.2.5/bibparse.h 2010-07-12 22:10:45.000000000 +0000 +++ python-bibtex-1.2.7/bibparse.h 2014-03-28 10:02:00.000000000 +0000 @@ -1,24 +1,21 @@ -/* A Bison parser, made by GNU Bison 2.3. */ +/* A Bison parser, made by GNU Bison 2.5. */ -/* Skeleton interface for Bison's Yacc-like parsers in C - - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 - Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify +/* Bison interface for Yacc-like parsers in C + + Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc. + + 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, or (at your option) - any later version. - + the Free Software Foundation, either version 3 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 Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ + along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -29,10 +26,11 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ + /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE @@ -62,18 +60,24 @@ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 193 "bibparse.y" { + +/* Line 2068 of yacc.c */ +#line 193 "bibparse.y" + gchar * text; BibtexStruct * body; -} -/* Line 1489 of yacc.c. */ -#line 72 "y.tab.h" - YYSTYPE; + + + +/* Line 2068 of yacc.c */ +#line 75 "y.tab.h" +} YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 #endif extern YYSTYPE bibtex_parser_lval; + diff -Nru python-bibtex-1.2.5/bibparse.y python-bibtex-1.2.7/bibparse.y --- python-bibtex-1.2.5/bibparse.y 2010-02-15 20:54:46.000000000 +0000 +++ python-bibtex-1.2.7/bibparse.y 2014-03-27 09:57:01.000000000 +0000 @@ -103,14 +103,14 @@ is_comment = (entry->type && (strcasecmp (entry->type, "comment") == 0)); if (warning_string && ! is_comment) { - bibtex_warning (warning_string); + bibtex_warning ("%s", warning_string); } if (ret != 0) { source->line += entry->length; if (error_string && ! is_comment) { - bibtex_error (error_string); + bibtex_error ("%s", error_string); } bibtex_entry_destroy (entry, TRUE); @@ -222,8 +222,7 @@ entry: '@' L_NAME '{' values '}' /* -------------------------------------------------- */ { - entry->type = g_strdup ($2); - g_strdown (entry->type); + entry->type = g_ascii_strdown($2, -1); YYACCEPT; } @@ -231,8 +230,7 @@ | '@' L_NAME '(' values ')' /* -------------------------------------------------- */ { - entry->type = g_strdup ($2); - g_strdown (entry->type); + entry->type = g_ascii_strdown($2, -1); YYACCEPT; } @@ -248,8 +246,7 @@ /* -------------------------------------------------- */ { if (strcasecmp ($2, "comment") == 0) { - entry->type = g_strdup ($2); - g_strdown (entry->type); + entry->type = g_ascii_strdown($2, -1); yyclearin; YYACCEPT; @@ -262,8 +259,7 @@ else { bibtex_parser_start_warning ("perhaps a missing coma."); - entry->type = g_strdup ($2); - g_strdown (entry->type); + entry->type = g_ascii_strdown($2, -1); yyclearin; YYACCEPT; @@ -274,8 +270,7 @@ /* -------------------------------------------------- */ { if (strcasecmp ($2, "comment") == 0) { - entry->type = g_strdup ($2); - g_strdown (entry->type); + entry->type = g_ascii_strdown($2, -1); yyclearin; YYACCEPT; @@ -288,8 +283,7 @@ else { bibtex_parser_start_warning ("perhaps a missing coma"); - entry->type = g_strdup ($2); - g_strdown (entry->type); + entry->type = g_ascii_strdown($2, -1); yyclearin; YYACCEPT; @@ -348,19 +342,13 @@ BibtexField * field; BibtexFieldType type = BIBTEX_OTHER; - g_strdown ($1); - field = g_hash_table_lookup (entry->table, $1); + name = g_ascii_strdown ($1, -1); + field = g_hash_table_lookup (entry->table, name); /* Get a new instance of a field name */ if (field) { g_string_sprintf (tmp_string, "field `%s' is already defined", $1); bibtex_parser_warning (tmp_string->str); - - bibtex_field_destroy (field, TRUE); - name = $1; - } - else { - name = g_strdup ($1); } /* Search its type */ @@ -387,7 +375,7 @@ field = bibtex_struct_as_field (bibtex_struct_flatten ($3), type); - g_hash_table_insert (entry->table, name, field); + g_hash_table_replace(entry->table, name, field); } /* -------------------------------------------------- */ | content @@ -469,7 +457,7 @@ $$ = bibtex_struct_new (BIBTEX_STRUCT_REF); $$->value.ref = g_strdup ($1); - /* g_strdown ($$->value.ref); */ + /* g_ascii_strdown ($$->value.ref, -1); */ } /* -------------------------------------------------- */ | content_brace diff -Nru python-bibtex-1.2.5/bibtex.c python-bibtex-1.2.7/bibtex.c --- python-bibtex-1.2.5/bibtex.c 2010-02-15 20:54:46.000000000 +0000 +++ python-bibtex-1.2.7/bibtex.c 2014-03-06 09:05:37.000000000 +0000 @@ -35,13 +35,13 @@ const gchar *message, gpointer user_data G_GNUC_UNUSED) { - gchar * name = g_get_prgname (); + const gchar * name = g_get_prgname (); if (name) { fprintf (stderr, "%s: ", name); } - switch (log_level) { + switch ((int)log_level) { case BIB_LEVEL_ERROR: fprintf (stderr, "error: %s\n", message); @@ -84,7 +84,9 @@ } field = (BibtexField *) value; - g_strdown (val); + + gchar* c = val; + for (; *c != '\0'; *c = g_ascii_tolower(*c), c++); g_hash_table_insert ((GHashTable *) user, val, field->structure); } diff -Nru python-bibtex-1.2.5/bibtexmodule.c python-bibtex-1.2.7/bibtexmodule.c --- python-bibtex-1.2.5/bibtexmodule.c 2010-02-15 20:54:46.000000000 +0000 +++ python-bibtex-1.2.7/bibtexmodule.c 2014-03-04 08:45:20.000000000 +0000 @@ -139,8 +139,9 @@ /* Create a new object */ ret = (PyBibtexSource_Object *) PyObject_NEW (PyBibtexSource_Object, & PyBibtexSource_Type); - ret->obj = file; + if (ret == NULL) return NULL; + ret->obj = file; return (PyObject *) ret; } @@ -169,8 +170,9 @@ /* Create a new object */ ret = (PyBibtexSource_Object *) PyObject_NEW (PyBibtexSource_Object, & PyBibtexSource_Type); - ret->obj = file; + if (ret == NULL) return NULL; + ret->obj = file; return (PyObject *) ret; } @@ -319,10 +321,11 @@ field = field_obj->obj; - new_obj = (PyBibtexField_Object *) PyObject_NEW (PyBibtexField_Object, & PyBibtexField_Type); + new_obj = (PyBibtexField_Object *) + PyObject_NEW(PyBibtexField_Object, & PyBibtexField_Type); + if (new_obj == NULL) return NULL; new_obj->obj = bibtex_struct_as_field (bibtex_struct_copy (field->structure), field->type); - return (PyObject *) new_obj; } @@ -394,8 +397,9 @@ field = bibtex_struct_as_field (s, type); tmp = (PyObject *) PyObject_NEW (PyBibtexField_Object, & PyBibtexField_Type); - ((PyBibtexField_Object *) tmp)->obj = field; + if (tmp == NULL) return NULL; + ((PyBibtexField_Object *) tmp)->obj = field; return tmp; } @@ -407,8 +411,10 @@ PyObject * tmp1, * tmp2; tmp1 = PyString_FromString ((char *) key); - tmp2 = (PyObject *) PyObject_NEW (PyBibtexField_Object, & PyBibtexField_Type); + /* this only happens when OOM'ing, not much to salvage except not crashing */ + if (tmp1 == NULL || tmp2 == NULL) return; + ((PyBibtexField_Object *) tmp2)->obj = value; PyDict_SetItem (dico, tmp1, tmp2); @@ -424,8 +430,9 @@ PyObject * tmp1, * tmp2; tmp1 = PyString_FromString ((char *) key); - tmp2 = (PyObject *) PyObject_NEW (PyBibtexField_Object, & PyBibtexField_Type); + /* this only happens when OOM'ing, not much to salvage except not crashing */ + if (tmp1 == NULL || tmp2 == NULL) return; ((PyBibtexField_Object *) tmp2)->obj = bibtex_struct_as_field (bibtex_struct_copy ((BibtexStruct *) value), BIBTEX_OTHER); @@ -508,15 +515,16 @@ } else { name = Py_None; + Py_INCREF(name); } if (filter) { - tmp = Py_BuildValue ("OsiiO", name, ent->type, + tmp = Py_BuildValue ("NsiiO", name, ent->type, ent->offset, ent->start_line, dico); } else { - tmp = Py_BuildValue ("(s(OsiiO))", "entry", name, + tmp = Py_BuildValue ("(s(NsiiO))", "entry", name, ent->type, ent->offset, ent->start_line, dico); @@ -693,12 +701,16 @@ auth->honorific = NULL; } Py_DECREF (tmp); + + Py_DECREF(authobj); } } bibtex_reverse_field (field, brace, quote); tmp = (PyObject *) PyObject_NEW (PyBibtexField_Object, & PyBibtexField_Type); + if (tmp == NULL) return NULL; + ((PyBibtexField_Object *) tmp)->obj = field; return tmp; } diff -Nru python-bibtex-1.2.5/debian/changelog python-bibtex-1.2.7/debian/changelog --- python-bibtex-1.2.5/debian/changelog 2014-04-27 18:49:35.000000000 +0000 +++ python-bibtex-1.2.7/debian/changelog 2014-04-27 04:53:55.000000000 +0000 @@ -1,3 +1,9 @@ +python-bibtex (1.2.7-1) unstable; urgency=medium + + * New upstream release. + + -- Chris Lawrence Sun, 27 Apr 2014 00:53:55 -0400 + python-bibtex (1.2.5-1.1) unstable; urgency=low * Non-maintainer upload. diff -Nru python-bibtex-1.2.5/debian/control python-bibtex-1.2.7/debian/control --- python-bibtex-1.2.5/debian/control 2014-04-27 18:49:35.000000000 +0000 +++ python-bibtex-1.2.7/debian/control 2014-04-27 04:54:44.000000000 +0000 @@ -3,7 +3,7 @@ Priority: optional Maintainer: Chris Lawrence Build-Depends: debhelper (>= 7), python-all-dev (>= 2.6.6-3~), libglib2.0-dev, librecode-dev -Standards-Version: 3.9.1 +Standards-Version: 3.9.5 Homepage: http://www.pybliographer.org/ Package: python-bibtex diff -Nru python-bibtex-1.2.5/debian/rules python-bibtex-1.2.7/debian/rules --- python-bibtex-1.2.5/debian/rules 2014-04-27 18:49:35.000000000 +0000 +++ python-bibtex-1.2.7/debian/rules 2014-04-27 04:56:03.000000000 +0000 @@ -27,8 +27,9 @@ touch configure-stamp - -build: build-stamp +build: build-arch build-indep +build-arch: build-stamp +build-indep: build-stamp build-stamp: configure-stamp dh_testdir diff -Nru python-bibtex-1.2.5/debian/source/format python-bibtex-1.2.7/debian/source/format --- python-bibtex-1.2.5/debian/source/format 1970-01-01 00:00:00.000000000 +0000 +++ python-bibtex-1.2.7/debian/source/format 2014-04-27 04:56:48.000000000 +0000 @@ -0,0 +1 @@ +3.0 (quilt) diff -Nru python-bibtex-1.2.5/entry.c python-bibtex-1.2.7/entry.c --- python-bibtex-1.2.5/entry.c 2010-02-15 20:54:46.000000000 +0000 +++ python-bibtex-1.2.7/entry.c 2014-03-04 08:45:20.000000000 +0000 @@ -27,8 +27,6 @@ #include "bibtex.h" -static GMemChunk * entry_chunk = NULL; - static void free_data_field (gpointer key, gpointer value, @@ -43,16 +41,7 @@ BibtexEntry * bibtex_entry_new (void) { - BibtexEntry * entry; - - if (entry_chunk == NULL) { - entry_chunk = g_mem_chunk_new ("BibtexEntry", - sizeof (BibtexEntry), - sizeof (BibtexEntry) * 16, - G_ALLOC_AND_FREE); - } - - entry = g_chunk_new (BibtexEntry, entry_chunk); + BibtexEntry * entry = g_new (BibtexEntry, 1); entry->length = 0; @@ -85,5 +74,5 @@ g_hash_table_foreach (entry->table, free_data_field, GINT_TO_POINTER(content)); g_hash_table_destroy (entry->table); - g_chunk_free (entry, entry_chunk); + g_free (entry); } diff -Nru python-bibtex-1.2.5/field.c python-bibtex-1.2.7/field.c --- python-bibtex-1.2.5/field.c 2010-02-15 20:54:46.000000000 +0000 +++ python-bibtex-1.2.7/field.c 2014-03-04 08:45:20.000000000 +0000 @@ -29,20 +29,9 @@ #include "bibtex.h" -static GMemChunk * field_chunk = NULL; - BibtexField * bibtex_field_new (BibtexFieldType type) { - BibtexField * field; - - if (field_chunk == NULL) { - field_chunk = g_mem_chunk_new ("BibtexField", - sizeof (BibtexField), - sizeof (BibtexField) * 16, - G_ALLOC_AND_FREE); - } - - field = g_chunk_new (BibtexField, field_chunk); + BibtexField * field = g_new (BibtexField, 1); field->structure = NULL; field->type = type; @@ -103,7 +92,7 @@ break; } - g_chunk_free (field, field_chunk); + g_free (field); } diff -Nru python-bibtex-1.2.5/NEWS python-bibtex-1.2.7/NEWS --- python-bibtex-1.2.5/NEWS 2010-07-12 21:48:33.000000000 +0000 +++ python-bibtex-1.2.7/NEWS 2014-03-28 09:37:25.000000000 +0000 @@ -1,5 +1,15 @@ -*- charset: utf-8 -*- +Version 1.2.7 (2014-03-25) + + * various fixes and cleanup of the code + (replace deprecated glib functions, fix gcc warnings, + fix refcounting errors, etc.) + +Version 1.2.6 (2014-01-22) + + * fixed -Werror=format-security issues + Version 1.2.5 (2010-07-12) * fixed testsuite diff -Nru python-bibtex-1.2.5/PKG-INFO python-bibtex-1.2.7/PKG-INFO --- python-bibtex-1.2.5/PKG-INFO 2010-07-12 22:13:24.000000000 +0000 +++ python-bibtex-1.2.7/PKG-INFO 2014-03-28 10:02:06.000000000 +0000 @@ -1,6 +1,6 @@ Metadata-Version: 1.0 Name: python-bibtex -Version: 1.2.5 +Version: 1.2.7 Summary: A Python extension to parse BibTeX files Home-page: http://pybliographer.org/ Author: Frederic Gobry @@ -9,13 +9,13 @@ Description: This module contains two extensions needed for pybliographer: - - a bibtex parser - - a simple binding to GNU Recode + - a bibtex parser + - a simple binding to GNU Recode It requires the following libraries to be installed: - - Glib-2.0 (and its development headers) - - GNU Recode 3.5 (and its development headers) + - Glib-2.0 (and its development headers) + - GNU Recode 3.5 (and its development headers) Platform: UNKNOWN diff -Nru python-bibtex-1.2.5/setup.py python-bibtex-1.2.7/setup.py --- python-bibtex-1.2.5/setup.py 2010-07-12 21:46:58.000000000 +0000 +++ python-bibtex-1.2.7/setup.py 2014-03-25 09:49:03.000000000 +0000 @@ -6,7 +6,7 @@ from distutils.errors import DistutilsExecError from distutils.command.install import install as base_install -version = '1.2.5' +version = '1.2.7' bibtex = [ diff -Nru python-bibtex-1.2.5/source.c python-bibtex-1.2.7/source.c --- python-bibtex-1.2.5/source.c 2010-02-15 20:54:46.000000000 +0000 +++ python-bibtex-1.2.7/source.c 2014-03-04 08:45:20.000000000 +0000 @@ -108,11 +108,10 @@ g_return_if_fail (key != NULL); if ((oldstruct = g_hash_table_lookup (source->table, inskey)) == NULL) { - inskey = g_strdup (key); - g_strdown (inskey); + inskey = g_ascii_strdown(key, -1); } else { - bibtex_struct_destroy (oldstruct, TRUE); + bibtex_struct_destroy(oldstruct, TRUE); } g_hash_table_insert (source->table, inskey, value); diff -Nru python-bibtex-1.2.5/struct.c python-bibtex-1.2.7/struct.c --- python-bibtex-1.2.5/struct.c 2010-02-15 20:54:46.000000000 +0000 +++ python-bibtex-1.2.7/struct.c 2014-03-04 08:45:20.000000000 +0000 @@ -30,20 +30,9 @@ #include "bibtex.h" -static GMemChunk * struct_chunk = NULL; - BibtexStruct * bibtex_struct_new (BibtexStructType type) { - BibtexStruct * s; - - if (struct_chunk == NULL) { - struct_chunk = g_mem_chunk_new ("BibtexStruct", - sizeof (BibtexStruct), - sizeof (BibtexStruct) * 16, - G_ALLOC_AND_FREE); - } - - s = g_chunk_new (BibtexStruct, struct_chunk); + BibtexStruct * s = g_new (BibtexStruct, 1); s->type = type; @@ -127,7 +116,7 @@ break; } - g_chunk_free (s, struct_chunk); + g_free (s); } /* -------------------------------------------------- */ @@ -338,34 +327,31 @@ break; case BIBTEX_STRUCT_TEXT: - text = g_strdup (s->value.text); if ((! as_bibtex || as_latex) && level == 1 && type == BIBTEX_TITLE) { + text = g_ascii_strdown(s->value.text, -1); if (at_beginning) { - text [0] = toupper (text [0]); - g_strdown (text + 1); - } - else { - g_strdown (text); + text [0] = toupper(text[0]); } + } else { + text = g_strdup(s->value.text); } break; case BIBTEX_STRUCT_REF: - g_strdown (s->value.ref); - if (as_bibtex && ! as_latex) { - text = g_strdup (s->value.ref); + text = g_ascii_strdown(s->value.ref, -1); } else { if (loss) * loss = TRUE; if (dico) { - tmp_s = (BibtexStruct *) - g_hash_table_lookup (dico, s->value.ref); - + tmp = g_ascii_strdown(s->value.ref, -1); + tmp_s = (BibtexStruct *) g_hash_table_lookup(dico, tmp); + g_free(tmp); + if (tmp_s) { text = bibtex_real_string (tmp_s, type, dico, diff -Nru python-bibtex-1.2.5/tests/authors.bib-ok python-bibtex-1.2.7/tests/authors.bib-ok --- python-bibtex-1.2.5/tests/authors.bib-ok 2010-02-15 20:54:47.000000000 +0000 +++ python-bibtex-1.2.7/tests/authors.bib-ok 2014-03-04 08:45:20.000000000 +0000 @@ -1 +1 @@ -('weird', 'article', 0, 1, {'author': (1, 0, 'Gobry, Frederic and Grederic Fobry and Nostradamus and others', [(None, 'Frederic', 'Gobry', None), (None, 'Grederic', 'Fobry', None), (None, None, 'Nostradamus', None), (None, None, 'others', None)])}) \ No newline at end of file +('weird', 'article', 0, 1, [('author', (1, 0, 'Gobry, Frederic and Grederic Fobry and Nostradamus and others', [(None, 'Frederic', 'Gobry', None), (None, 'Grederic', 'Fobry', None), (None, None, 'Nostradamus', None), (None, None, 'others', None)]))]) \ No newline at end of file diff -Nru python-bibtex-1.2.5/tests/paren.bib-ok python-bibtex-1.2.7/tests/paren.bib-ok --- python-bibtex-1.2.5/tests/paren.bib-ok 2010-02-15 20:54:47.000000000 +0000 +++ python-bibtex-1.2.7/tests/paren.bib-ok 2014-03-04 08:45:20.000000000 +0000 @@ -1 +1 @@ -('Ples:2001(031916)', 'article', 0, 1, {'title': (2, 0, 'Toto')}) +('Ples:2001(031916)', 'article', 0, 1, [('title', (2, 0, 'Toto'))]) diff -Nru python-bibtex-1.2.5/tests/simple-2.bib python-bibtex-1.2.7/tests/simple-2.bib --- python-bibtex-1.2.5/tests/simple-2.bib 2010-02-15 20:54:47.000000000 +0000 +++ python-bibtex-1.2.7/tests/simple-2.bib 2014-03-27 09:57:01.000000000 +0000 @@ -1,5 +1,5 @@ @Article{gobry03, - author = {Fr\'ed\'eric Gobry}, + Author = {Fr\'ed\'eric Gobry}, title = {A simple example}, journal = {My diary}, year = 2003 diff -Nru python-bibtex-1.2.5/tests/simple-2.bib-ok python-bibtex-1.2.7/tests/simple-2.bib-ok --- python-bibtex-1.2.5/tests/simple-2.bib-ok 2010-02-15 20:54:47.000000000 +0000 +++ python-bibtex-1.2.7/tests/simple-2.bib-ok 2014-03-04 08:45:20.000000000 +0000 @@ -1 +1 @@ -('entry', ('gobry03', 'article', 0, 1, {'journal': (0, 0, 'My diary'), 'year': (3, 0, '2003', 2003, 0, 0), 'author': (1, 0, 'Fr\xe9d\xe9ric Gobry', [(None, 'Fr\xe9d\xe9ric', 'Gobry', None)]), 'title': (2, 0, 'A simple example')})) +('entry', ('gobry03', 'article', 0, 1, [('author', (1, 0, 'Fr\xe9d\xe9ric Gobry', [(None, 'Fr\xe9d\xe9ric', 'Gobry', None)])), ('journal', (0, 0, 'My diary')), ('title', (2, 0, 'A simple example')), ('year', (3, 0, '2003', 2003, 0, 0))])) diff -Nru python-bibtex-1.2.5/tests/simple.bib-ok python-bibtex-1.2.7/tests/simple.bib-ok --- python-bibtex-1.2.5/tests/simple.bib-ok 2010-02-15 20:54:47.000000000 +0000 +++ python-bibtex-1.2.7/tests/simple.bib-ok 2014-03-04 08:45:20.000000000 +0000 @@ -1 +1 @@ -('gobry03', 'article', 0, 1, {'journal': (0, 0, 'My diary'), 'year': (3, 0, '2003', 2003, 0, 0), 'author': (1, 0, 'Fr\xe9d\xe9ric Gobry', [(None, 'Fr\xe9d\xe9ric', 'Gobry', None)]), 'title': (2, 0, 'A simple example')}) +('gobry03', 'article', 0, 1, [('author', (1, 0, 'Fr\xe9d\xe9ric Gobry', [(None, 'Fr\xe9d\xe9ric', 'Gobry', None)])), ('journal', (0, 0, 'My diary')), ('title', (2, 0, 'A simple example')), ('year', (3, 0, '2003', 2003, 0, 0))]) diff -Nru python-bibtex-1.2.5/tests/url.bib-ok python-bibtex-1.2.7/tests/url.bib-ok --- python-bibtex-1.2.5/tests/url.bib-ok 2010-02-15 20:54:47.000000000 +0000 +++ python-bibtex-1.2.7/tests/url.bib-ok 2014-03-04 08:45:20.000000000 +0000 @@ -1 +1 @@ -('withurl', 'article', 0, 1, {'url': (4, 0, 'http://toto/~gronf/a')}) \ No newline at end of file +('withurl', 'article', 0, 1, [('url', (4, 0, 'http://toto/~gronf/a'))]) \ No newline at end of file diff -Nru python-bibtex-1.2.5/testsuite.py python-bibtex-1.2.7/testsuite.py --- python-bibtex-1.2.5/testsuite.py 2010-07-12 20:51:54.000000000 +0000 +++ python-bibtex-1.2.7/testsuite.py 2014-03-04 08:45:20.000000000 +0000 @@ -1,4 +1,4 @@ -# -* coding: latin-1 -*- +# -*- coding: latin-1 -*- """ Run is the main function that will check if the recode and bibtex modules are working """ @@ -40,13 +40,12 @@ def checkfile (filename, strict = 1, typemap = {}): def expand (file, entry, type = -1): - - items = entry [4] - - for k in items.keys (): - items [k] = _bibtex.expand (file, items [k], typemap.get (k, -1)) - - return + """Inline the expanded respresentation of each field.""" + bibkey, bibtype, a, b, items = entry + results = [] + for k in sorted(items): + results.append((k, _bibtex.expand (file, items [k], typemap.get (k, -1)))) + return (bibkey, bibtype, a, b, results) file = _bibtex.open_file (filename, strict) result = open (filename + '-ok', 'r') @@ -62,8 +61,7 @@ if entry is None: break - expand (file, entry) - obtained = `entry` + obtained = `expand (file, entry)` except IOError, msg: obtained = 'ParserError' @@ -90,15 +88,14 @@ def checkunfiltered (filename, strict = 1): def expand (file, entry): + if entry[0] in ('preamble', 'string'): + return entry - if entry [0] in ('preamble', 'string'): return - - items = entry [1] [4] - - for k in items.keys (): - items [k] = _bibtex.expand (file, items [k], -1) + bibkind, (bibkey, bibtype, a, b, items) = entry - return + results = [(k, _bibtex.expand (file, items [k], -1)) + for k in sorted(items)] + return (bibkind, (bibkey, bibtype, a, b, results)) file = _bibtex.open_file (filename, strict) result = open (filename + '-ok', 'r') @@ -114,8 +111,7 @@ if entry is None: break - expand (file, entry) - obtained = `entry` + obtained = `expand (file, entry)` except IOError, msg: obtained = 'ParserError'