From b84664adcef22696f77625ed9b20fdbe897105fe Mon Sep 17 00:00:00 2001 From: Pierre Pronchery Date: Wed, 16 Dec 2015 19:58:14 +0100 Subject: [PATCH] Initial import --- .gitignore | 2 + COPYING | 25 +++++++++++ README | 1 + data/Config.interface | 25 +++++++++++ data/Mutator.interface | 11 +++++ data/Shell.interface | 13 ++++++ data/appbroker.sh | 96 ++++++++++++++++++++++++++++++++++++++++++ data/project.conf | 10 +++++ include/.gitignore | 3 ++ include/project.conf | 17 ++++++++ project.conf | 6 +++ 11 files changed, 209 insertions(+) create mode 100644 .gitignore create mode 100644 COPYING create mode 100644 README create mode 100644 data/Config.interface create mode 100644 data/Mutator.interface create mode 100644 data/Shell.interface create mode 100755 data/appbroker.sh create mode 100644 data/project.conf create mode 100644 include/.gitignore create mode 100644 include/project.conf create mode 100644 project.conf diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6328769 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +Makefile +/config.h diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..ecbdfd4 --- /dev/null +++ b/COPYING @@ -0,0 +1,25 @@ +Copyright (c) 2015, Pierre Pronchery +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS +IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED +TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/README b/README new file mode 100644 index 0000000..71600e7 --- /dev/null +++ b/README @@ -0,0 +1 @@ +System interfaces for libApp diff --git a/data/Config.interface b/data/Config.interface new file mode 100644 index 0000000..347b40b --- /dev/null +++ b/data/Config.interface @@ -0,0 +1,25 @@ +#$Id$ +service=Config + +[constants] +LIST_SECTIONS=1 +LIST_VARIABLES=2 + +[call::get] +ret=STRING +arg1=STRING,filename +arg2=STRING,section +arg3=STRING,variable + +[call::list] +ret=STRING[] +arg1=STRING,filename +arg2=STRING,section +arg3=UINT32,what + +[call::set] +ret=BOOLEAN +arg1=STRING,filename +arg2=STRING,section +arg3=STRING,variable +arg4=STRING,value diff --git a/data/Mutator.interface b/data/Mutator.interface new file mode 100644 index 0000000..7a351f7 --- /dev/null +++ b/data/Mutator.interface @@ -0,0 +1,11 @@ +#$Id$ +service=Mutator + +[call::get] +ret=STRING +arg1=STRING,variable + +[call::set] +ret=BOOLEAN +arg1=STRING,variable +arg2=STRING,value diff --git a/data/Shell.interface b/data/Shell.interface new file mode 100644 index 0000000..93bc613 --- /dev/null +++ b/data/Shell.interface @@ -0,0 +1,13 @@ +#$Id$ +service=Shell + +[call::exec] +ret=UINT +arg1=STRING,program +arg2=STRING[],argv +arg3=STRING[],envp +arg4=STRING,cwd + +[call::run] +ret=UINT +arg1=STRING,command diff --git a/data/appbroker.sh b/data/appbroker.sh new file mode 100755 index 0000000..e67b3d7 --- /dev/null +++ b/data/appbroker.sh @@ -0,0 +1,96 @@ +#!/bin/sh +#$Id$ +#Copyright (c) 2011-2015 Pierre Pronchery +# +#Redistribution and use in source and binary forms, with or without +#modification, are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, this +# list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# +#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +#AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +#IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +#DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +#FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +#DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +#SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +#OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +#OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + + +#variables +PROGNAME="appbroker.sh" +#executables +APPBROKER="AppBroker" +DEBUG="_debug" + + +#functions +#appbroker +_appbroker() +{ + target="$1" + appinterface="$2" + + $DEBUG $APPBROKER -o "$target" "$appinterface" +} + + +#debug +_debug() +{ + echo "$@" 1>&2 + "$@" +} + + +#usage +_usage() +{ + echo "Usage: $PROGNAME [-c][-P prefix] target..." 1>&2 + return 1 +} + + +#main +clean=0 +while getopts "cO:P:" name; do + case "$name" in + c) + clean=1 + ;; + O) + export "${OPTARG%%=*}"="${OPTARG#*=}" + ;; + P) + #we can ignore it + ;; + ?) + _usage + exit $? + ;; + esac +done +shift $(($OPTIND - 1)) +if [ $# -eq 0 ]; then + _usage + exit $? +fi + +[ "$clean" -ne 0 ] && exit 0 + +while [ $# -gt 0 ]; do + target="$1" + shift + + source="${target#$OBJDIR}" + appinterface="${source##*/}" + appinterface="../data/${appinterface%%.h}.interface" + _appbroker "$target" "$appinterface" || exit 2 +done diff --git a/data/project.conf b/data/project.conf new file mode 100644 index 0000000..fdf0fee --- /dev/null +++ b/data/project.conf @@ -0,0 +1,10 @@ +dist=Makefile,Config.interface,Mutator.interface,Shell.interface,appbroker.sh + +[Config.interface] +install=$(PREFIX)/etc/AppInterface + +[Mutator.interface] +install=$(PREFIX)/etc/AppInterface + +[Shell.interface] +install=$(PREFIX)/etc/AppInterface diff --git a/include/.gitignore b/include/.gitignore new file mode 100644 index 0000000..2f7fa56 --- /dev/null +++ b/include/.gitignore @@ -0,0 +1,3 @@ +/Config.h +/Mutator.h +/Shell.h diff --git a/include/project.conf b/include/project.conf new file mode 100644 index 0000000..45d48f2 --- /dev/null +++ b/include/project.conf @@ -0,0 +1,17 @@ +targets=Config.h,Mutator.h,Shell.h +dist=Makefile + +[Config.h] +type=script +script=../data/appbroker.sh +depends=../data/appbroker.sh,../data/Config.interface + +[Mutator.h] +type=script +script=../data/appbroker.sh +depends=../data/appbroker.sh,../data/Mutator.interface + +[Shell.h] +type=script +script=../data/appbroker.sh +depends=../data/appbroker.sh,../data/Shell.interface diff --git a/project.conf b/project.conf new file mode 100644 index 0000000..6903404 --- /dev/null +++ b/project.conf @@ -0,0 +1,6 @@ +package=AppInterfaces +version=0.0.0 +config=h + +subdirs=data,include +dist=COPYING,Makefile,config.h