1 /*
2  *
3  * Copyright (C) YEAR The GNOME Foundation
4  *
5  * AUTHORS:
6  *      TO_ADD: your name and email
7  *      Vivien Malerba <malerba@gnome-db.org>
8  *
9  * This Library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Library General Public License as
11  * published by the Free Software Foundation; either version 2 of the
12  * License, or (at your option) any later version.
13  *
14  * This Library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  * Library General Public License for more details.
18  *
19  * You should have received a copy of the GNU Library General Public
20  * License along with this Library; see the file COPYING.LIB.  If not,
21  * write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22  * Boston, MA  02110-1301, USA.
23  */
24 
25 #include "gda-capi-parser.h"
26 #include "capi_token_types.h"
27 #include <string.h>
28 
29 /*
30  * Main static functions
31  */
32 static void gda_capi_parser_class_init (GdaCapiParserClass *klass);
33 static void gda_capi_parser_init (GdaCapiParser *stmt);
34 
35 GType
36 gda_capi_parser_get_type (void)
37 {
38 	static GType type = 0;
39 
40 	if (G_UNLIKELY (type == 0)) {
41 		static GMutex registering;
42 		static const GTypeInfo info = {
43 			sizeof (GdaCapiParserClass),
44 			(GBaseInitFunc) NULL,
45 			(GBaseFinalizeFunc) NULL,
46 			(GClassInitFunc) gda_capi_parser_class_init,
47 			NULL,
48 			NULL,
49 			sizeof (GdaCapiParser),
50 			0,
51 			(GInstanceInitFunc) gda_capi_parser_init,
52 			0
53 		};
54 
55 		g_mutex_lock (&registering);
56 		if (type == 0)
57 			type = g_type_register_static (GDA_TYPE_SQL_PARSER, "GdaCapiParser", &info, 0);
58 		g_mutex_unlock (&registering);
59 	}
60 	return type;
61 }
62 
63 /*
64  * The interface to the LEMON-generated parser
65  */
66 void *gda_lemon_capi_parserAlloc (void*(*)(size_t));
67 void gda_lemon_capi_parserFree (void*, void(*)(void*));
68 void gda_lemon_capi_parserTrace (void*, char *);
69 void gda_lemon_capi_parser (void*, int, GValue *, GdaSqlParserIface *);
70 
71 static void
72 gda_capi_parser_class_init (GdaCapiParserClass * klass)
73 {
74 	GdaSqlParserClass *pclass = GDA_SQL_PARSER_CLASS (klass);
75 
76 	pclass->parser_alloc = gda_lemon_capi_parserAlloc;
77 	pclass->parser_free = gda_lemon_capi_parserFree;
78 	pclass->parser_trace = gda_lemon_capi_parserTrace;
79 	pclass->parser_parse = gda_lemon_capi_parser;
80 	pclass->parser_tokens_trans = capi_parser_tokens;
81 }
82 
83 static void
84 gda_capi_parser_init (G_GNUC_UNUSED GdaCapiParser *parser)
85 {
86 }
87