Update of /cvsroot/simspark/simspark/spark/zeitgeist
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5413/zeitgeist
Added Files:
zeitgeist-config.in zeitgeist.rb
Log Message:
--- NEW FILE: zeitgeist-config.in ---
#! /bin/sh
prefix=@prefix@
exec_prefix=@exec_prefix@
usage()
{
cat <<EOF
Usage: zeitgeist-config [OPTIONS] [LIBRARIES]
Options:
[--prefix[=DIR]]
[--exec-prefix[=DIR]]
[--version]
[--libs]
[--libtool]
[--cflags]
EOF
exit $1
}
if test $# -eq 0 ; then
usage 1 1>&2
fi
while test $# -gt 0 ; do
case "$1" in
-*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
*) optarg= ;;
esac
case $1 in
--prefix=*)
prefix=$optarg
local_prefix=yes
;;
--prefix)
echo_prefix=yes
;;
--exec-prefix=*)
exec_prefix=$optarg
exec_prefix_set=yes
local_prefix=yes
;;
--exec-prefix)
echo_exec_prefix=yes
;;
--version)
echo @zeitgeist_version@
exit 0
;;
--cflags)
echo_cflags=yes
;;
--libs)
echo_libs=yes
;;
--libtool)
echo_libtool=yes
;;
*)
usage 1 1>&2
;;
esac
shift
done
if test "$local_prefix" = "yes" ; then
if test "$exec_prefix_set" != "yes" ; then
exec_prefix=$prefix
fi
fi
if test "$echo_prefix" = "yes" ; then
echo $prefix
fi
if test "$echo_exec_prefix" = "yes" ; then
echo $exec_prefix
fi
if test "$echo_cflags" = "yes" ; then
cflags="-I@includedir@/rcssserver3d"
if test "@includedir@" != "/usr/include" ; then
echo $cflags -I@includedir@
else
echo $cflags
fi
fi
if test "$echo_libs" = "yes" ; then
if test "@debug@" = "true"; then
libs="-lzeitgeist_debug"
else
libs="-lzeitgeist"
fi
echo -L@libdir@/rcssserver3d $libs
fi
if test "$echo_libtool" = "yes" ; then
if test "@debug@" = "true"; then
convlib="libzeitgeist_debug.la"
else
convlib="libzeitgeist.la"
fi
echo @libdir@/rcssserver3d/$convlib
fi
# EOF
--- NEW FILE: zeitgeist.rb ---
#
# this is the init script of the Zeitgeist library
#
# here we perform the callback to zeitgeist
def method_missing(methId, *args)
str = methId.id2name
selectCall str, args
end
# this method allows us to create new instance variables in class objects
# we use class objects as 'namespaces'
# createVariable can be used in two forms:
# - 2 parameters: createVariable("myNamespace.myVarName", "myValue");
# - 3 parameters: createVariable("myNamespace", "myVarName", "myValue");
def createVariable (namespace, variable, value = nil)
# 2 parameters means the "namespace.variable", "value" form
if (value == nil)
value = variable;
# parse namespace into a namespace and varName pair
periodIndex = namespace.index('.');
if (periodIndex != nil && periodIndex > 0)
variable = namespace[(periodIndex+1)..-1];
namespace = namespace[0..(periodIndex-1)];
else
namespace = nil;
end
end
# here we have 3 parameters: namespace, variable, and value
if (namespace != nil)
eval <<-EOS
class #{namespace}
end
class << #{namespace}
attr_accessor :#{variable}
end
#{namespace}.#{variable} = value
EOS
end
end
# this is a proxy class for objects created with 'create' via the Zeitgeist
# framework. It allows arbitrary methods to be called on the object and allows
# for much nicer syntax, than the select-call paradigm
class ZeitgeistObject
# a pointer to the object represented by t
attr_reader :objPointer
def method_missing(methId, *args)
#print "Missing method", @objPointer, "->", methId.id2name, "\n"
str = methId.id2name
thisCall @objPointer, str, args
end
def initialize(objPointer)
#print "Creating new ZeitgeistObject ", objPointer, "\n"
@objPointer = objPointer
end
end
# set up some useful aliases
alias cd selectObject
|