templating helper
This commit is contained in:
parent
481ffc1a0a
commit
1d483e2e17
@ -146,3 +146,7 @@ bench_db_postgres_LDADD = \
|
|||||||
|
|
||||||
EXTRA_test_exchangedb_postgres_DEPENDENCIES = \
|
EXTRA_test_exchangedb_postgres_DEPENDENCIES = \
|
||||||
libtaler_plugin_exchangedb_postgres.la
|
libtaler_plugin_exchangedb_postgres.la
|
||||||
|
|
||||||
|
EXTRA_DIST = \
|
||||||
|
pg_template.h pg_template.c \
|
||||||
|
pg_template.sh
|
||||||
|
26
src/exchangedb/pg_template.c
Normal file
26
src/exchangedb/pg_template.c
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
/*
|
||||||
|
This file is part of TALER
|
||||||
|
Copyright (C) 2022 Taler Systems SA
|
||||||
|
|
||||||
|
TALER 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 3, or (at your option) any later version.
|
||||||
|
|
||||||
|
TALER 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
|
||||||
|
TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* @file pg_template.c
|
||||||
|
* @brief Implementation of the template function for Postgres
|
||||||
|
* @author Christian Grothoff
|
||||||
|
*/
|
||||||
|
#include "platform.h"
|
||||||
|
#include "taler_error_codes.h"
|
||||||
|
#include "taler_dbevents.h"
|
||||||
|
#include "taler_pq_lib.h"
|
||||||
|
#include "pg_template.h"
|
||||||
|
#include "pg_helper.h"
|
29
src/exchangedb/pg_template.h
Normal file
29
src/exchangedb/pg_template.h
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
This file is part of TALER
|
||||||
|
Copyright (C) 2022 Taler Systems SA
|
||||||
|
|
||||||
|
TALER 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 3, or (at your option) any later version.
|
||||||
|
|
||||||
|
TALER 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
|
||||||
|
TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* @file pg_template.h
|
||||||
|
* @brief implementation of the template function for Postgres
|
||||||
|
* @author Christian Grothoff
|
||||||
|
*/
|
||||||
|
#ifndef PG_TEMPLATE_H
|
||||||
|
#define PG_TEMPLATE_H
|
||||||
|
|
||||||
|
#include "taler_util.h"
|
||||||
|
#include "taler_json_lib.h"
|
||||||
|
#include "taler_exchangedb_plugin.h"
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
12
src/exchangedb/pg_template.sh
Executable file
12
src/exchangedb/pg_template.sh
Executable file
@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# This file is in the public domain.
|
||||||
|
#
|
||||||
|
# Instantiates pg_template for a particular function.
|
||||||
|
|
||||||
|
for n in $*
|
||||||
|
do
|
||||||
|
NCAPS=`echo $n | tr a-z A-Z`
|
||||||
|
cat pg_template.c | sed -e s/template/$n/g -e s/TEMPLATE/$NCAPS/g > pg_$n.c
|
||||||
|
cat pg_template.h | sed -e s/template/$n/g -e s/TEMPLATE/$NCAPS/g > pg_$n.h
|
||||||
|
echo "\#include \"pg_$n.h\"" >> hdr.h
|
||||||
|
done
|
Loading…
Reference in New Issue
Block a user