directory ordering

This commit is contained in:
anon 2024-02-12 21:07:48 +01:00
parent 4a540661e2
commit 1c687aba0c
34 changed files with 37 additions and 38 deletions

1
.gitignore vendored
View File

@ -25,3 +25,4 @@ libsqlpars-uninstalled.pc
libsqlpars.pc libsqlpars.pc
sqlpars-config.h* sqlpars-config.h*
build-aux/

View File

@ -12,34 +12,34 @@ pkgconfig_DATA = libsqlpars.pc
# noinst_PROGRAMS = $(TESTS) # noinst_PROGRAMS = $(TESTS)
EXTRA_DIST = sql.y sql.l \ EXTRA_DIST = sql.y sql.l \
pscan.js \ pscan.js \
test-ok.sh test-fail.sh \ test/test-ok.sh test/test-fail.sh \
fail1.sql \ test/fail1.sql \
fail3.sql \ test/fail3.sql \
fail4.sql \ test/fail4.sql \
fail5.sql \ test/fail5.sql \
xfail2.sql \ test/xfail2.sql \
ok1.sql \ test/ok1.sql \
ok2.sql \ test/ok2.sql \
ok3.sql \ test/ok3.sql \
ok4.sql \ test/ok4.sql \
ok5.sql \ test/ok5.sql \
ok6.sql \ test/ok6.sql \
ok7.sql \ test/ok7.sql \
ok8.sql \ test/ok8.sql \
ok9.sql \ test/ok9.sql \
ok10.sql test/ok10.sql
sql_SOURCES = exec.c lib.c main.c sql-parser.h yyl.h sql_SOURCES = source/exec.c source/lib.c source/main.c source/sql-parser.h source/yyl.h
sql_LDADD = @JANSSON_LIBS@ sql_LDADD = @JANSSON_LIBS@
nodist_sql_SOURCES = sql.c sql.tab.c sql.tab.h sql.lex.h nodist_sql_SOURCES = source/sql.c source/sql.tab.c source/sql.tab.h source/sql.lex.h
BUILT_SOURCES = $(nodist_sql_SOURCES) BUILT_SOURCES = $(nodist_sql_SOURCES)
CLEANFILES = $(nodist_sql_SOURCES) sql.output CLEANFILES = $(nodist_sql_SOURCES) sql.output
sql.tab.c sql.tab.h: sql.y Makefile source/sql.tab.c source/sql.tab.h: source/sql.y Makefile
${BISON} -vd $< ${BISON} -o $@ -vd $<
sql.c sql.lex.h: sql.l Makefile source/sql.c source/sql.lex.h: source/sql.l Makefile
${LEX} -o $@ $< ${LEX} -o $@ $<
TESTS = test-ok.sh test-fail.sh TESTS = test-ok.sh test-fail.sh

View File

@ -21,10 +21,10 @@ dnl make the compilation flags quiet unless V=1 is used
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
AC_PREREQ(2.60) AC_PREREQ(2.60)
AC_CONFIG_SRCDIR([exec.c]) AC_CONFIG_SRCDIR([source/exec.c])
AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([build-aux/m4]) AC_CONFIG_MACRO_DIR([build-aux/m4])
AC_CONFIG_HEADERS([sqlpars-config.h]) AC_CONFIG_HEADERS([source/sqlpars-config.h])
AM_INIT_AUTOMAKE([subdir-objects foreign]) AM_INIT_AUTOMAKE([subdir-objects foreign])
LIBSQLPARS_MAJOR_VERSION=libsqlpars_major_version LIBSQLPARS_MAJOR_VERSION=libsqlpars_major_version

0
source/.dirstamp Normal file
View File

View File

View File

@ -25,6 +25,7 @@ main(int ac, char **av)
abort(); abort();
if(ac > 1) { if(ac > 1) {
puts("wut?");
if((in_f = fopen(av[1], "r")) == NULL) { if((in_f = fopen(av[1], "r")) == NULL) {
perror(av[1]); perror(av[1]);
exit(1); exit(1);
@ -41,7 +42,7 @@ main(int ac, char **av)
psql_free(pstate); psql_free(pstate);
if (!res && !yyerrno) { if (!res) {
printf("{\"result\":true}\n"); printf("{\"result\":true}\n");
return 0; return 0;
} else { } else {

View File

@ -18,7 +18,7 @@
%option noyywrap nodefault yylineno case-insensitive reentrant %option noyywrap nodefault yylineno case-insensitive reentrant
%option bison-bridge bison-locations %option bison-bridge bison-locations
%option header-file="sql.lex.h" %option header-file="source/sql.lex.h"
%{ %{
#include <stdarg.h> #include <stdarg.h>

View File

@ -21,7 +21,6 @@
#include <string.h> #include <string.h>
char *filename; char *filename;
int yyerrno;
%} %}
%define api.pure %define api.pure
@ -32,7 +31,6 @@ int yyerrno;
%code requires { %code requires {
extern char *filename; extern char *filename;
extern int yyerrno;
#include "yyl.h" #include "yyl.h"
@ -329,11 +327,7 @@ void yyerror(YYLTYPE *, yyscan_t scanner, struct psql_state *pstate, const char
void lyyerror(YYLTYPE t, const char *s, ...); void lyyerror(YYLTYPE t, const char *s, ...);
%} %}
/* free discarded tokens */ /* free discarded tokens */
%destructor { %destructor { printf ("free at %d %s\n",@$.first_line, $$); free($$); } <strval>
#if DEBUG
printf ("free at %d %s\n",@$.first_line, $$); free($$);
#endif
} <strval>
%% %%
@ -980,7 +974,7 @@ yyerror(YYLTYPE *t, yyscan_t scanner, struct psql_state *pstate, const char *s,
t->last_line, t->last_column); t->last_line, t->last_column);
vfprintf(stderr, s, ap); vfprintf(stderr, s, ap);
fprintf(stderr, "\n"); fprintf(stderr, "\n");
yyerrno = 1;
} }
void void
@ -994,6 +988,5 @@ lyyerror(YYLTYPE t, const char *s, ...)
t.last_line, t.last_column); t.last_line, t.last_column);
vfprintf(stderr, s, ap); vfprintf(stderr, s, ap);
fprintf(stderr, "\n"); fprintf(stderr, "\n");
yyerrno = 1;
} }

View File

View File

@ -1,8 +1,10 @@
#!/bin/sh #!/bin/sh
for testfn in $srcdir/fail*.sql export PATH=.:..:$PATH
for testfn in fail*.sql
do do
cat $testfn | ./sql cat $testfn | sql
if [ $? -ne 1 ] if [ $? -ne 1 ]
then then
echo "Failed on $testfn" echo "Failed on $testfn"

View File

@ -1,8 +1,10 @@
#!/bin/sh #!/bin/sh
for testfn in $srcdir/ok*.sql export PATH=.:..:$PATH
for testfn in ok*.sql
do do
cat $testfn | ./sql cat $testfn | sql
if [ $? -ne 0 ] if [ $? -ne 0 ]
then then
echo "Failed on $testfn" echo "Failed on $testfn"