From 40c614d84ae5bf7c1808a30a2ccac8db12228519 Mon Sep 17 00:00:00 2001 From: Ralph Boehme Date: Sun, 13 Jan 2013 17:01:44 +0100 Subject: [PATCH] Move and rename Spotlight module --- configure.ac | 1 + etc/Makefile.am | 2 +- etc/afpd/Makefile.am | 28 +- etc/afpd/afp_dsi.c | 4 +- etc/afpd/auth.c | 2 +- etc/afpd/file.c | 2 +- etc/afpd/main.c | 1 - etc/afpd/spotlight.c | 3 +- etc/afpd/spotlight_marshalling.c | 3 +- etc/spotlight/.gitignore | 9 + etc/spotlight/Makefile.am | 32 ++ .../slmod_sparql.c} | 4 +- .../slmod_sparql_map.c} | 2 +- .../slmod_sparql_map.h} | 0 .../slmod_sparql_parser.c} | 369 ++++++++++-------- .../slmod_sparql_parser.h} | 48 +-- .../slmod_sparql_parser.y} | 4 +- .../spotlight_rawquery_lexer.c | 8 +- .../spotlight_rawquery_lexer.l | 4 +- include/atalk/Makefile.am | 3 +- {etc/afpd => include/atalk}/spotlight.h | 0 macros/netatalk.m4 | 2 +- 22 files changed, 282 insertions(+), 249 deletions(-) create mode 100644 etc/spotlight/.gitignore create mode 100644 etc/spotlight/Makefile.am rename etc/{afpd/spotlight_module.c => spotlight/slmod_sparql.c} (99%) rename etc/{afpd/spotlight_SPARQL_map.c => spotlight/slmod_sparql_map.c} (99%) rename etc/{afpd/spotlight_SPARQL_map.h => spotlight/slmod_sparql_map.h} (100%) rename etc/{afpd/spotlight_rawquery_parser.c => spotlight/slmod_sparql_parser.c} (90%) rename etc/{afpd/spotlight_rawquery_parser.h => spotlight/slmod_sparql_parser.h} (75%) rename etc/{afpd/spotlight_rawquery_parser.y => spotlight/slmod_sparql_parser.y} (99%) rename etc/{afpd => spotlight}/spotlight_rawquery_lexer.c (99%) rename etc/{afpd => spotlight}/spotlight_rawquery_lexer.l (94%) rename {etc/afpd => include/atalk}/spotlight.h (100%) diff --git a/configure.ac b/configure.ac index b148e9d0..b148d4fa 100644 --- a/configure.ac +++ b/configure.ac @@ -245,6 +245,7 @@ AC_OUTPUT([Makefile etc/afpd/Makefile etc/cnid_dbd/Makefile etc/netatalk/Makefile + etc/spotlight/Makefile etc/uams/Makefile include/Makefile include/atalk/Makefile diff --git a/etc/Makefile.am b/etc/Makefile.am index e5367734..6877a761 100644 --- a/etc/Makefile.am +++ b/etc/Makefile.am @@ -1,3 +1,3 @@ # Makefile.am for etc/ -SUBDIRS = afpd cnid_dbd netatalk uams +SUBDIRS = afpd cnid_dbd netatalk spotlight uams diff --git a/etc/afpd/Makefile.am b/etc/afpd/Makefile.am index c44f7b41..6372f7ea 100644 --- a/etc/afpd/Makefile.am +++ b/etc/afpd/Makefile.am @@ -67,8 +67,7 @@ endif noinst_HEADERS = auth.h afp_config.h desktop.h directory.h fce_api_internal.h file.h \ filedir.h fork.h icon.h mangle.h misc.h status.h switch.h \ uam_auth.h uid.h unix.h volume.h hash.h acls.h acl_mappings.h extattrs.h \ - dircache.h afp_zeroconf.h afp_avahi.h afp_mdns.h spotlight.h \ - spotlight_SPARQL_map.h + dircache.h afp_zeroconf.h afp_avahi.h afp_mdns.h hash_SOURCES = hash.c hash_CFLAGS = -DKAZLIB_TEST_MAIN -I$(top_srcdir)/include @@ -80,28 +79,3 @@ fce_LDADD = $(top_builddir)/libatalk/libatalk.la spot_SOURCES = spotlight.c spotlight_marshalling.c spot_CFLAGS = -DSPOT_TEST_MAIN spot_LDADD = $(top_builddir)/libatalk/libatalk.la - -AM_YFLAGS = -d - -if HAVE_TRACKER -BUILT_SOURCES = spotlight_rawquery_parser.h -noinst_PROGRAMS += srp - -moduledir = @UAMS_PATH@ -module_LTLIBRARIES = mod_spotlight.la - -mod_spotlight_la_SOURCES = \ - spotlight_module.c \ - spotlight_SPARQL_map.c \ - spotlight_rawquery_parser.y \ - spotlight_rawquery_lexer.l -mod_spotlight_la_CFLAGS = -DDBUS_API_SUBJECT_TO_CHANGE @TRACKER_CFLAGS@ @TRACKER_MINER_CFLAGS@ -mod_spotlight_la_LDFLAGS = -module -avoid-version @TRACKER_LIBS@ @TRACKER_MINER_LIBS@ - -srp_SOURCES = \ - spotlight_SPARQL_map.c \ - spotlight_rawquery_parser.y \ - spotlight_rawquery_lexer.l -srp_CFLAGS = -DMAIN -I$(top_srcdir)/include @TRACKER_CFLAGS@ -srp_LDADD = $(top_builddir)/libatalk/libatalk.la -endif diff --git a/etc/afpd/afp_dsi.c b/etc/afpd/afp_dsi.c index c59c6106..44d5b0e6 100644 --- a/etc/afpd/afp_dsi.c +++ b/etc/afpd/afp_dsi.c @@ -39,12 +39,12 @@ #include #include #include +#include #include "switch.h" #include "auth.h" #include "fork.h" #include "dircache.h" -#include "spotlight.h" #ifndef SOL_TCP #define SOL_TCP IPPROTO_TCP @@ -493,7 +493,7 @@ void afp_over_dsi(AFPObj *obj) /* Initialize Spotlight */ if (obj->options.flags & OPTION_SPOTLIGHT) - sl_mod_load(_PATH_AFPDUAMPATH "mod_spotlight.so"); + sl_mod_load(_PATH_AFPDUAMPATH "slmod_sparql.so"); /* get stuck here until the end */ while (1) { diff --git a/etc/afpd/auth.c b/etc/afpd/auth.c index aa0fe873..68157c74 100644 --- a/etc/afpd/auth.c +++ b/etc/afpd/auth.c @@ -39,6 +39,7 @@ extern void afp_get_cmdline( int *ac, char ***av ); #include #include #include +#include #include "auth.h" #include "uam_auth.h" @@ -46,7 +47,6 @@ extern void afp_get_cmdline( int *ac, char ***av ); #include "status.h" #include "fork.h" #include "extattrs.h" -#include "spotlight.h" #ifdef HAVE_ACLS #include "acls.h" #endif diff --git a/etc/afpd/file.c b/etc/afpd/file.c index 265d6356..71c248a4 100644 --- a/etc/afpd/file.c +++ b/etc/afpd/file.c @@ -25,6 +25,7 @@ #include #include #include +#include #include "directory.h" #include "dircache.h" @@ -34,7 +35,6 @@ #include "file.h" #include "filedir.h" #include "unix.h" -#include "spotlight.h" /* the format for the finderinfo fields (from IM: Toolbox Essentials): * field bytes subfield bytes diff --git a/etc/afpd/main.c b/etc/afpd/main.c index 28b74e47..3e991c28 100644 --- a/etc/afpd/main.c +++ b/etc/afpd/main.c @@ -38,7 +38,6 @@ #include "fork.h" #include "uam_auth.h" #include "afp_zeroconf.h" -#include "spotlight.h" #define AFP_LISTENERS 32 #define FDSET_SAFETY 5 diff --git a/etc/afpd/spotlight.c b/etc/afpd/spotlight.c index 5e95c11d..eb4a125b 100644 --- a/etc/afpd/spotlight.c +++ b/etc/afpd/spotlight.c @@ -36,8 +36,7 @@ #include #include #include - -#include "spotlight.h" +#include static TALLOC_CTX *sl_ctx; static void *sl_module; diff --git a/etc/afpd/spotlight_marshalling.c b/etc/afpd/spotlight_marshalling.c index a30145e9..29bd234c 100644 --- a/etc/afpd/spotlight_marshalling.c +++ b/etc/afpd/spotlight_marshalling.c @@ -33,8 +33,7 @@ #include #include #include - -#include "spotlight.h" +#include #define MAX_SLQ_DAT (DSI_DATASIZ - 64) #define MAX_SLQ_TOC 8192 diff --git a/etc/spotlight/.gitignore b/etc/spotlight/.gitignore new file mode 100644 index 00000000..a404c0e4 --- /dev/null +++ b/etc/spotlight/.gitignore @@ -0,0 +1,9 @@ +Makefile +Makefile.in +spot +srp +.deps +.libs +*.o +*.la +*.lo \ No newline at end of file diff --git a/etc/spotlight/Makefile.am b/etc/spotlight/Makefile.am new file mode 100644 index 00000000..6f48e20f --- /dev/null +++ b/etc/spotlight/Makefile.am @@ -0,0 +1,32 @@ +# Makefile.am for etc/spotlight/ + +pkgconfdir = @PKGCONFDIR@ +moduledir = @UAMS_PATH@ +module_LTLIBRARIES = +noinst_PROGRAMS = +noinst_HEADERS = slmod_sparql_map.h + +AM_YFLAGS = -d + +if HAVE_TRACKER_SPARQL +BUILT_SOURCES = slmod_sparql_parser.h +noinst_PROGRAMS += srp +module_LTLIBRARIES += slmod_sparql.la + +slmod_sparql_la_SOURCES = \ + slmod_sparql.c \ + slmod_sparql_map.c \ + slmod_sparql_parser.y \ + spotlight_rawquery_lexer.l + +slmod_sparql_la_CFLAGS = -DDBUS_API_SUBJECT_TO_CHANGE @TRACKER_CFLAGS@ @TRACKER_MINER_CFLAGS@ +slmod_sparql_la_LDFLAGS = -module -avoid-version @TRACKER_LIBS@ @TRACKER_MINER_LIBS@ + +srp_SOURCES = \ + slmod_sparql_map.c \ + slmod_sparql_parser.y \ + spotlight_rawquery_lexer.l + +srp_CFLAGS = -DMAIN -I$(top_srcdir)/include @TRACKER_CFLAGS@ +srp_LDADD = $(top_builddir)/libatalk/libatalk.la +endif diff --git a/etc/afpd/spotlight_module.c b/etc/spotlight/slmod_sparql.c similarity index 99% rename from etc/afpd/spotlight_module.c rename to etc/spotlight/slmod_sparql.c index dc036922..ec2943b2 100644 --- a/etc/afpd/spotlight_module.c +++ b/etc/spotlight/slmod_sparql.c @@ -27,9 +27,9 @@ #include #include #include +#include -#include "spotlight.h" -#include "spotlight_rawquery_parser.h" +#include "slmod_sparql_parser.h" #define MAX_SL_RESULTS 20 diff --git a/etc/afpd/spotlight_SPARQL_map.c b/etc/spotlight/slmod_sparql_map.c similarity index 99% rename from etc/afpd/spotlight_SPARQL_map.c rename to etc/spotlight/slmod_sparql_map.c index 39ef39e0..49296d79 100644 --- a/etc/afpd/spotlight_SPARQL_map.c +++ b/etc/spotlight/slmod_sparql_map.c @@ -18,7 +18,7 @@ #include -#include "spotlight_SPARQL_map.h" +#include "slmod_sparql_map.h" #define NOTSUPPORTED NULL #define SPECIAL NULL diff --git a/etc/afpd/spotlight_SPARQL_map.h b/etc/spotlight/slmod_sparql_map.h similarity index 100% rename from etc/afpd/spotlight_SPARQL_map.h rename to etc/spotlight/slmod_sparql_map.h diff --git a/etc/afpd/spotlight_rawquery_parser.c b/etc/spotlight/slmod_sparql_parser.c similarity index 90% rename from etc/afpd/spotlight_rawquery_parser.c rename to etc/spotlight/slmod_sparql_parser.c index c1b6a32e..52482b06 100644 --- a/etc/afpd/spotlight_rawquery_parser.c +++ b/etc/spotlight/slmod_sparql_parser.c @@ -1,8 +1,8 @@ -/* A Bison parser, made by GNU Bison 2.7. */ +/* A Bison parser, made by GNU Bison 2.5. */ /* Bison implementation for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc. + 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 @@ -44,7 +44,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.7" +#define YYBISON_VERSION "2.5" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -58,12 +58,15 @@ /* Pull parsers. */ #define YYPULL 1 +/* Using locations. */ +#define YYLSP_NEEDED 0 /* Copy the first part of user declarations. */ -/* Line 371 of yacc.c */ -#line 1 "spotlight_rawquery_parser.y" + +/* Line 268 of yacc.c */ +#line 1 "slmod_sparql_parser.y" #include @@ -77,9 +80,9 @@ #include #include #include + #include - #include "spotlight_SPARQL_map.h" - #include "spotlight.h" + #include "slmod_sparql_map.h" struct yy_buffer_state; typedef struct yy_buffer_state *YY_BUFFER_STATE; @@ -101,16 +104,14 @@ static gchar *ssp_result; static char sparqlvar; -/* Line 371 of yacc.c */ -#line 106 "spotlight_rawquery_parser.c" -# ifndef YY_NULL -# if defined __cplusplus && 201103L <= __cplusplus -# define YY_NULL nullptr -# else -# define YY_NULL 0 -# endif -# endif +/* Line 268 of yacc.c */ +#line 110 "slmod_sparql_parser.c" + +/* Enabling traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif /* Enabling verbose error messages. */ #ifdef YYERROR_VERBOSE @@ -120,18 +121,12 @@ # define YYERROR_VERBOSE 1 #endif -/* In a future release of Bison, this section will be replaced - by #include "y.tab.h". */ -#ifndef YY_YY_Y_TAB_H_INCLUDED -# define YY_YY_Y_TAB_H_INCLUDED -/* Enabling traces. */ -#ifndef YYDEBUG -# define YYDEBUG 0 -#endif -#if YYDEBUG -extern int yydebug; +/* Enabling the token table. */ +#ifndef YYTOKEN_TABLE +# define YYTOKEN_TABLE 0 #endif + /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE @@ -172,11 +167,13 @@ extern int yydebug; + #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE { -/* Line 387 of yacc.c */ -#line 45 "spotlight_rawquery_parser.y" + +/* Line 293 of yacc.c */ +#line 45 "slmod_sparql_parser.y" int ival; const char *sval; @@ -184,47 +181,34 @@ typedef union YYSTYPE time_t tval; -/* Line 387 of yacc.c */ -#line 189 "spotlight_rawquery_parser.c" + +/* Line 293 of yacc.c */ +#line 187 "slmod_sparql_parser.c" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 #endif -extern YYSTYPE yylval; - -#ifdef YYPARSE_PARAM -#if defined __STDC__ || defined __cplusplus -int yyparse (void *YYPARSE_PARAM); -#else -int yyparse (); -#endif -#else /* ! YYPARSE_PARAM */ -#if defined __STDC__ || defined __cplusplus -int yyparse (void); -#else -int yyparse (); -#endif -#endif /* ! YYPARSE_PARAM */ /* "%code provides" blocks. */ -/* Line 387 of yacc.c */ -#line 39 "spotlight_rawquery_parser.y" + +/* Line 340 of yacc.c */ +#line 39 "slmod_sparql_parser.y" #define SPRAW_TIME_OFFSET 978307200 extern int map_spotlight_to_sparql_query(slq_t *slq, gchar **sparql_result); extern slq_t *ssp_slq; -/* Line 387 of yacc.c */ -#line 221 "spotlight_rawquery_parser.c" -#endif /* !YY_YY_Y_TAB_H_INCLUDED */ +/* Line 340 of yacc.c */ +#line 206 "slmod_sparql_parser.c" /* Copy the second part of user declarations. */ -/* Line 390 of yacc.c */ -#line 228 "spotlight_rawquery_parser.c" + +/* Line 343 of yacc.c */ +#line 212 "slmod_sparql_parser.c" #ifdef short # undef short @@ -277,24 +261,24 @@ typedef short int yytype_int16; # if defined YYENABLE_NLS && YYENABLE_NLS # if ENABLE_NLS # include /* INFRINGES ON USER NAME SPACE */ -# define YY_(Msgid) dgettext ("bison-runtime", Msgid) +# define YY_(msgid) dgettext ("bison-runtime", msgid) # endif # endif # ifndef YY_ -# define YY_(Msgid) Msgid +# define YY_(msgid) msgid # endif #endif /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ -# define YYUSE(E) ((void) (E)) +# define YYUSE(e) ((void) (e)) #else -# define YYUSE(E) /* empty */ +# define YYUSE(e) /* empty */ #endif /* Identity function, used to suppress warnings about constant conditions. */ #ifndef lint -# define YYID(N) (N) +# define YYID(n) (n) #else #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) @@ -330,7 +314,6 @@ YYID (yyi) # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) # include /* INFRINGES ON USER NAME SPACE */ - /* Use EXIT_SUCCESS as a witness for stdlib.h. */ # ifndef EXIT_SUCCESS # define EXIT_SUCCESS 0 # endif @@ -422,20 +405,20 @@ union yyalloc #endif #if defined YYCOPY_NEEDED && YYCOPY_NEEDED -/* Copy COUNT objects from SRC to DST. The source and destination do +/* Copy COUNT objects from FROM to TO. The source and destination do not overlap. */ # ifndef YYCOPY # if defined __GNUC__ && 1 < __GNUC__ -# define YYCOPY(Dst, Src, Count) \ - __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) +# define YYCOPY(To, From, Count) \ + __builtin_memcpy (To, From, (Count) * sizeof (*(From))) # else -# define YYCOPY(Dst, Src, Count) \ - do \ - { \ - YYSIZE_T yyi; \ - for (yyi = 0; yyi < (Count); yyi++) \ - (Dst)[yyi] = (Src)[yyi]; \ - } \ +# define YYCOPY(To, From, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (To)[yyi] = (From)[yyi]; \ + } \ while (YYID (0)) # endif # endif @@ -529,7 +512,7 @@ static const yytype_uint8 yyrline[] = }; #endif -#if YYDEBUG || YYERROR_VERBOSE || 1 +#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = @@ -537,7 +520,7 @@ static const char *const yytname[] = "$end", "error", "$undefined", "WORD", "BOOL", "FUNC_INRANGE", "DATE_ISO", "OBRACE", "CBRACE", "EQUAL", "UNEQUAL", "GT", "LT", "COMMA", "QUOTE", "AND", "OR", "$accept", "input", "line", "expr", "match", - "function", "date", YY_NULL + "function", "date", 0 }; #endif @@ -619,10 +602,10 @@ static const yytype_uint8 yytable[] = 0, 50, 28 }; -#define yypact_value_is_default(Yystate) \ - (!!((Yystate) == (-10))) +#define yypact_value_is_default(yystate) \ + ((yystate) == (-10)) -#define yytable_value_is_error(Yytable_value) \ +#define yytable_value_is_error(yytable_value) \ YYID (0) static const yytype_int8 yycheck[] = @@ -674,35 +657,62 @@ static const yytype_uint8 yystos[] = #define YYRECOVERING() (!!yyerrstatus) -#define YYBACKUP(Token, Value) \ -do \ - if (yychar == YYEMPTY) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - YYPOPSTACK (yylen); \ - yystate = *yyssp; \ - goto yybackup; \ - } \ - else \ - { \ +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY && yylen == 1) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + YYPOPSTACK (1); \ + goto yybackup; \ + } \ + else \ + { \ yyerror (YY_("syntax error: cannot back up")); \ YYERROR; \ } \ while (YYID (0)) -/* Error token number */ + #define YYTERROR 1 #define YYERRCODE 256 +/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. + If N is 0, then set CURRENT to the empty location which ends + the previous symbol: RHS[0] (always defined). */ + +#define YYRHSLOC(Rhs, K) ((Rhs)[K]) +#ifndef YYLLOC_DEFAULT +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ + if (YYID (N)) \ + { \ + (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ + (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ + } \ + else \ + { \ + (Current).first_line = (Current).last_line = \ + YYRHSLOC (Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = \ + YYRHSLOC (Rhs, 0).last_column; \ + } \ + while (YYID (0)) +#endif + + /* This macro is provided for backward compatibility. */ + #ifndef YY_LOCATION_PRINT # define YY_LOCATION_PRINT(File, Loc) ((void) 0) #endif /* YYLEX -- calling `yylex' with the right arguments. */ + #ifdef YYLEX_PARAM # define YYLEX yylex (YYLEX_PARAM) #else @@ -752,8 +762,6 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep) YYSTYPE const * const yyvaluep; #endif { - FILE *yyo = yyoutput; - YYUSE (yyo); if (!yyvaluep) return; # ifdef YYPRINT @@ -765,7 +773,7 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep) switch (yytype) { default: - break; + break; } } @@ -1005,11 +1013,12 @@ static int yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, yytype_int16 *yyssp, int yytoken) { - YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]); + 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 = YY_NULL; + const char *yyformat = 0; /* Arguments of yyformat. */ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; /* Number of reported tokens (one for the "unexpected", one per @@ -1069,13 +1078,11 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, break; } yyarg[yycount++] = yytname[yyx]; - { - YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]); - if (! (yysize <= yysize1 - && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; - } + yysize1 = yysize + yytnamerr (0, yytname[yyx]); + if (! (yysize <= yysize1 + && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; } } } @@ -1095,12 +1102,10 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, # undef YYCASE_ } - { - YYSIZE_T yysize1 = yysize + yystrlen (yyformat); - if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; - } + yysize1 = yysize + yystrlen (yyformat); + if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; if (*yymsg_alloc < yysize) { @@ -1160,27 +1165,32 @@ yydestruct (yymsg, yytype, yyvaluep) { default: - break; + break; } } +/* Prevent warnings from -Wmissing-prototypes. */ +#ifdef YYPARSE_PARAM +#if defined __STDC__ || defined __cplusplus +int yyparse (void *YYPARSE_PARAM); +#else +int yyparse (); +#endif +#else /* ! YYPARSE_PARAM */ +#if defined __STDC__ || defined __cplusplus +int yyparse (void); +#else +int yyparse (); +#endif +#endif /* ! YYPARSE_PARAM */ /* The lookahead symbol. */ int yychar; - -#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN -# define YY_IGNORE_MAYBE_UNINITIALIZED_END -#endif -#ifndef YY_INITIAL_VALUE -# define YY_INITIAL_VALUE(Value) /* Nothing. */ -#endif - /* The semantic value of the lookahead symbol. */ -YYSTYPE yylval YY_INITIAL_VALUE(yyval_default); +YYSTYPE yylval; /* Number of syntax errors so far. */ int yynerrs; @@ -1220,7 +1230,7 @@ yyparse () `yyss': related to states. `yyvs': related to semantic values. - Refer to the stacks through separate pointers, to allow yyoverflow + Refer to the stacks thru separate pointers, to allow yyoverflow to reallocate them elsewhere. */ /* The state stack. */ @@ -1238,7 +1248,7 @@ yyparse () int yyn; int yyresult; /* Lookahead token as an internal (translated) token number. */ - int yytoken = 0; + int yytoken; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; @@ -1256,8 +1266,9 @@ yyparse () Keep to zero when no symbol should be popped. */ int yylen = 0; - yyssp = yyss = yyssa; - yyvsp = yyvs = yyvsa; + yytoken = 0; + yyss = yyssa; + yyvs = yyvsa; yystacksize = YYINITDEPTH; YYDPRINTF ((stderr, "Starting parse\n")); @@ -1266,6 +1277,14 @@ yyparse () yyerrstatus = 0; yynerrs = 0; 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; + goto yysetstate; /*------------------------------------------------------------. @@ -1406,9 +1425,7 @@ yybackup: yychar = YYEMPTY; yystate = yyn; - YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; - YY_IGNORE_MAYBE_UNINITIALIZED_END goto yynewstate; @@ -1445,8 +1462,9 @@ yyreduce: switch (yyn) { case 4: -/* Line 1792 of yacc.c */ -#line 73 "spotlight_rawquery_parser.y" + +/* Line 1806 of yacc.c */ +#line 73 "slmod_sparql_parser.y" { ssp_result = talloc_asprintf(ssp_slq, "SELECT DISTINCT ?url WHERE " @@ -1457,8 +1475,9 @@ yyreduce: break; case 5: -/* Line 1792 of yacc.c */ -#line 83 "spotlight_rawquery_parser.y" + +/* Line 1806 of yacc.c */ +#line 83 "slmod_sparql_parser.y" { if ((yyvsp[(1) - (1)].bval) == false) YYACCEPT; @@ -1468,8 +1487,9 @@ yyreduce: break; case 6: -/* Line 1792 of yacc.c */ -#line 89 "spotlight_rawquery_parser.y" + +/* Line 1806 of yacc.c */ +#line 89 "slmod_sparql_parser.y" { if (strcmp((yyvsp[(1) - (3)].sval), (yyvsp[(3) - (3)].sval)) != 0) (yyval.sval) = talloc_asprintf(ssp_slq, "{ %s } UNION { %s }", (yyvsp[(1) - (3)].sval), (yyvsp[(3) - (3)].sval)); @@ -1479,32 +1499,37 @@ yyreduce: break; case 7: -/* Line 1792 of yacc.c */ -#line 95 "spotlight_rawquery_parser.y" + +/* Line 1806 of yacc.c */ +#line 95 "slmod_sparql_parser.y" {(yyval.sval) = (yyvsp[(1) - (1)].sval); if ((yyval.sval) == NULL) YYABORT;} break; case 8: -/* Line 1792 of yacc.c */ -#line 96 "spotlight_rawquery_parser.y" + +/* Line 1806 of yacc.c */ +#line 96 "slmod_sparql_parser.y" {(yyval.sval) = (yyvsp[(1) - (1)].sval);} break; case 9: -/* Line 1792 of yacc.c */ -#line 97 "spotlight_rawquery_parser.y" + +/* Line 1806 of yacc.c */ +#line 97 "slmod_sparql_parser.y" {(yyval.sval) = talloc_asprintf(ssp_slq, "%s", (yyvsp[(2) - (3)].sval));} break; case 10: -/* Line 1792 of yacc.c */ -#line 98 "spotlight_rawquery_parser.y" + +/* Line 1806 of yacc.c */ +#line 98 "slmod_sparql_parser.y" {(yyval.sval) = talloc_asprintf(ssp_slq, "%s . %s", (yyvsp[(1) - (3)].sval), (yyvsp[(3) - (3)].sval));} break; case 11: -/* Line 1792 of yacc.c */ -#line 99 "spotlight_rawquery_parser.y" + +/* Line 1806 of yacc.c */ +#line 99 "slmod_sparql_parser.y" { if (strcmp((yyvsp[(1) - (3)].sval), (yyvsp[(3) - (3)].sval)) != 0) (yyval.sval) = talloc_asprintf(ssp_slq, "{ %s } UNION { %s }", (yyvsp[(1) - (3)].sval), (yyvsp[(3) - (3)].sval)); @@ -1514,74 +1539,86 @@ yyreduce: break; case 12: -/* Line 1792 of yacc.c */ -#line 108 "spotlight_rawquery_parser.y" + +/* Line 1806 of yacc.c */ +#line 108 "slmod_sparql_parser.y" {(yyval.sval) = map_expr((yyvsp[(1) - (5)].sval), '=', (yyvsp[(4) - (5)].sval));} break; case 13: -/* Line 1792 of yacc.c */ -#line 109 "spotlight_rawquery_parser.y" + +/* Line 1806 of yacc.c */ +#line 109 "slmod_sparql_parser.y" {(yyval.sval) = map_expr((yyvsp[(1) - (5)].sval), '!', (yyvsp[(4) - (5)].sval));} break; case 14: -/* Line 1792 of yacc.c */ -#line 110 "spotlight_rawquery_parser.y" + +/* Line 1806 of yacc.c */ +#line 110 "slmod_sparql_parser.y" {(yyval.sval) = map_expr((yyvsp[(1) - (5)].sval), '<', (yyvsp[(4) - (5)].sval));} break; case 15: -/* Line 1792 of yacc.c */ -#line 111 "spotlight_rawquery_parser.y" + +/* Line 1806 of yacc.c */ +#line 111 "slmod_sparql_parser.y" {(yyval.sval) = map_expr((yyvsp[(1) - (5)].sval), '>', (yyvsp[(4) - (5)].sval));} break; case 16: -/* Line 1792 of yacc.c */ -#line 112 "spotlight_rawquery_parser.y" + +/* Line 1806 of yacc.c */ +#line 112 "slmod_sparql_parser.y" {(yyval.sval) = map_expr((yyvsp[(1) - (6)].sval), '=', (yyvsp[(4) - (6)].sval));} break; case 17: -/* Line 1792 of yacc.c */ -#line 113 "spotlight_rawquery_parser.y" + +/* Line 1806 of yacc.c */ +#line 113 "slmod_sparql_parser.y" {(yyval.sval) = map_expr((yyvsp[(1) - (6)].sval), '!', (yyvsp[(4) - (6)].sval));} break; case 18: -/* Line 1792 of yacc.c */ -#line 114 "spotlight_rawquery_parser.y" + +/* Line 1806 of yacc.c */ +#line 114 "slmod_sparql_parser.y" {(yyval.sval) = map_expr((yyvsp[(1) - (6)].sval), '<', (yyvsp[(4) - (6)].sval));} break; case 19: -/* Line 1792 of yacc.c */ -#line 115 "spotlight_rawquery_parser.y" + +/* Line 1806 of yacc.c */ +#line 115 "slmod_sparql_parser.y" {(yyval.sval) = map_expr((yyvsp[(1) - (6)].sval), '>', (yyvsp[(4) - (6)].sval));} break; case 20: -/* Line 1792 of yacc.c */ -#line 119 "spotlight_rawquery_parser.y" + +/* Line 1806 of yacc.c */ +#line 119 "slmod_sparql_parser.y" {(yyval.sval) = map_daterange((yyvsp[(3) - (8)].sval), (yyvsp[(5) - (8)].tval), (yyvsp[(7) - (8)].tval));} break; case 21: -/* Line 1792 of yacc.c */ -#line 123 "spotlight_rawquery_parser.y" + +/* Line 1806 of yacc.c */ +#line 123 "slmod_sparql_parser.y" {(yyval.tval) = isodate2unix((yyvsp[(3) - (4)].sval));} break; case 22: -/* Line 1792 of yacc.c */ -#line 124 "spotlight_rawquery_parser.y" + +/* Line 1806 of yacc.c */ +#line 124 "slmod_sparql_parser.y" {(yyval.tval) = atoi((yyvsp[(1) - (1)].sval)) + SPRAW_TIME_OFFSET;} break; -/* Line 1792 of yacc.c */ -#line 1585 "spotlight_rawquery_parser.c" + +/* Line 1806 of yacc.c */ +#line 1622 "slmod_sparql_parser.c" default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -1744,9 +1781,7 @@ yyerrlab1: YY_STACK_PRINT (yyss, yyssp); } - YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; - YY_IGNORE_MAYBE_UNINITIALIZED_END /* Shift the error token. */ @@ -1770,7 +1805,7 @@ yyabortlab: yyresult = 1; goto yyreturn; -#if !defined yyoverflow || YYERROR_VERBOSE +#if !defined(yyoverflow) || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ @@ -1812,8 +1847,9 @@ yyreturn: } -/* Line 2055 of yacc.c */ -#line 127 "spotlight_rawquery_parser.y" + +/* Line 2067 of yacc.c */ +#line 127 "slmod_sparql_parser.y" static time_t isodate2unix(const char *s) @@ -2032,3 +2068,4 @@ int main(int argc, char **argv) return 0; } #endif + diff --git a/etc/afpd/spotlight_rawquery_parser.h b/etc/spotlight/slmod_sparql_parser.h similarity index 75% rename from etc/afpd/spotlight_rawquery_parser.h rename to etc/spotlight/slmod_sparql_parser.h index 0cab7aa8..05802801 100644 --- a/etc/afpd/spotlight_rawquery_parser.h +++ b/etc/spotlight/slmod_sparql_parser.h @@ -1,8 +1,8 @@ -/* A Bison parser, made by GNU Bison 2.7. */ +/* A Bison parser, made by GNU Bison 2.5. */ /* Bison interface for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc. + 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 @@ -30,15 +30,6 @@ This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ -#ifndef YY_YY_Y_TAB_H_INCLUDED -# define YY_YY_Y_TAB_H_INCLUDED -/* Enabling traces. */ -#ifndef YYDEBUG -# define YYDEBUG 0 -#endif -#if YYDEBUG -extern int yydebug; -#endif /* Tokens. */ #ifndef YYTOKENTYPE @@ -80,11 +71,13 @@ extern int yydebug; + #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE { -/* Line 2058 of yacc.c */ -#line 45 "spotlight_rawquery_parser.y" + +/* Line 2068 of yacc.c */ +#line 45 "slmod_sparql_parser.y" int ival; const char *sval; @@ -92,8 +85,9 @@ typedef union YYSTYPE time_t tval; -/* Line 2058 of yacc.c */ -#line 97 "spotlight_rawquery_parser.h" + +/* Line 2068 of yacc.c */ +#line 91 "slmod_sparql_parser.h" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ @@ -102,29 +96,17 @@ typedef union YYSTYPE extern YYSTYPE yylval; -#ifdef YYPARSE_PARAM -#if defined __STDC__ || defined __cplusplus -int yyparse (void *YYPARSE_PARAM); -#else -int yyparse (); -#endif -#else /* ! YYPARSE_PARAM */ -#if defined __STDC__ || defined __cplusplus -int yyparse (void); -#else -int yyparse (); -#endif -#endif /* ! YYPARSE_PARAM */ + /* "%code provides" blocks. */ -/* Line 2058 of yacc.c */ -#line 39 "spotlight_rawquery_parser.y" + +/* Line 2068 of yacc.c */ +#line 39 "slmod_sparql_parser.y" #define SPRAW_TIME_OFFSET 978307200 extern int map_spotlight_to_sparql_query(slq_t *slq, gchar **sparql_result); extern slq_t *ssp_slq; -/* Line 2058 of yacc.c */ -#line 129 "spotlight_rawquery_parser.h" -#endif /* !YY_YY_Y_TAB_H_INCLUDED */ +/* Line 2068 of yacc.c */ +#line 113 "slmod_sparql_parser.h" diff --git a/etc/afpd/spotlight_rawquery_parser.y b/etc/spotlight/slmod_sparql_parser.y similarity index 99% rename from etc/afpd/spotlight_rawquery_parser.y rename to etc/spotlight/slmod_sparql_parser.y index e159d1f4..acd58f03 100644 --- a/etc/afpd/spotlight_rawquery_parser.y +++ b/etc/spotlight/slmod_sparql_parser.y @@ -11,9 +11,9 @@ #include #include #include + #include - #include "spotlight_SPARQL_map.h" - #include "spotlight.h" + #include "slmod_sparql_map.h" struct yy_buffer_state; typedef struct yy_buffer_state *YY_BUFFER_STATE; diff --git a/etc/afpd/spotlight_rawquery_lexer.c b/etc/spotlight/spotlight_rawquery_lexer.c similarity index 99% rename from etc/afpd/spotlight_rawquery_lexer.c rename to etc/spotlight/spotlight_rawquery_lexer.c index 2a7c8a78..c278fba6 100644 --- a/etc/afpd/spotlight_rawquery_lexer.c +++ b/etc/spotlight/spotlight_rawquery_lexer.c @@ -486,8 +486,8 @@ char *yytext; #include #include #include -#include "spotlight.h" -#include "spotlight_rawquery_parser.h" +#include +#include "slmod_sparql_parser.h" #line 492 "spotlight_rawquery_lexer.c" #define INITIAL 0 @@ -577,7 +577,7 @@ static int input (void ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO fwrite( yytext, yyleng, 1, yyout ) +#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, @@ -588,7 +588,7 @@ static int input (void ); if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ - int n; \ + unsigned n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ diff --git a/etc/afpd/spotlight_rawquery_lexer.l b/etc/spotlight/spotlight_rawquery_lexer.l similarity index 94% rename from etc/afpd/spotlight_rawquery_lexer.l rename to etc/spotlight/spotlight_rawquery_lexer.l index f29a1a93..bbfcad50 100644 --- a/etc/afpd/spotlight_rawquery_lexer.l +++ b/etc/spotlight/spotlight_rawquery_lexer.l @@ -8,8 +8,8 @@ #include #include #include -#include "spotlight.h" -#include "spotlight_rawquery_parser.h" +#include +#include "slmod_sparql_parser.h" %} %% diff --git a/include/atalk/Makefile.am b/include/atalk/Makefile.am index 04934008..8c58f0e9 100644 --- a/include/atalk/Makefile.am +++ b/include/atalk/Makefile.am @@ -43,4 +43,5 @@ noinst_HEADERS = \ talloc.h \ dalloc.h \ byteorder.h \ - fce_api.h + fce_api.h \ + spotlight.h diff --git a/etc/afpd/spotlight.h b/include/atalk/spotlight.h similarity index 100% rename from etc/afpd/spotlight.h rename to include/atalk/spotlight.h diff --git a/macros/netatalk.m4 b/macros/netatalk.m4 index 22ca226a..45b75cff 100644 --- a/macros/netatalk.m4 +++ b/macros/netatalk.m4 @@ -37,7 +37,7 @@ AC_DEFUN([AC_NETATALK_SPOTLIGHT], [ AC_SUBST(TRACKER_CFLAGS) AC_SUBST(TRACKER_LIBS) - AM_CONDITIONAL(HAVE_TRACKER, [test x"$ac_cv_have_tracker" = x"yes"]) + AM_CONDITIONAL(HAVE_TRACKER_SPARQL, [test x"$ac_cv_have_tracker" = x"yes"]) ac_cv_tracker_miner_pkg_default=tracker-miner-0.12 AC_ARG_WITH([tracker-miner-pkg-config], -- 2.39.2