Initial import

This commit is contained in:
Pierre Pronchery 2015-12-16 19:58:14 +01:00
commit b84664adce
11 changed files with 209 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
Makefile
/config.h

25
COPYING Normal file
View File

@ -0,0 +1,25 @@
Copyright (c) 2015, Pierre Pronchery <khorben@defora.org>
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.

1
README Normal file
View File

@ -0,0 +1 @@
System interfaces for libApp

25
data/Config.interface Normal file
View File

@ -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

11
data/Mutator.interface Normal file
View File

@ -0,0 +1,11 @@
#$Id$
service=Mutator
[call::get]
ret=STRING
arg1=STRING,variable
[call::set]
ret=BOOLEAN
arg1=STRING,variable
arg2=STRING,value

13
data/Shell.interface Normal file
View File

@ -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

96
data/appbroker.sh Executable file
View File

@ -0,0 +1,96 @@
#!/bin/sh
#$Id$
#Copyright (c) 2011-2015 Pierre Pronchery <khorben@defora.org>
#
#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

10
data/project.conf Normal file
View File

@ -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

3
include/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
/Config.h
/Mutator.h
/Shell.h

17
include/project.conf Normal file
View File

@ -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

6
project.conf Normal file
View File

@ -0,0 +1,6 @@
package=AppInterfaces
version=0.0.0
config=h
subdirs=data,include
dist=COPYING,Makefile,config.h