Skip to content

Commit 69adaf2

Browse files
committed
validate-input: add swipl input validator
Signed-off-by: Masatake YAMATO <[email protected]>
1 parent 3799027 commit 69adaf2

File tree

4 files changed

+37
-1
lines changed

4 files changed

+37
-1
lines changed
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
KNOWN-INVALIDATION

Units/parser-prolog.r/validator

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
swipl

circle.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
dnf -y install awk gcc automake autoconf pkgconfig make libseccomp-devel libxml2-devel jansson-devel libyaml-devel pcre2-devel findutils diffutils sudo
2525
dnf -y install jq puppet python3-sphinx
2626
# These are for input-validation.
27-
dnf -y install g++ jq puppet nodejs gcc-gfortran gcc-gnat
27+
dnf -y install g++ jq puppet nodejs gcc-gfortran gcc-gnat swi-prolog
2828
# nodejs requires libsqlite.so.0 with sqlite-session feature
2929
# It was tured off in 3.46.1-1.
3030
dnf -y update sqlite-libs

misc/validators/validator-swipl

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# -*- sh -*-
2+
# validator-swipl - validating Prolog input files with swipl
3+
#
4+
# Copyright (c) 2025 Maatake YAMATO
5+
#
6+
# This program is free software; you can redistribute it and/or
7+
# modify it under the terms of the GNU General Public License
8+
# as published by the Free Software Foundation; either version 2
9+
# of the License, or (at your option) any later version.
10+
#
11+
# This program is distributed in the hope that it will be useful,
12+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
# GNU General Public License for more details.
15+
#
16+
# You should have received a copy of the GNU General Public License
17+
# along with this program; if not, write to the Free Software
18+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
19+
# USA.
20+
#
21+
action=$1
22+
input="$2"
23+
cmd=swipl
24+
flags="--on-error=status -g halt."
25+
case "$action" in
26+
is_runnable)
27+
type $cmd > /dev/null 2>&1
28+
exit $?
29+
;;
30+
validate)
31+
$cmd $flags "$input" > /dev/null
32+
exit $?
33+
;;
34+
esac

0 commit comments

Comments
 (0)