aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2018-03-15 13:29:52 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2018-03-15 14:12:23 +0200
commit58a8936d30bbb18b8ad93fecfe3fe2210d1c18b2 (patch)
tree01fcd1416af582e2429f0ae8d120e2af39b8f9d9 /lib
parent677473cdfc42b9fd83623902e80de946f108825c (diff)
downloadeclat-58a8936d30bbb18b8ad93fecfe3fe2210d1c18b2.tar.gz
eclat-58a8936d30bbb18b8ad93fecfe3fe2210d1c18b2.tar.bz2
Upgrade grecs
* grecs: pull * configure.ac: Enable json * lib/Makefile.am (AM_CPPFLAGS): Use @GRECS_INCLUDES@ (libeclat_a_SOURCES): Remove json sources. * src/Makefile.am (AM_CPPFLAGS): Use @GRECS_INCLUDES@ * tests/Makefile.am: Likewise. * lib/json.h: Remove. * lib/jsongrm.y: Remove. * lib/jsonlex.l: Remove. * tests/tjson.c: Remove. * src/config.c (eclat_kw): Mark statically initialized memory locations as such. * src/mktags.c (process_tags): Use wordsplit to process quoted arguments. * lib/bidimap.c (bidimap_config): Fill allocated memory with 0's * lib/filemap.c (filemap_config): Likewise. * lib/gdbmmap.c (gdbm_map_config): Likewise. * lib/seqmap.c (seqmap_config): Likewise.
Diffstat (limited to 'lib')
-rw-r--r--lib/Makefile.am11
-rw-r--r--lib/bidimap.c4
-rw-r--r--lib/filemap.c4
-rw-r--r--lib/forlangrm.y4
-rw-r--r--lib/forlanlex.l15
-rw-r--r--lib/gdbmmap.c4
-rw-r--r--lib/json.h66
-rw-r--r--lib/jsongrm.y316
-rw-r--r--lib/jsonlex.l183
-rw-r--r--lib/map.c6
-rw-r--r--lib/req2url.c6
-rw-r--r--lib/reqcreat.c2
-rw-r--r--lib/reqencode.c4
-rw-r--r--lib/reqsign.c8
-rw-r--r--lib/seqmap.c4
15 files changed, 34 insertions, 603 deletions
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 711bc98..e1ed1c3 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -1,5 +1,5 @@
1# This file is part of Eclat 1# This file is part of Eclat
2# Copyright (C) 2012-2015 Sergey Poznyakoff 2# Copyright (C) 2012-2018 Sergey Poznyakoff
3# 3#
4# Eclat is free software; you can redistribute it and/or modify 4# Eclat is free software; you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by 5# it under the terms of the GNU General Public License as published by
@@ -43,10 +43,6 @@ libeclat_a_SOURCES=\
43 forlangrm.y\ 43 forlangrm.y\
44 forlanlex.l\ 44 forlanlex.l\
45 istore.c\ 45 istore.c\
46 json.h\
47 jsongrm.h\
48 jsongrm.y\
49 jsonlex.l\
50 getans.c\ 46 getans.c\
51 getyn.c\ 47 getyn.c\
52 hmac_sha1.c\ 48 hmac_sha1.c\
@@ -71,14 +67,11 @@ libeclat_a_SOURCES=\
71 $(maps) 67 $(maps)
72 68
73AM_LDFLAGS = $(CURL_LIBS) 69AM_LDFLAGS = $(CURL_LIBS)
74AM_CPPFLAGS = -I$(top_srcdir)/grecs/src/ $(CURL_CFLAGS) 70AM_CPPFLAGS = @GRECS_INCLUDES@ $(CURL_CFLAGS)
75 71
76forlanlex.c: forlangrm.h 72forlanlex.c: forlangrm.h
77forlangrm.c forlangrm.h: forlangrm.y 73forlangrm.c forlangrm.h: forlangrm.y
78 74
79jsonlex.c: jsongrm.h
80jsongrm.c jsongrm.h: jsongrm.y
81
82AM_YFLAGS=-tdv 75AM_YFLAGS=-tdv
83AM_LFLAGS=-dp 76AM_LFLAGS=-dp
84 77
diff --git a/lib/bidimap.c b/lib/bidimap.c
index fc601c8..aafc736 100644
--- a/lib/bidimap.c
+++ b/lib/bidimap.c
@@ -1,5 +1,5 @@
1/* This file is part of Eclat. 1/* This file is part of Eclat.
2 Copyright (C) 2012-2015 Sergey Poznyakoff. 2 Copyright (C) 2012-2018 Sergey Poznyakoff.
3 3
4 Eclat is free software; you can redistribute it and/or modify 4 Eclat is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by 5 it under the terms of the GNU General Public License as published by
@@ -100,7 +100,7 @@ bidimap_config(int dbg, struct grecs_node *node, void *data)
100 struct bidimap *map, **return_map = data; 100 struct bidimap *map, **return_map = data;
101 int i; 101 int i;
102 102
103 map = grecs_malloc(sizeof(*map)); 103 map = grecs_zalloc(sizeof(*map));
104 for (i = 0; bidimap_kw[i].ident; i++) 104 for (i = 0; bidimap_kw[i].ident; i++)
105 bidimap_kw[i].varptr = map; 105 bidimap_kw[i].varptr = map;
106 if (grecs_tree_process(node->down, bidimap_kw)) { 106 if (grecs_tree_process(node->down, bidimap_kw)) {
diff --git a/lib/filemap.c b/lib/filemap.c
index 6c5e286..26582ec 100644
--- a/lib/filemap.c
+++ b/lib/filemap.c
@@ -1,5 +1,5 @@
1/* This file is part of Eclat. 1/* This file is part of Eclat.
2 Copyright (C) 2012-2015 Sergey Poznyakoff. 2 Copyright (C) 2012-2018 Sergey Poznyakoff.
3 3
4 Eclat is free software; you can redistribute it and/or modify 4 Eclat is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by 5 it under the terms of the GNU General Public License as published by
@@ -60,7 +60,7 @@ filemap_config(int dbg, struct grecs_node *node, void *data)
60 int i; 60 int i;
61 struct grecs_node *p; 61 struct grecs_node *p;
62 62
63 filemap = grecs_malloc(sizeof(*filemap)); 63 filemap = grecs_zalloc(sizeof(*filemap));
64 for (i = 0; filemap_kw[i].ident; i++) 64 for (i = 0; filemap_kw[i].ident; i++)
65 filemap_kw[i].varptr = filemap; 65 filemap_kw[i].varptr = filemap;
66 if (grecs_tree_process(node->down, filemap_kw)) { 66 if (grecs_tree_process(node->down, filemap_kw)) {
diff --git a/lib/forlangrm.y b/lib/forlangrm.y
index ecfbf25..2db1274 100644
--- a/lib/forlangrm.y
+++ b/lib/forlangrm.y
@@ -1,6 +1,6 @@
1%{ 1%{
2/* This file is part of Eclat. 2/* This file is part of Eclat.
3 Copyright (C) 2012-2015 Sergey Poznyakoff. 3 Copyright (C) 2012-2018 Sergey Poznyakoff.
4 4
5 Eclat is free software; you can redistribute it and/or modify 5 Eclat is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
@@ -17,7 +17,7 @@
17 17
18#include "libeclat.h" 18#include "libeclat.h"
19#include <grecs.h> 19#include <grecs.h>
20#include <grecs-locus.h> 20#include <grecs/locus.h>
21#include "forlangrm.h" 21#include "forlangrm.h"
22#include "forlan.h" 22#include "forlan.h"
23#include <string.h> 23#include <string.h>
diff --git a/lib/forlanlex.l b/lib/forlanlex.l
index db893df..62265cb 100644
--- a/lib/forlanlex.l
+++ b/lib/forlanlex.l
@@ -1,6 +1,6 @@
1%{ 1%{
2/* This file is part of Eclat. 2/* This file is part of Eclat.
3 Copyright (C) 2012-2015 Sergey Poznyakoff. 3 Copyright (C) 2012-2018 Sergey Poznyakoff.
4 4
5 Eclat is free software; you can redistribute it and/or modify 5 Eclat is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@
19#include <sysexits.h> 19#include <sysexits.h>
20#include <ctype.h> 20#include <ctype.h>
21#include <grecs.h> 21#include <grecs.h>
22#include <grecs-locus.h> 22#include <grecs/locus.h>
23#include "forlangrm.h" 23#include "forlangrm.h"
24#include "forlan.h" 24#include "forlan.h"
25 25
@@ -100,15 +100,18 @@ continue return CONTINUE;
100\"[^\\"\n]*\\\n { BEGIN(STR); 100\"[^\\"\n]*\\\n { BEGIN(STR);
101 grecs_line_begin(); 101 grecs_line_begin();
102 grecs_line_acc_grow_unescape_last(yytext + 1, 102 grecs_line_acc_grow_unescape_last(yytext + 1,
103 yyleng - 1); 103 yyleng - 1,
104 &yylloc);
104 grecs_locus_point_advance_line(grecs_current_locus_point); } 105 grecs_locus_point_advance_line(grecs_current_locus_point); }
105\"[^\\"\n]*\\. { BEGIN(STR); 106\"[^\\"\n]*\\. { BEGIN(STR);
106 grecs_line_begin(); 107 grecs_line_begin();
107 grecs_line_acc_grow_unescape_last(yytext + 1, 108 grecs_line_acc_grow_unescape_last(yytext + 1,
108 yyleng - 1); } 109 yyleng - 1,
109<STR>\"[^\\"\n]*\\\n { grecs_line_acc_grow_unescape_last(yytext, yyleng); 110 &yylloc); }
111<STR>\"[^\\"\n]*\\\n { grecs_line_acc_grow_unescape_last(yytext, yyleng,
112 &yylloc);
110 grecs_locus_point_advance_line(grecs_current_locus_point); } 113 grecs_locus_point_advance_line(grecs_current_locus_point); }
111<STR>[^\\"\n]*\\. { grecs_line_acc_grow_unescape_last(yytext, yyleng); } 114<STR>[^\\"\n]*\\. { grecs_line_acc_grow_unescape_last(yytext, yyleng, &yylloc); }
112<STR>[^\\"\n]*\" { BEGIN(INITIAL); 115<STR>[^\\"\n]*\" { BEGIN(INITIAL);
113 if (yyleng > 1) 116 if (yyleng > 1)
114 grecs_line_add(yytext, yyleng - 1); 117 grecs_line_add(yytext, yyleng - 1);
diff --git a/lib/gdbmmap.c b/lib/gdbmmap.c
index dde6b02..a2887df 100644
--- a/lib/gdbmmap.c
+++ b/lib/gdbmmap.c
@@ -1,5 +1,5 @@
1/* This file is part of Eclat. 1/* This file is part of Eclat.
2 Copyright (C) 2012-2015 Sergey Poznyakoff. 2 Copyright (C) 2012-2018 Sergey Poznyakoff.
3 3
4 Eclat is free software; you can redistribute it and/or modify 4 Eclat is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by 5 it under the terms of the GNU General Public License as published by
@@ -69,7 +69,7 @@ gdbm_map_config(int dbg, struct grecs_node *node, void *data)
69 struct grecs_node *p; 69 struct grecs_node *p;
70 int i; 70 int i;
71 71
72 gdbm_map = grecs_malloc(sizeof(*gdbm_map)); 72 gdbm_map = grecs_zalloc(sizeof(*gdbm_map));
73 for (i = 0; gdbm_map_kw[i].ident; i++) 73 for (i = 0; gdbm_map_kw[i].ident; i++)
74 gdbm_map_kw[i].varptr = gdbm_map; 74 gdbm_map_kw[i].varptr = gdbm_map;
75 if (grecs_tree_process(node->down, gdbm_map_kw)) { 75 if (grecs_tree_process(node->down, gdbm_map_kw)) {
diff --git a/lib/json.h b/lib/json.h
deleted file mode 100644
index 36ca243..0000000
--- a/lib/json.h
+++ /dev/null
@@ -1,66 +0,0 @@
1/* This file is part of Eclat.
2 Copyright (C) 2012-2015 Sergey Poznyakoff.
3
4 Eclat is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 3, or (at your option)
7 any later version.
8
9 Eclat is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with Eclat. If not, see <http://www.gnu.org/licenses/>. */
16
17#include <grecs.h>
18
19enum json_object_type
20{
21 json_null,
22 json_bool,
23 json_number,
24 json_string,
25 json_arr,
26 json_obj
27};
28
29struct json_object;
30struct json_array {
31 size_t oc;
32 struct json_object **ov;
33};