aboutsummaryrefslogtreecommitdiff
path: root/vendor/voclient/voapps/task
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2015-07-08 20:46:52 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2015-07-08 20:46:52 -0400
commitfa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 (patch)
treebdda434976bc09c864f2e4fa6f16ba1952b1e555 /vendor/voclient/voapps/task
downloadiraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz
Initial commit
Diffstat (limited to 'vendor/voclient/voapps/task')
-rw-r--r--vendor/voclient/voapps/task/Makefile169
-rw-r--r--vendor/voclient/voapps/task/Notes.fitz99
-rw-r--r--vendor/voclient/voapps/task/Notes.tody164
-rw-r--r--vendor/voclient/voapps/task/_pkgbin31
-rwxr-xr-xvendor/voclient/voapps/task/mkpy5
-rw-r--r--vendor/voclient/voapps/task/pkgMain.c117
-rw-r--r--vendor/voclient/voapps/task/test.py4
-rw-r--r--vendor/voclient/voapps/task/vaopackage.py453
-rw-r--r--vendor/voclient/voapps/task/voPackage.c78
-rw-r--r--vendor/voclient/voapps/task/voParam.c418
-rw-r--r--vendor/voclient/voapps/task/voPkg.c333
-rw-r--r--vendor/voclient/voapps/task/voTask.c258
-rw-r--r--vendor/voclient/voapps/task/voTask.h133
-rw-r--r--vendor/voclient/voapps/task/voTaskMethod.c49
-rw-r--r--vendor/voclient/voapps/task/voTaskUtil.c133
-rw-r--r--vendor/voclient/voapps/task/votools.h79
-rw-r--r--vendor/voclient/voapps/task/zz.c0
-rw-r--r--vendor/voclient/voapps/task/zz.py60
-rw-r--r--vendor/voclient/voapps/task/zztest.c0
19 files changed, 2583 insertions, 0 deletions
diff --git a/vendor/voclient/voapps/task/Makefile b/vendor/voclient/voapps/task/Makefile
new file mode 100644
index 00000000..afd04b38
--- /dev/null
+++ b/vendor/voclient/voapps/task/Makefile
@@ -0,0 +1,169 @@
+#///////////////////////////////////////////////////////////////////////////////
+#//
+#// Makefile for the VOClient Tasking Interface
+#//
+#///////////////////////////////////////////////////////////////////////////////
+
+# primary dependencies
+
+NAME = voTask
+VERSION = 1.0
+PLATFORM := $(shell uname -s)
+PLMACH := $(shell uname -m)
+HERE := $(shell /bin/pwd)
+BINDIR := ../bin/
+LIBDIR := ../lib/
+INCDIR := ../include/
+PYVER := $(shell csh -c "python --version |& cut -c8-10")
+
+# secondary dependencies
+LIBBASE = lib$(NAME)
+STATICLIB = $(HERE)/$(LIBBASE).a
+SHAREDLIB = $(HERE)/$(LIBBASE).so.$(VERSION)
+
+
+# stuff that's precious to keep
+.PRECIOUS: $(STATICLIB) $(SHAREDLIB)
+.KEEP_STATE:
+
+
+# includes, flags and libraries
+CC = gcc
+CINCS = -I$(INCDIR) -I.
+
+ifeq ($(PLATFORM),Darwin)
+ ifeq ($(PLMACH),x86_64)
+ CARCH = -m64 -mmacosx-version-min=10.5
+ else
+ #CARCH = -arch i386 -arch ppc -m32 -mmacosx-version-min=10.4
+ CARCH = -mmacosx-version-min=10.4
+ endif
+ PYFLAGS = -dynamiclib -I/usr/include/python$(PYVER)/ -lpython$(PYVER)
+else
+ CARCH =
+ PYFLAGS = -DLINUX
+endif
+
+CLIBS = -lm -lc -lcurl -lpthread -lm
+CFLAGS = -g -Wall $(CARCH) -D$(PLATFORM) $(CINCS) -L./
+
+
+
+# includes, flags and libraries
+CC = gcc
+CINCS = -I$(HERE) -I../ -I../include -L../ -L../lib/ -L../
+
+#F77 = g77
+F77 = gfortran
+FFLAGS = -g -Wall
+
+# list of source and include files
+C_SRCS = voParam.c voPkg.c voTask.c voTaskMethod.c voTaskUtil.c
+C_OBJS = voParam.o voPkg.o voTask.o voTaskMethod.o voTaskUtil.o
+C_INCS = voTask.h voTaskP.h
+
+C_TASKS =
+TARGETS = $(C_TASKS)
+
+SRCS = $(C_SRCS)
+OBJS = $(C_OBJS)
+HOST_LIBS = -lcurl -lcfitsio -lpthread -lm
+LIBS = -L../../lib $(HOST_LIBS) -lvotable -lsamp -lVOClient -lcfitsio
+
+
+all:
+ make lib
+
+World: lib
+
+install: all
+ cp lib$(NAME).a $(LIBDIR)
+ mv $(TARGETS) $(BINDIR)
+
+objs: $(OBJS)
+
+
+# Targets
+
+#all: $(TARGETS)
+
+progs: $(C_TASKS)
+
+votools: pkgMain.o
+ $(CC) $(CFLAGS) -o votools.vop pkgMain.c ../libVOApps.a $(LIBS)
+ /bin/rm -rf *.dSYM
+
+pylib:
+ $(CC) $(PYFLAGS) -o voPackage.so voPackage.c
+
+clean:
+ /bin/rm -rf .make.state .nse_depinfo *.[aeo] *.dSYM
+ /bin/rm -rf $(TARGETS)
+
+everything:
+ make clean
+ make all
+ make install
+
+help: HELP
+
+install: all
+
+
+
+####################################
+# LIBVOTASK dependency libraries.
+####################################
+
+lib: objs
+ ar rv lib$(NAME).a $(OBJS)
+ $(RM) $(OBJS)
+
+
+
+###############################################################################
+# Unit test programs to be built.
+###############################################################################
+
+zztest: zztest.c
+ $(CC) $(CFLAGS) -o zztest zztest.c $(LIBS)
+
+
+###########################
+# C Test programs
+###########################
+
+
+###########################
+# SPP Test programs
+###########################
+
+
+###########################
+# Fortran Test programs.
+###########################
+
+
+
+
+
+
+###############################################################################
+# Leave this stuff alone.
+###############################################################################
+
+$(STATICLIB): $(C_SRCS:%.c=Static/%.o)
+ /usr/bin/ar rv $@ $?
+Static/%.o: %.c $(C_INCS)
+ /usr/bin/gcc $(CINCS) $(CFLAGS) -g -c $< -o $@
+Static:
+ /bin/mkdir $@
+ chmod 777 $@
+
+$(SHAREDLIB): $(C_SRCS:%.c=Shared/%.o)
+ /usr/bin/ld -shared -o $@ $? -lc -ldl
+Shared/%.o: %.c $(C_INCS)
+ /usr/bin/gcc $(CINCS) $(CFLAGS) -fpic -shared -c $< -o $@
+Shared:
+ /bin/mkdir $@
+ chmod 777 $@
diff --git a/vendor/voclient/voapps/task/Notes.fitz b/vendor/voclient/voapps/task/Notes.fitz
new file mode 100644
index 00000000..fe36e903
--- /dev/null
+++ b/vendor/voclient/voapps/task/Notes.fitz
@@ -0,0 +1,99 @@
+ Client Interface:
+ =================
+
+ Package/Task Management:
+ ------------------------
+
+ vo_setPkgDir (path) # set package dir
+ path = vo_getPkgDir () # get package dir
+
+ pkg = vo_pkgList (pattern) # Get available packages
+ len = vo_pkgLen (pkg)
+ pkg = vo_pkgNext (pkg)
+ str = vo_pkgAttr (pkg, attr)
+
+ task = vo_taskList (taskName) # Get tasks in package
+ len = vo_taskLen (task)
+ str = vo_taskNext (task)
+ task = vo_taskAttr (task, attr)
+
+ pp = vo_taskParams (pkgName, taskName) # Input param defs
+ ( see parameter handling below )
+
+ xml = vo_pkgXML (pattern) # XML serializations (opt)
+ xml = vo_taskXML (pkgName)
+ xml = vo_paramXML (pkgName, taskName)
+
+
+ Task Execution:
+ ---------------
+
+ tp = vo_taskInit (pkgName, taskName) # Initialize a task
+
+ vo_taskSetStringParam (tp, pname, sval) # Set input params
+ vo_taskSetBoolParam (tp, pname, bval)
+ vo_taskSetIntParam (tp, pname, ival)
+ vo_taskSetRealParam (tp, pname, dval)
+ vo_taskSetDictParam (tp, pname, dict)
+ vo_taskSetListParam (tp, pname, list)
+ vo_taskSetPtrParam (tp, pname, ptr, size)
+
+ vo_taskSetCallback (tp, type, &func) # Set param callback
+ rp = vo_taskExecuteSync (tp, status, msg) # Execute sync
+ vo_taskExecuteAsync (tp) # Execute async
+ rp = vo_taskWait (tp) # Wait for task, get RP
+ status = vo_taskCheckError (tp, msg) # Check for any error
+
+ vo_taskClose (tp) # Free task resources
+
+ Parameter Handling:
+ -------------------
+
+ Directed parameter access:
+
+ int = vo_taskParamCount (rp)
+ vo_taskGetParamInfo (rp, pnum, *name, *type, *encoding,
+ *description)
+ str = vo_taskGetStringParam (rp, pname, pnum) # pnum used if pname=null
+ ival = vo_taskGetBoolParam (rp, pname, pnum)
+ ival = vo_taskGetIntParam (rp, pname, pnum)
+ dval = vo_taskGetRealParam (rp, pname, pnum)
+ dict = vo_taskGetDictParam (rp, pname, pnum)
+ dict = vo_taskGetListParam (rp, pname, pnum)
+ void = vo_taskGetParamValue (rp, pname, pnum, size)
+
+ Iterated parameter access:
+
+ pp = vo_taskGetParam (rp, pname, pnum)
+ len = vo_paramLen (pp, [typ|enc])
+ pp = vo_paramNext (pp, [typ|enc])
+ str = vo_paramAttr (pp, attr)
+
+
+Notes:
+======
+
+ - Added set/get methods for the package directory to be searched for
+ packages. This allows a client to point to different dirs depending
+ on which package is being 'loaded'.
+ - The pkgList() takes a 'pattern' param to select only files matching a
+ specific pattern (e.g. "*.e" or "*.pkg") from the working directory.
+ Only files matching the pattern (or all files if NULL) will be queried
+ for metadata. This also allows for a directory to contain single-task
+ binaries and not require a single binary for all tasks in a package.
+ - Made pkg/task/param listings optionally XML, these are manageable by
+ many languages but not always 'natural'. The use of iterators allows
+ a client to traverse the metadata and request attributes w/out depending
+ on an XML parser.
+ - Added 'pname' to the setParam() methods to set specific params.
+ - Added status/msg returns from sync execution
+ - Input and output parameters share the same data structure and interface
+ methods work on either. This means a 'blob' can now be an input param,
+ e.g. an in-memory object (e.g. a target list or TAP ADQL string) from a
+ client can be posted over IPC to the task. Note however this may not be
+ implemented for current tasks.
+ - Parameter callbacks can be set for specific parameter types
+ - Parameter iterators allow a 'type' or 'encoding' option to find the
+ next param of the same typ/enc. This allows a client to skip through
+ output params to find e.g. only FITS objects or only the stdout text
+ strings and means the callback can be tied to a parameter type easily.
diff --git a/vendor/voclient/voapps/task/Notes.tody b/vendor/voclient/voapps/task/Notes.tody
new file mode 100644
index 00000000..52b0d514
--- /dev/null
+++ b/vendor/voclient/voapps/task/Notes.tody
@@ -0,0 +1,164 @@
+VoClient Expanded Tasking Interface
+------------------------------------
+
+
+Current Interface
+--------------------------
+
+There is a single VOClient "VO" package consisting of a set of tasks
+implemented as library functions indexed as an "apps" array of function
+pointers. vo_runTask forks a subprocess to execute each task.
+Parameters are passed Unix-style as strings (argc,argv[]). A single
+result object is returned as a binary byte-counted blob.
+
+Client:
+ status = vo_runTask (method, apps[], argc, argv[], *len,
+**result)
+
+Task:
+ status = vo_setResultFromInt (value, *len, **data)
+ status = vo_setResultFromReal (value, *len, **data)
+ status = vo_setResultFromString (value, *len, **data)
+
+This is ok, a straightforward mapping of the original host CLI task
+interface into a programmatic API. However with a little more work we
+can generalize this to make the interface self-describing, allowing
+generic tasking code to be implemented (all the way up the client
+language layer eg Python) and allow new packages/tasks to be addded.
+
+
+Expanded Interface
+--------------------------
+
+This is an attempt to define the simplest possible interface which is still
+general enough to support the package/task paradigm, providing a self
+describing capability to allow generic/reusable software to be written to
+manipulate and run tasks. The main simplification is that a "package" is
+implemented as an executable (a single self contained file) which may
+contain multiple tasks and which can be queried to determine its
+capabilities. This limits "packages" to implementations which can be self
+contained enough to be runnable from a single runtime file, which is
+adequate for now to support the VOClient CLI tasks and which can be
+generalized later if necessary.
+
+A "package" is a precompiled executable with a defined API which can be
+queried with standard CLI arguments to get package metadata as well as to
+run the individual tasks. Metadata queries include user help as in
+"-help", plus programatic information such as the package name and
+description, list of tasks, task interfaces, builtin help, etc. "Package"
+executables are installed in a standard directory which can be examined by
+the tasking layer to determine what packages are available. The file names
+of package executables follow a simple naming convention so that they can
+be easily referenced at runtime.
+
+Client Interface:
+
+ xml = vo_pkgList () # Available packages
+ xml = vo_taskList (pkgName) # Tasks in package
+ xml = vo_taskParams (pkgName, taskName) # Input param set defs
+
+ tp = vo_taskInit (pkgName, taskName) # Prepare to run a task
+
+ vo_taskSetStringParam (tp, sval) # Set input parameters
+ vo_taskSetBoolParam (tp, sval)
+ vo_taskSetIntParam (tp, ival)
+ vo_taskSetRealParam (tp, dval)
+
+ vo_taskSetCallback (tp, &func) # Set callback for output param
+ rp = vo_taskExecuteSync (tp) # Execute synchronous; returns
+ # output pset pointer
+ vo_taskExecuteAsync (tp) # Execute async
+ rp = vo_taskWait (tp) # Wait for task, get RP
+ status = vo_taskCheckError (tp, *msg) # Check for any error posted
+ # to TP or RP
+
+ int = vo_taskOutputParamsCount (rp) # Access output params
+ vo_taskGetOutputParamInfo (rp, pnum, *name, *type, *encoding,
+ *description)
+
+ # pnum used if paramName=null
+ *void = vo_taskGetOutputParamValue (rp, paramName, pnum)
+*char = vo_taskGetStringOutputParam (rp, paramName, pnum)
+ ival = vo_taskGetBoolOutputParam (rp, paramName, pnum)
+ ival = vo_taskGetIntOutputParam (rp, paramName, pnum)
+ dval = vo_taskGetRealOutputParam (rp, paramName, pnum)
+
+ vo_taskClose (tp) # Free task resources
+
+Notes:
+ 1. vo_pkglist essentially just lists the valid package files in the
+ package directory. Simple since each package is a single file in
+ this scheme.
+ 2. vo_taskInit sets a task context and creates a default/empty param
+ list. The client sets the params it cares about. When the task
+ is executed the params are serialized in whatever way the tasking
+ layer wants to do it internally, e.g. argc/argv.
+ 3. Tasks can execute either sync or async. In async mode the client
+ may post a callback handler for output parameters. This is called
+ during task execution whenever any output parameter (of any name
+ or type) is set. We can have standard system params stdout (dump
+ text to stdout), status (running, done), warning (like stderr),
+ error (task aborted), etc. It is up to the task what parameters
+ to output. Custom parameters, normally of a standard type/encoding,
+ are used to return data.
+ 4. In sync task mode the client waits for completion and gets a
+ pointer to an output param set which it can walk to process the
+ output params. Output params can also be retrieved by name if the
+ client knows what params it expects back.
+ 5. The client should call vo_taskClose when done to free up task
+ resources such as output parameters. Otherwise they are retained
+ indefinitely.
+ 6. We should define standard values for the param TYPE and ENCODING
+ e.g., "bool", "int", "image", "fits", "votable", etc.), however
+ he task may return custom object types or encodings as well which
+ he client may or may not recognize.
+
+
+Task Interface: # Called by the task itself at runtime
+
+ tp = vo_taskStart ()
+ char *vo_taskGetPackageName (tp)
+ char *vo_taskGetTaskName (tp)
+ *char = vo_taskGetStringParam (tp, paramName)
+ ival = vo_taskGetBoolParam (tp, paramName)
+ ival = vo_taskGetIntParam (tp, paramName)
+ dval = vo_taskGetBoolParam (tp, paramName)
+
+ status = vo_setIntOutputParam (tp, paramName, ival)
+ status = vo_setRealOutputParam (tp, paramName, dval)
+ status = vo_setStringOutputParam (tp, paramName, sval)
+ status = vo_setOutputParam (tp, paramName, paramType, paramEncoding,
+ *len, **void)
+ tp = vo_taskEnd (tp)
+
+
+Notes:
+ 1. Task should call vo_taskStart initially to get a runtime context,
+ and vo_taskEnd when done to free resources, flush any output, and
+ so forth.
+ 2. When a task is run in a "connected" (remote) fashion it is passed
+ a keyword table of parameter values, via argc/argv or whatever.
+ True host level, CLI (argc/argv) mode can be provided as
+ well in which case all the -help etc. generics can be provided by
+ the task main (container).
+ Defaulting can be performed task-side if provided.
+ 3. Input parameters can be retrieved by name (do we need to walk a
+ list as well? probably not in this case).
+ 4. Output parameters are flushed through to the client in each
+ setOutputParam call, allowing interactive output at runtime. A
+ single output parameter may be set multiple times, e.g.,
+ for stdout, warning, status, etc. this could be normal. The
+ client tasking code accumulates output parameters in an output
+ param set during execution. Whether or not parameters are passed
+ on to a client callback is up to the client.
+
+Whether or not a task executes directly in the client process or in a
+separate process is transparent to the client; normally tasks will execute
+in a subprocess.
+
+The main limitation here is the assumption that a "package" is input to the
+system as a file. This is simple enough for C code where tasks are just
+functions linked into a single executable with a common main. In the
+simplest case there is no support for things like task dependencies.
+However the single file paradigm can be extended in the future should we
+need to do so.
diff --git a/vendor/voclient/voapps/task/_pkgbin b/vendor/voclient/voapps/task/_pkgbin
new file mode 100644
index 00000000..920b9086
--- /dev/null
+++ b/vendor/voclient/voapps/task/_pkgbin
@@ -0,0 +1,31 @@
+/**
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+
+int main (int argc, char *argv[])
+{
+
+ /* Process arguments.
+ */
+ for (i=1; i < argc; i++) {
+ switch (argv[i]) {
+ case 'h': // help
+ case 'd': // debug
+ case 'v': // verbose
+
+ case 'a': // package attributes
+ case 't': // package task list
+ case 'p': // task parameters ("-p <task>")
+
+ case 'S': // task parameters ("-p <task>")
+ default:
+ taskName = argv[i] // execute task ....
+ }
+ }
+
+
+}
diff --git a/vendor/voclient/voapps/task/mkpy b/vendor/voclient/voapps/task/mkpy
new file mode 100755
index 00000000..c8fd62c0
--- /dev/null
+++ b/vendor/voclient/voapps/task/mkpy
@@ -0,0 +1,5 @@
+#!/bin/csh -f
+
+set PKG = voPackage
+
+gcc -dynamiclib -I/usr/include/python2.6/ -lpython2.6 -o $PKG.so $PKG.c
diff --git a/vendor/voclient/voapps/task/pkgMain.c b/vendor/voclient/voapps/task/pkgMain.c
new file mode 100644
index 00000000..6b616f63
--- /dev/null
+++ b/vendor/voclient/voapps/task/pkgMain.c
@@ -0,0 +1,117 @@
+/**
+ * PKG_MAIN -- VOPackage task main().
+ *
+ * @file pkgMain.c
+ * @author Mike Fitzpatrick
+ * @date 12/13/12
+ *
+ * @brief VOPackage task main().
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "votools.h" /* package task declarations */
+
+
+static int help = 0; /* help flag */
+static int debug = 0; /* debug flag */
+static int verbose = 0; /* verbose flag */
+static int interactive = 0; /* interactive */
+static int connected = 0; /* connected subprocess */
+static int detached = 0; /* detached subprocess */
+
+static int do_attrs = 0; /* print package attrs */
+static int do_taskList = 0; /* print task list */
+static int do_taskParams = 0; /* print package attrs */
+
+static char *taskName = NULL; /* name of task to execute */
+static char *cbsocket = NULL; /* callback socket */
+
+
+static void vopHelp(void);
+
+
+static char *opts = "hNno:r%:";
+static struct option long_opts[] = {
+ { "Number", 2, 0, 'N'}, /* task option */
+ { "number", 2, 0, 'n'}, /* task option */
+ { "output", 1, 0, 'o'}, /* task option */
+ { "return", 2, 0, 'r'}, /* task option */
+ { "help", 2, 0, 'h'}, /* required */
+ { "test", 1, 0, '%'}, /* required */
+ { NULL, 0, 0, 0 }
+};
+
+
+
+/**
+ * Application entry point.
+ */
+int main (int argc, char *argv[])
+{
+ char **pargv, optval[SZ_FNAME], ch;
+ int pos = 0;
+
+
+ /* Process arguments.
+ */
+ pargv = vo_paramInit (argc, argv);
+ while ((ch = vo_paramNext (opts,long_opts,argc,pargv,optval,&pos)) != 0) {
+ if (ch > 0) {
+ switch (ch) {
+ case 'h': vopHelp (); break;
+ case 'd': debug++; break;
+ case 'v': verbose++; break;
+
+ case 'a': /* package attributes */
+ do_attrs++;
+ break;
+ case 't': /* package task list */
+ do_taskList++;
+ break;
+ case 'p': /* task parameters ("-p <task>") */
+ do_taskParams++;
+ break;
+ case 'S': /* callback socket ("-S <sock>") */
+ cbsocket = strdup (optval);
+ break;
+ }
+ } else {
+ taskName = strdup (optval);/* execute task .... */
+ }
+ }
+
+ if (!cbsocket) {
+ cbsocket = (char *) calloc (1, SZ_FNAME);
+ sprintf (cbsocket, "/tmp/voPkg_%d", (int) getuid());
+ }
+
+ if (!connected && !detached) { /* run interactively */
+ interactive++;
+ } else if (connected) { /* run as a connected process */
+
+ } else if (detached) { /* run as a detached (bkg) process */
+ }
+
+
+ if (cbsocket)
+ free ((void *) cbsocket);
+ return (0);
+}
+
+
+/**
+ * VOPHELP -- Task help summary.
+ */
+static void
+vopHelp ()
+{
+ printf ("\n\
+ Usage: %s [-dhiv] [-a] | [-t] | [-p <task>] -S <cbsock> [<task>]]\n\
+ \n\
+ ", PKG_NAME);
+}
+
+
diff --git a/vendor/voclient/voapps/task/test.py b/vendor/voclient/voapps/task/test.py
new file mode 100644
index 00000000..0007da70
--- /dev/null
+++ b/vendor/voclient/voapps/task/test.py
@@ -0,0 +1,4 @@
+
+from voPackage import *
+
+print vop_taskList ("/tmp/test.vop")
diff --git a/vendor/voclient/voapps/task/vaopackage.py b/vendor/voclient/voapps/task/vaopackage.py
new file mode 100644
index 00000000..a894e612
--- /dev/null
+++ b/vendor/voclient/voapps/task/vaopackage.py
@@ -0,0 +1,453 @@
+"""
+The VAO Package and Tasking Interfaces.
+
+The tasking interface defines the python-side classes needed to manage and
+execute host processes that implement the "VAO Package" binary interface.
+These classes load the package (i.e. execute the binary as a connected
+processes and interogate it for a list of available tasks). The VOTask
+interface is used to set the input parameters, execute the task and process
+the result parameter set (PSet).
+
+The VOPSet interface manages a collection of VOParam parameter objects:
+input parameters will typically define options for the host task (e.g.
+input file, processing options, etc), while output parameters may contain
+arbitrary objects returned by the task (e.g. a FITS file or VOTable) or
+strings which make up the stdout/stderr streams of the task. A VOParam has
+attributes needed to describe the type of parameter, by selecting
+parameters of the same name from a PSet (e.g. 'msgs') an application can
+process multiple output objects as needed.
+
+A 'task' is a computational component which can be executed as a process by
+the host operating system (or a related environment such as a cluster).
+Tasks may be written in any language so long as the defined tasking
+interface is observed. The 'package' refered to here should not be
+confused with a Python package. A Python package is an element of Python,
+a 'package' as referred to here is a collection of tasks and their
+associated metadata.
+
+"""
+
+import sys
+import os
+import re
+import glob
+
+
+
+# Module Globals and Functions
+
+""" The Package search path.
+"""
+vopkg_path = ['.'] # always include the cwd
+vopkg_extn = ".vop"
+
+pkg_list = [] # scan package dirs to get list of packages
+pkg_struct = None # dictionary of package data in the form
+ # key = pkgname
+ # value = tuple(<path>, [<tasklist>])
+
+
+def setPkgDirs (dirs):
+ ''' Set the VO package search path as an absolute list of directories.
+ @param dirs list of directory to use as search path
+
+ Returns: Nothing
+ '''
+ vopkg_path = [.] + dirs
+
+
+def addPkgDir (dir):
+ ''' Append the given directory to the package search path.
+ @param dir the directory to add to the search path
+
+ Returns: Nothing
+ '''
+ vopkg_path.append(dir)
+
+
+def getPkgDirs ():
+ ''' Get the VO package search path as a list of directories.
+
+ Returns: Nothing
+ '''
+ return (vopkg_path)
+
+
+def pkgList (pattern=None):
+ ''' Get the list of available packages.
+ @param pattern the package name pattern to match
+
+ Returns: A list available package names.
+ '''
+
+ pat = pattern # construct the pattern string
+ if (pattern == None):
+ pat = "*"
+
+ pkg_list = [] # scan package dirs to get list of packages
+ for dir in vopkg_path:
+ if os.path.isdir(dir):
+ pfiles = glob.glob(dir + "/" + pat + vopkg_extn)
+ for f in pfiles:
+ root,ext = os.path.splitext(os.path.basename(f))
+ pkg_list.append(root)
+ pkg_struct[root] = [ f ]
+ else:
+ root,ext = os.path.splitext(os.path.basename(dir))
+ if (re.search(pattern,root)):
+ pkg_list.append(root)
+ pkg_struct[root] = [ dir ]
+
+ # Save just the package names as a valid list.
+ pkg_list = pkg_struct.keys()
+
+ # Scan the package list, to get a list of tasks in each package.
+ for pkg in pkg_list:
+ tlist = vop_taskList (pkg_struct[pkg][0]) # get task list
+ pkg_struct[pkg].append(tlist) # save in struct
+
+
+
+def scan ():
+ ''' Force a re-scan of the package search path for available package
+ files. Each directory in the path is searched for a ".vop" file
+ indicating a VO package executable, this file is then interrogated
+ for a list of tasks. This allows new package files to be installed
+ (or removed) as the module is running.
+
+ Returns: Nothing
+ '''
+ lst = pkgList ("*") # scan all packages
+
+
+def loadPackage (name, file=None):
+ ''' Load the package. Effectively all this does is create a VOPackage
+ object from the metadata for the named package, this requires
+ that we start the package binary to get the metadata information.
+ If a 'file' parameter is specified we open that file regardless of
+ the name, allowing any VOPackage file to be used dynamically.
+
+ When a package is loaded, bindings for each of the tasks are generated
+ automatically in order to allow direct access to the task. As an
+ example:
+
+ >>> vop = loadPackage ("vo-cli") # from search path
+ >>> results = vop.voregistry (searchTerm="quasar")
+ >>> printResultPset (results) # user-defined function
+
+ When developing a package or when an app needs to explicitly include
+ a new package, it may be accessed directly as:
+
+ >>> vop = loadPackage ("vo-cli",file="/path/devpkg.e")
+
+ @param name the package name
+ @param file the package binary file to execute
+
+ Returns: The loaded VOPackage object
+ '''
+ pass
+
+def taskList (pkg, pattern=None):
+ ''' List the tasks available in a package.
+ @param pkg the package name
+ @param pattern the task pattern name to match
+
+ Returns: A list of tasks available in the package who's name
+ matches the 'pattern' string.
+ '''
+ pass
+
+def pkgAttrs (pkg):
+ ''' Get the attributes for the named package, i.e. create a dictionary
+ of package metadata.
+ @param pkg the package name
+
+ Returns: A dictionary of the package attributes.
+ '''
+ pass
+
+def taskAttrs (pkg, task):
+ ''' Get the attributes for the named task in the package, i.e. create
+ a dictionary of task metadata.
+ @param pkg the package name
+ @param task the task name
+
+ Returns: A dictionary of the task attributes.
+ '''
+ pass
+
+
+class VOPackageError (Exception):
+ ''' A base class for VO Package errors. Use of this exception is TBD.
+ '''
+ pass
+
+
+class VOPackage:
+ ''' A class defining a VOPackage object. A VOPackage is a collection
+ of tasks as well as metadata about the package itself. The
+ functional part of the package is implemented in a binary file
+ executing as a connected process, task discovery and execution are
+ implemented as commands sent to the package binary, results are
+ returned over the IPC channel as a stream of parameter objects.
+ '''
+
+ # Class attributes
+ name = None # package name
+ descr = None # description string
+ author = None # package author
+ contact = None # contact email address
+ iconUrl = None # URL to package icon
+ version = None # package version string
+ dir = None # the directory containing the package
+ binfile = None # the name of the package binary
+
+ def __init__ (self, dirs):
+ pass
+
+ def __iter__ (self, dirs): # get next task in the package
+ pass
+
+ def taskList (self, pattern=None):
+ ''' Get the list of tasks in the package which match a pattern string.
+ If no pattern is specified, all tasks are returned.
+ @param pattern the parameter name to match
+
+ Returns: A list of available tasks who's name matches
+ the pattern string.
+ '''
+ pass
+
+ def pkgAttrs (self):
+ ''' Get the attributes for the VO Package as a dictionary string.
+
+ Returns: A dictionary of the package attributes
+ '''
+ pass
+
+
+class VOTaskError (Exception):
+ ''' A base class for Task execution errors.
+ '''
+ pass
+
+class VOTaskParameterError (VOTaskError):
+ ''' an exception indicating an error in the task calling parameters
+ '''
+ pass
+
+class VOTaskExecutionError (VOTaskError):
+ ''' an exception indicating an error when executing the task
+ '''
+ pass
+
+
+class VOTask:
+ ''' A class defining a VO Task object.
+ '''
+
+ name = None # task name
+ pkg = None # parent package name
+ descr = None # task description string
+ params = None # task input parameter set
+
+ status = None # task execution return status (OK or ERROR)
+ msg = None # task execution return error message
+
+
+ def __init__ (self, name, pkg, descr, params):
+ ''' create the VOTask instance
+ '''
+ pass
+
+ def taskAttrs (self):
+ ''' Get the attributes of the task as a dictionary.
+
+ Returns: A dictionary of the task attributes
+ '''
+ pass
+
+ def setParams (pset):
+ ''' Set the task parameter pset. Parameters in the pset argument
+ will be used set the values for the task parameter pset, i.e.
+ the argument pset can be just a subset of the task parameters,
+ we'll match the names and set the values for only those params.
+ If the argument pset contains a parameter not already in the
+ task input pset, it will be added as a new parameter.
+ @param pset parameter set to load
+
+ Returns: A dictionary of the task attributes
+ '''
+ pass
+
+ def getParams ():
+ ''' Set the task parameter pset.
+
+ Returns: The task parameter pset.
+ '''
+ pass
+
+ def setCallback (pattern, func):
+ ''' Set a callback function to be run whenever a parameter name
+ that matches the pattern is encountered. Pattern applies only
+ to the output parameter set.
+ @param pattern the parameter name to match
+ @param func the function to be called when parameter encountered
+
+ Returns: nothing
+ '''
+ pass
+
+ def executeSync (self):
+ ''' Execute the task as a synchronous process.
+ @throws VOTaskParameterError thrown when parameters are invalid
+ @throws VOTaskExecutionError thrown when there is an error is
+ executing a task, e.g. a segfault.
+
+ Returns: The result pset.
+ '''
+ pass
+
+ def executeASync (self):
+ ''' Execute the task as a asynchronous process.
+
+ Returns: Nothing
+ '''
+ pass
+
+ def wait (self):
+ ''' Wait for the exit of an asynchronous execution
+ @throws VOTaskParameterError thrown when parameters are invalid
+ @throws VOTaskExecutionError thrown when there is an error is
+ executing a task, e.g. a segfault.
+
+ Returns: The result pset.
+ '''
+ pass
+
+ def status (self):
+ ''' Get the status of an executing asynchronous task.
+
+ Returns: Task exec status ('Pending','Running','Done','Error')
+ '''
+ pass
+
+
+class VOPset:
+ ''' A class defining a PSet object.
+ '''
+
+ name = None # pset name
+ pkg = None # package name
+ task = None # task name associated with pset
+ description = None # pset description name
+
+ def __init__ (self, name, type, descr, encoding):
+ ''' create the VOPset instance
+ '''
+ pass
+
+ def loadPset (pkg=None, task=None, saveFile=None):
+ ''' Load the pset from the named task in the package. If 'saveFile'
+ is specified the pset is restored from that file.
+ @param pkg package name
+ @param task task name
+ @param saveFile name of the saved parameter file to load
+
+ Returns: The loaded PSet
+ '''
+ pass
+
+ def savePset (saveFile):
+ ''' Save the PSet to the named file. Serialization of the PSet is
+ TBD, probably some sort of simple XML schema.
+ @param saveFile name of the saved parameter file
+
+ Returns: Nothing
+ '''
+ pass
+
+ def paramSet (pattern=None):
+ ''' Create pset from params who's name matches the 'pattern' string.
+ If no pattern is specified, all parameters are returned.
+ @param pattern parameter pattern name to match
+
+ Returns: The constructed PSet
+ '''
+ pass
+
+ def paramList (pattern=None):
+ ''' Get list of params who's name matches the 'pattern' string. If
+ no pattern is specified, all parameters are returned.
+ @param pattern parameter pattern name to match
+
+ Returns: Nothing
+ '''
+ pass
+
+ def addParam (name, type, description, encoding=None):
+ ''' Add a new parameter with the specified attributes to the pset.
+ @param name name of the parameter to add
+ @param type parameter type value
+ @param descr parameter description string
+ @param encoding parameter encoding
+
+ Returns: The created parameter
+ '''
+ pass
+
+ def delParam (name):
+ ''' Delete the named parameter from the pset.
+ @param name name of the parameter to delete
+
+ Returns: Nothing
+ '''
+ pass
+
+ def getParam (name):
+ ''' Get the parameter with the given name.
+ @param name name of the parameter to retrieve
+
+ Returns: Requested parameter
+ '''
+ pass
+
+
+class VOParam:
+ ''' A class defining a Parameter object.
+ '''
+
+ name = None # parameter name
+ type = None # parameter type (string/int/real/bool/blob)
+ desc = None # parameter description string
+ encoding = None # encoding of param (i.e. mime type)
+
+
+ def __init__ (self, name, type, descr, encoding):
+ ''' create the VOParam instance
+ '''
+ pass
+
+ def paramAttrs ():
+ ''' Get the parameter attributes.
+
+ Returns: A dictionary of parameter attrbutes
+ '''
+ pass
+
+ def getValue ():
+ ''' Get the value of the parameter (may be a list)
+
+ Returns: The parameter's value
+ '''
+ pass
+
+ def setValue (val):
+ ''' Set the value of a parameter.
+ @param val the value of the paramter (arbitrary type)
+
+ Returns: Nothing
+ '''
+ pass
+
+
diff --git a/vendor/voclient/voapps/task/voPackage.c b/vendor/voclient/voapps/task/voPackage.c
new file mode 100644
index 00000000..2b53c575
--- /dev/null
+++ b/vendor/voclient/voapps/task/voPackage.c
@@ -0,0 +1,78 @@
+/**
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <Python.h>
+
+
+typedef struct {
+} voPackage;
+
+
+
+/**
+ * VOP_TASKLIST -- List the tasks in the named package.
+ */
+static PyObject*
+vop_taskList (PyObject* self, PyObject* args) /* pkg,pattern=None */
+{
+ const char *binpath;
+ int status;
+
+ if (!PyArg_ParseTuple (args, "s", &binpath))
+ return NULL;
+
+
+ sts = system(command);
+
+ return Py_BuildValue("s", args);
+}
+
+
+/**
+ * VOP_PKGLIST -- List the packages in the search directory.
+ */
+static PyObject*
+vop_pkgList (PyObject* self, PyObject* args) /* pattern=None */
+{
+ char *s = "Hello from vop_pkgList";
+ return Py_BuildValue("s", s);
+}
+
+static PyObject*
+vop_scan (PyObject* self, PyObject* args)
+{
+ char *s = "Hello from vop_scan";
+ return Py_BuildValue("s", s);
+}
+
+static PyObject*
+vop_loadPackage (PyObject* self, PyObject* args) /* name, file=None */
+{
+ char *s = "Hello from vop_loadPackage";
+ return Py_BuildValue("s", s);
+}
+
+/** ************************************************************************ */
+
+/*
+ * Bind Python function names to our C functions
+ */
+static PyMethodDef voPackage_methods[] = {
+ { "vop_taskList", vop_taskList, METH_VARARGS },
+ { "vop_pkgList", vop_pkgList, METH_VARARGS },
+ { "vop_scan", vop_scan, METH_VARARGS },
+ { "vop_loadPackage", vop_loadPackage, METH_VARARGS },
+ { NULL, NULL, 0 }
+};
+
+
+/**
+ * INITVOPACKAGE -- Python calls this to let us initialize our module
+ */
+void initvoPackage()
+{
+ (void) Py_InitModule("voPackage", voPackage_methods);
+}
diff --git a/vendor/voclient/voapps/task/voParam.c b/vendor/voclient/voapps/task/voParam.c
new file mode 100644
index 00000000..e5d108ee
--- /dev/null
+++ b/vendor/voclient/voapps/task/voParam.c
@@ -0,0 +1,418 @@
+/**
+ *
+ * VOTASK.C -- Utilities to run a VOApps task as a connected subprocess.
+ *
+ *
+ * Expanded Interface
+ * --------------------------
+ *
+ * This is an attempt to define the simplest possible interface which is still
+ * general enough to support the package/task paradigm, providing a self
+ * describing capability to allow generic/reusable software to be written to
+ * manipulate and run tasks. The main simplification is that a "package" is
+ * implemented as an executable (a single self contained file) which may
+ * contain multiple tasks and which can be queried to determine its
+ * capabilities. This limits "packages" to implementations which can be self
+ * contained enough to be runnable from a single runtime file, which is
+ * adequate for now to support the VOClient CLI tasks and which can be
+ * generalized later if necessary.
+ *
+ * A "package" is a precompiled executable with a defined API which can be
+ * queried with standard CLI arguments to get package metadata as well as to
+ * run the individual tasks. Metadata queries include user help as in
+ * "-help", plus programatic information such as the package name and
+ * description, list of tasks, task interfaces, builtin help, etc. "Package"
+ * executables are installed in a standard directory which can be examined by
+ * the tasking layer to determine what packages are available. The file names
+ * of package executables follow a simple naming convention so that they can
+ * be easily referenced at runtime.
+ *
+ *
+ * Client Interface:
+ * =================
+ *
+ * Parameter Handling:
+ * -------------------
+ *
+ * Directed parameter access:
+ *
+ * int = vo_taskParamCount (rp)
+ * vo_taskGetParamInfo (rp, pnum, *name, *type, *encoding,
+ * *description)
+ * str = vo_taskGetStringParam (rp, pname, pnum) # pnum used if pname=null
+ * ival = vo_taskGetBoolParam (rp, pname, pnum)
+ * ival = vo_taskGetIntParam (rp, pname, pnum)
+ * dval = vo_taskGetRealParam (rp, pname, pnum)
+ * void = vo_taskGetParamValue (rp, pname, pnum, size)
+ *
+ * Iterated parameter access:
+ *
+ * pp = vo_taskGetParam (rp, pname, pnum)
+ * len = vo_paramLen (pp, [typ|enc])
+ * pp = vo_paramNext (pp, [typ|enc])
+ * str = vo_paramAttr (pp, attr)
+ *
+ *
+ *
+ * @file voParam.c
+ * @author Mike Fitzpatrick
+ * @date 9/24/12
+ *
+ * @brief VOClient Tasking Interface.
+ */
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <signal.h>
+#include <stdarg.h>
+#include <setjmp.h>
+#include <sys/wait.h>
+#include <sys/stat.h>
+#include <sys/select.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include "voTask.h"
+
+
+
+
+/**************************************************************************/
+/*** Package Introspection Methods ***/
+/**************************************************************************/
+
+/**
+ * VO_PKGLIST -- List packages available in the working directory..
+ *
+ * @brief List packages available in the working directory.
+ * @fn xml = vo_pkgList (char *pattern)
+ *
+ * @param pattern Package executable filename pattern (or NULL for all)
+ * @returns XML description of the package list.
+ */
+char *
+vo_pkgList (char *pattern)
+{
+ return (NULL);
+}
+
+
+/**
+ * VO_TASKLIST -- List tasks in package.
+ *
+ * @brief List tasks in package.
+ * @fn handle = vo_taskList (char *pkgName)
+ *
+ * @param pkgName Package name
+ * @returns XML description of the task list
+ */
+char *
+vo_taskList (char *pkgName)
+{
+ return (NULL);
+}
+
+
+/**
+ * VO_TASKPARAMS -- List parameters for a task.
+ *
+ * @brief List parameters for a task.
+ * @fn xml = vo_taskParams (char *pkgName, char *taskName)
+ *
+ * @param pkgName Package name
+ * @param taskName Task name
+ * @returns XML description of the parameter list
+ */
+char *
+vo_taskParams (char *pkgName, char *taskName)
+{
+ return (NULL);
+}
+
+
+/**
+ * VO_SETPKGDIR -- Set the working package directory.
+ *
+ * @brief Set the working package directory.
+ * @fn vo_setPkgDir (char *path)
+ *
+ * @param path Path to current working package directory
+ * @returns nothing
+ */
+void
+vo_setPkgDir (char *path)
+{
+}
+
+
+/**
+ * VO_GETPKGDIR -- Get the working package directory.
+ *
+ * @brief Get the working package directory.
+ * @fn path = vo_getPkgDir (void)
+ *
+ * @returns path to current working package directory
+ */
+char *
+vo_getPkgDir (void)
+{
+ return (NULL);
+}
+
+
+
+/**************************************************************************/
+/*** Task Execution Methods ***/
+/**************************************************************************/
+
+/**
+ * VO_TASKINIT -- Prepare to run a task.
+ *
+ * @brief Prepare to run a task.
+ * @fn handle = vo_taskInit (char *pkgName, char *taskName)
+ *
+ * @param pkgName Package name
+ * @param taskName Task name
+ * @returns handle to the task descriptor
+ */
+handle_t
+vo_taskInit (char *pkgName, char *taskName)
+{
+ return (0);
+}
+
+
+/**
+ * VO_TASKSETSTRINGPARAM -- Set a string-valued param.
+ *
+ * @brief Set a string-valued param.
+ * @fn str = vo_taskSetStringParam (handle_t tp, char *paramName,
+ * char *sval)
+ *
+ * @param tp Task handle
+ * @param paramName Parameter name
+ * @param sval Parameter value
+ * @returns nothing
+ */
+void
+vo_taskSetStringParam (handle_t tp, char *paramName, char *sval)
+{
+}
+
+
+/**
+ * VO_TASKSETBOOLPARAM -- Set a bool-valued param.
+ *
+ * @brief Set a bool-valued param.
+ * @fn str = vo_taskSetBoolParam (handle_t tp, char *paramName, int bval)
+ *
+ * @param tp Task handle
+ * @param paramName Parameter name
+ * @param bval Parameter value (0=false, 1=true)
+ * @returns nothing
+ */
+void
+vo_taskSetBoolParam (handle_t tp, char *paramName, int bval)
+{
+}
+
+
+/**
+ * VO_TASKSETINTPARAM -- Set a int-valued param.
+ *
+ * @brief Set a int-valued param.
+ * @fn str = vo_taskSetIntParam (handle_t tp, char *paramName, int ival)
+ *
+ * @param tp Task handle
+ * @param paramName Parameter name
+ * @param ival Parameter value
+ * @returns nothing
+ */
+void
+vo_taskSetIntParam (handle_t tp, char *paramName, int ival)
+{
+}
+
+
+/**
+ * VO_TASKSETREALPARAM -- Set a real-valued param.
+ *
+ * @brief Set a real-valued param.
+ * @fn str = vo_taskSetRealParam (handle_t tp, char *paramName,
+ * double rval)
+ *
+ * @param tp Task handle
+ * @param paramName Parameter name
+ * @param dval Parameter value
+ * @returns nothing
+ */
+void
+vo_taskSetRealParam (handle_t tp, char *paramName, double dval)
+{
+}
+
+
+#ifdef FOO
+
+ vo_taskSetCallback (tp, &func) # Set output param callback
+ rp = vo_taskExecuteSync (tp) # Execute synchronous; returns
+ # output pset pointer
+ vo_taskExecuteAsync (tp) # Execute async
+ rp = vo_taskWait (tp) # Wait for task, get RP
+ tatus = vo_taskCheckError (tp, *msg) # Check for any error posted
+ # to TP or RP
+#endif
+
+
+
+/**************************************************************************/
+/*** Output Parameters ***/
+/**************************************************************************/
+
+/**
+ * VO_TASKPARAMCOUNT -- Return the number of available output params.
+ *
+ * @brief Return the number of available output params.
+ * @fn status = vo_taskParamCount (handle_t rp)
+ *
+ * @param rp Return handle
+ * @returns Number of available output params
+ */
+int
+vo_taskParamCount (handle_t rp)
+{
+ return (0);
+}
+
+
+/**
+ * VO_TASKGETPARAMINFO -- Get information about an indexed parameter.
+ *
+ * @brief Get information about an indexed parameter.
+ * @fn status = vo_taskGetParamInfo (handle_t rp, int pnum,
+ * char *name, char *type, char *encoding,
+ * char *description)
+ *
+ * @param rp Return handle
+ * @param pnum Parameter index (0-based, used if paramName=NULL)
+ * @param name Parameter name
+ * @returns pointer to parameter value
+ */
+void
+vo_taskGetParamInfo (handle_t rp, int pnum, char *name, char *type,
+ char *encoding, char *description)
+{
+ return;
+}
+
+
+/**
+ * VO_TASKGETPARAMVALUE -- Get a value of the named/indexed output parameter.
+ *
+ * @brief Get a value of the named/indexed output parameter.
+ * @fn status = vo_taskGetParamValue (handle_t rp, char *paramName,
+ * int pnum)
+ *
+ * @param rp Return handle
+ * @param paramName Parameter name
+ * @param pnum Parameter index (0-based, used if paramName=NULL)
+ * @returns pointer to parameter value
+ */
+void *
+vo_taskGetParamValue (handle_t rp, char *paramName, int pnum)
+{
+ return ((void *) NULL);
+}
+
+
+/**
+ * VO_TASKGETSTRINGPARAM -- Get a string-valued output parameter.
+ *
+ * @brief Get a string-valued output parameter.
+ * @fn str = vo_taskGetStringParam (handle_t rp, char *paramName,
+ * int pnum)
+ *
+ * @param rp Return handle
+ * @param paramName Parameter name
+ * @param pnum Parameter index (0-based, used if paramName=NULL)
+ * @returns parameter value as a character string
+ */
+char *
+vo_taskGetStringParam (handle_t rp, char *paramName, int pnum)
+{
+ return ((char *) NULL);
+}
+
+
+/**
+ * VO_TASKGETBOOLPARAM -- Get a bool-valued output parameter.
+ *
+ * @brief Get a bool-valued output parameter.
+ * @fn bval = vo_taskGetBoolParam (handle_t rp, char *paramName, int pnum)
+ *
+ * @param rp Return handle
+ * @param paramName Parameter name
+ * @param pnum Parameter index (0-based, used if paramName=NULL)
+ * @returns parameter value as a bool (0=false, 1=true)
+ */
+int
+vo_taskGetBoolParam (handle_t rp, char *paramName, int pnum)
+{
+ return (0);
+}
+
+
+/**
+ * VO_TASKGETINTPARAM -- Get a int-valued output parameter.
+ *
+ * @brief Get a int-valued output parameter.
+ * @fn ival = vo_taskGetIntParam (handle_t rp, char *paramName, int pnum)
+ *
+ * @param rp Return handle
+ * @param paramName Parameter name
+ * @param pnum Parameter index (0-based, used if paramName=NULL)
+ * @returns parameter value and an integer
+ */
+int
+vo_taskGetIntParam (handle_t rp, char *paramName, int pnum)
+{
+ return (0);
+}
+
+
+/**
+ * VO_TASKGETREALPARAM -- Get a real-valued output parameter.
+ *
+ * @brief Get a real-valued output parameter.
+ * @fn dval = vo_taskGetRealParam (handle_t rp, char *paramName, int pnum)
+ *
+ * @param rp Return handle
+ * @param paramName Parameter name
+ * @param pnum Parameter index (0-based, used if paramName=NULL)
+ * @returns parameter value as a double-precision
+ */
+double
+vo_taskGetRealParam (handle_t rp, char *paramName, int pnum)
+{
+ return ((double) 0.0);
+}
+
+
+/**
+ * VO_TASKCLOSE -- Free task resources.
+ *
+ * @brief Free task resources.
+ * @fn status = vo_taskClose (handle_t tp)
+ *
+ * @param tp Task handle
+ * @returns zero if OK, one on ERROR
+ */
+int
+vo_taskClose (handle_t tp)
+{
+ return (OK);
+}
diff --git a/vendor/voclient/voapps/task/voPkg.c b/vendor/voclient/voapps/task/voPkg.c
new file mode 100644
index 00000000..9442783b
--- /dev/null
+++ b/vendor/voclient/voapps/task/voPkg.c
@@ -0,0 +1,333 @@
+/**
+ *
+ * VOPKG.C -- Task and package management.
+ *
+ * This file provides the introspection methods for a callable package.
+ * These routines are used to call a package binary to get the metadata
+ * for packages, tasks and parameters.
+ *
+ *
+ * Package/Task Management:
+ * ------------------------
+ *
+ * vo_setPkgDir (path) # set package dir
+ * path = vo_getPkgDir () # get package dir
+ *
+ * pkg = vo_pkgList (pattern) # Get available packages
+ * len = vo_pkgLen (pkg)
+ * pkg = vo_pkgNext (pkg)
+ * str = vo_pkgAttr (pkg, attr)
+ *
+ * pp = vo_pkgParams (pkg)
+ * pp = vo_taskParams (pkgName, taskName) # Input param defs
+ * ( see parameter handling below )
+ *
+ * task = vo_taskList (taskName) # Get tasks in package
+ * len = vo_taskLen (task)
+ * str = vo_taskNext (task)
+ * task = vo_taskAttr (task, attr)
+ *
+ *
+ * xml = vo_pkgListXML (pattern) # XML serializations (opt)
+ * xml = vo_taskListXML (pkgName)
+ * xml = vo_paramListXML (pkgName, taskName)
+ *
+ *
+ * @file voPkg.c
+ * @author Mike Fitzpatrick
+ * @date 9/24/12
+ *
+ * @brief Package and task management methods
+ */
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <signal.h>
+#include <stdarg.h>
+#include <setjmp.h>
+#include <sys/wait.h>
+#include <sys/stat.h>
+#include <sys/select.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include "voTask.h"
+
+
+
+
+/**************************************************************************/
+/*** Package Introspection Methods ***/
+/**************************************************************************/
+
+
+/**
+ * VO_SETPKGDIR -- Set the working package directory.
+ *
+ * @brief Set the working package directory.
+ * @fn vo_setPkgDir (char *path)
+ *
+ * @param path Path to current working package directory
+ * @returns nothing
+ */
+void
+vo_setPkgDir (char *path)
+{
+}
+
+
+/**
+ * VO_GETPKGDIR -- Get the working package directory.
+ *
+ * @brief Get the working package directory.
+ * @fn path = vo_getPkgDir (void)
+ *
+ * @returns path to current working package directory
+ */
+char *
+vo_getPkgDir (void)
+{
+}
+
+
+/**************************************************************************/
+/*** Package Management ***/
+/**************************************************************************/
+
+/**
+ * VO_PKGLIST -- List packages available in the working directory..
+ *
+ * @brief List packages available in the working directory.
+ * @fn xml = vo_pkgList (char *pattern)
+ *
+ * @param pattern Package executable filename pattern (or NULL for all)
+ * @returns XML description of the package list.
+ */
+handle_t
+vo_pkgList (char *pattern)
+{
+ return (NULL);
+}
+
+
+/**
+ * VO_PKGLIST -- List packages available in the working directory..
+ *
+ * @brief List packages available in the working directory.
+ * @fn xml = vo_pkgList (char *pattern)
+ *
+ * @param pattern Package executable filename pattern (or NULL for all)
+ * @returns XML description of the package list.
+ */
+int
+vo_pkgLen (handle_t pkg)
+{
+ Package *pkgP = (Package *) task_H2P (pkg);
+
+ return ( (pkgP ? pkgP->npkgs : 0) );
+}
+
+
+/**
+ * VO_PKGNEXT -- Get the next package in the list.
+ *
+ * @brief Get the next package in the list.
+ * @fn pkg = vo_pkgNext (handle_t pkg)
+ *
+ * @param pkg Handle to package
+ * @returns Handle to next package in the list (0 at end of list)
+ */
+handle_t
+vo_pkgNext (handle_t pkg)
+{
+ Package *pkgP = (Package *) task_H2P (pkg);
+
+ return ( (pkgP ? task_P2H (pkgP->next) : 0) );
+}
+
+
+/**
+ * VO_PKGATTR -- Get a package metadata by attribute name.
+ *
+ * @brief Get a package metadata by attribute name.
+ * @fn pkg = vo_pkgAttr (handle_t pkg, char *attr)
+ *
+ * @param pattern Package executable filename pattern (or NULL for all)
+ * @returns Requested attribute string (or NULL if not found)
+ */
+char *
+vo_pkgAttr (handle_t pkg, char *attr)
+{
+ Package *pkgP = (Package *) task_H2P (pkg);
+
+ return (NULL);
+}
+
+
+/**************************************************************************/
+/*** Task Management ***/
+/**************************************************************************/
+
+/**
+ * VO_TASKLIST -- List tasks in package.
+ *
+ * @brief List tasks in package.
+ * @fn handle = vo_taskList (char *pkgName)
+ *
+ * @param pkgName Package name
+ * @returns XML description of the task list
+ */
+char *
+vo_taskList (char *pkgName)
+{
+ return (NULL);
+}
+
+
+/**
+ * VO_TASKLEN -- Get length of task list.
+ *
+ * @brief Get length of task list.
+ * @fn len = vo_taskLen (handle_t task)
+ *
+ * @param task Handle to task descriptor
+ * @returns Number of tasks in the list.
+ */
+int
+vo_taskLen (handle_t task)
+{
+ Package *taskP = (Package *) task_H2P (task);
+
+ return ( (taskP ? taskP->ntasks : 0) );
+}
+
+
+/**
+ * VO_TASKNEXT -- Get the next task in the list.
+ *
+ * @brief Get the next task in the list.
+ * @fn task = vo_taskNext (handle_t task)
+ *
+ * @param task Handle to task
+ * @returns Handle to next task in the list (0 at end of list)
+ */
+handle_t
+vo_taskNext (handle_t task)
+{
+ Package *taskP = (Package *) task_H2P (task);
+
+ return ( (taskP ? task_P2H (taskP->next) : 0) );
+}
+
+
+/**
+ * VO_TASKATTR -- Get a task metadata by attribute name.
+ *
+ * @brief Get a task metadata by attribute name.
+ * @fn task = vo_taskAttr (handle_t task, char *attr)
+ *
+ * @param task Handle to task
+ * @param attr Attribute to retrieve
+ * @returns Requested attribute string (or NULL if not found)
+ */
+char *
+vo_taskAttr (handle_t task, char *attr)
+{
+ Package *taskP = (Package *) task_H2P (task);
+
+ return (NULL);
+}
+
+
+
+/**************************************************************************/
+/*** Task and Package Parameters ***/
+/**************************************************************************/
+
+/**
+ * VO_PKGPARAMS -- List parameters for a package.
+ *
+ * @brief List parameters for a package.
+ * @fn xml = vo_pkgParams (handle_t pkg)
+ *
+ * @param pkg Package handle
+ * @returns XML description of the parameter list
+ */
+handle_t
+vo_pkgParams (handle_t pkg)
+{
+ return (0);
+}
+
+
+/**
+ * VO_TASKPARAMS -- List parameters for a task.
+ *
+ * @brief List parameters for a task.
+ * @fn xml = vo_taskParams (char *pkgName, char *taskName)
+ *
+ * @param pkgName Package name
+ * @param taskName Task name
+ * @returns XML description of the parameter list
+ */
+handle_t
+vo_taskParams (char *pkgName, char *taskName)
+{
+ return (0);
+}
+
+
+
+/**************************************************************************/
+/*** XML Serializations ***/
+/**************************************************************************/
+
+/**
+ * VO_PKGLISTXML -- Get the package list as an XML document.
+ *
+ * @brief Get the package list as an XML document.
+ * @fn xml = vo_pkgListXML (char *pattern)
+ *
+ * @param pattern Package executable pattern
+ * @returns XML description of the available packages.
+ */
+char *
+vo_pkgListXML (char *pattern)
+{
+}
+
+
+/**
+ * VO_TASKLISTXML -- Get the task list as an XML document.
+ *
+ * @brief Get the task list as an XML document.
+ * @fn xml = vo_taskListXML (char *pkgName)
+ *
+ * @param pkgName Package name
+ * @returns XML description of the tasks in a package.
+ */
+char *
+vo_taskListXML (char *pkgName)
+{
+}
+
+
+/**
+ * VO_PARAMLISTXML -- Get the task parameter list as an XML document.
+ *
+ * @brief Get the task parameter list as an XML document.
+ * @fn xml = vo_paramListXML (char *pkgName, char *taskName)
+ *
+ * @param pkgName Package name
+ * @param taskName Task name
+ * @returns XML description of the task parameters.
+ */
+char *
+vo_paramListXML (char *pkgName, char *taskName)
+{
+}
+
diff --git a/vendor/voclient/voapps/task/voTask.c b/vendor/voclient/voapps/task/voTask.c
new file mode 100644
index 00000000..01de7af1
--- /dev/null
+++ b/vendor/voclient/voapps/task/voTask.c
@@ -0,0 +1,258 @@
+/**
+ *
+ * VOTASK.C -- Utilities to run a VOApps task as a connected subprocess.
+ *
+ *
+ * Client Interface:
+ * =================
+ *
+ * Task Execution:
+ * ---------------
+ *
+ * tp = vo_taskInit (pkgName, taskName) # Initialize a task
+ *
+ * vo_taskSetStringParam (tp, pname, sval) # Set input params
+ * vo_taskSetBoolParam (tp, pname, bval)
+ * vo_taskSetIntParam (tp, pname, ival)
+ * vo_taskSetRealParam (tp, pname, dval)
+ * vo_taskSetPtrParam (tp, pname, ptr, size)
+ *
+ * vo_taskSetCallback (tp, type, &func) # Set param callback
+ * rp = vo_taskExecuteSync (tp, status, msg) # Execute sync
+ * vo_taskExecuteAsync (tp) # Execute async
+ * rp = vo_taskWait (tp) # Wait for task, get RP
+ * status = vo_taskCheckError (tp, msg) # Check for any error
+ *
+ * vo_taskClose (tp) # Free task resources
+ *
+ *
+ * @file voTask.c
+ * @author Mike Fitzpatrick & Doug Tody
+ * @date 9/24/12
+ *
+ * @brief VOClient Tasking Interface.
+ */
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <signal.h>
+#include <stdarg.h>
+#include <setjmp.h>
+#include <sys/wait.h>
+#include <sys/stat.h>
+#include <sys/select.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include "voTask.h"
+
+
+
+
+/**************************************************************************/
+/*** Task Execution Methods ***/
+/**************************************************************************/
+
+/**
+ * VO_TASKINIT -- Prepare to run a task.
+ *
+ * @brief Prepare to run a task.
+ * @fn handle = vo_taskInit (char *pkgName, char *taskName)
+ *
+ * @param pkgName Package name
+ * @param taskName Task name
+ * @returns handle to the task descriptor
+ */
+handle_t
+vo_taskInit (char *pkgName, char *taskName)
+{
+}
+
+
+/**
+ * VO_TASKSETSTRINGPARAM -- Set a string-valued param.
+ *
+ * @brief Set a string-valued param.
+ * @fn vo_taskSetStringParam (handle_t tp, char *paramName, char *sval)
+ *
+ * @param tp Task handle
+ * @param paramName Parameter name
+ * @param sval Parameter value
+ * @returns nothing
+ */
+void
+vo_taskSetStringParam (handle_t tp, char *paramName, char *sval)
+{
+}
+
+
+/**
+ * VO_TASKSETBOOLPARAM -- Set a bool-valued param.
+ *
+ * @brief Set a bool-valued param.
+ * @fn vo_taskSetBoolParam (handle_t tp, char *paramName, int bval)
+ *
+ * @param tp Task handle
+ * @param paramName Parameter name
+ * @param bval Parameter value (0=false, 1=true)
+ * @returns nothing
+ */
+void
+vo_taskSetBoolParam (handle_t tp, char *paramName, int bval)
+{
+}
+
+
+/**
+ * VO_TASKSETINTPARAM -- Set a int-valued param.
+ *
+ * @brief Set a int-valued param.
+ * @fn vo_taskSetIntParam (handle_t tp, char *paramName, int ival)
+ *
+ * @param tp Task handle
+ * @param paramName Parameter name
+ * @param ival Parameter value
+ * @returns nothing
+ */
+void
+vo_taskSetIntParam (handle_t tp, char *paramName, int ival)
+{
+}
+
+
+/**
+ * VO_TASKSETREALPARAM -- Set a real-valued param.
+ *
+ * @brief Set a real-valued param.
+ * @fn vo_taskSetRealParam (handle_t tp, char *paramName, double rval)
+ *
+ * @param tp Task handle
+ * @param paramName Parameter name
+ * @param dval Parameter value
+ * @returns nothing
+ */
+void
+vo_taskSetRealParam (handle_t tp, char *paramName, double dval)
+{
+}
+
+
+/**
+ * VO_TASKSETRAWPARAM -- Set a raw-valued param.
+ *
+ * @brief Set a raw-valued param.
+ * @fn vo_taskSetRawParam (handle_t tp, char *paramName, void *ptr,
+ * size_t size)
+ *
+ * @param tp Task handle
+ * @param paramName Parameter name
+ * @param ptr Pointer to raw data block
+ * @param size Size of data block
+ * @returns nothing
+ */
+void
+vo_taskSetRawParam (handle_t tp, char *paramName, void *ptr, size_t size)
+{
+}
+
+
+/**
+ * VO_TASKSETCALLBACK -- Set a callback for a parameter type.
+ *
+ * @brief Set a callback for a parameter type.
+ * @fn vo_taskSetCallback (handle_t tp, int type, void *func)
+ *
+ * @param tp Task handle
+ * @param type Parameter type
+ * @param func Callback function
+ */
+void
+vo_taskSetCallback (handle_t tp, int type, void *func)
+{
+}
+
+
+/**
+ * VO_TASKEXECUTESYNC -- Execute a task synchronously.
+ *
+ * @brief Execute a task synchronously.
+ * @fn rp = vo_taskExecuteSync (handle_t tp, int *status, char *msg)
+ *
+ * @param tp Task handle
+ * @param status Task exit status
+ * @param msg Buffer for returned error message string
+ * @returns Handle to output param list
+ */
+handle_t
+vo_taskExecuteSync (handle_t tp, int status, char *msg)
+{
+}
+
+
+/**
+ * VO_TASKEXECUTEASYNC -- Execute a task asynchronously.
+ *
+ * @brief Execute a task asynchronously.
+ * @fn rp = vo_taskExecuteAsync (handle_t tp)
+ *
+ * @param tp Task handle
+ * @returns Handle to output param list
+ */
+void
+vo_taskExecuteAsync (handle_t tp)
+{
+}
+
+
+/**
+ * VO_TASKWAIT -- Wait for an asynchronous task to complete.
+ *
+ * @brief Wait for an asynchronous task to complete.
+ * @fn rp = vo_taskWait (handle_t tp, int *status, char *msg)
+ *
+ * @param tp Task handle
+ * @param status Task exit status
+ * @param msg Buffer for returned error message string
+ * @returns Handle to output param list
+ */
+handle_t
+vo_taskWait (handle_t tp, int *status, char *msg)
+{
+}
+
+
+/**
+ * VO_TASKCHECKERROR -- Get the task exit status and (any) error message.
+ *
+ * @brief Get the task exit status and (any) error message.
+ * @fn status = vo_taskCheckError (handle_t tp, char *msg)
+ *
+ * @param tp Task handle
+ * @param msg Buffer for returned error message string
+ * @returns Task exit status
+ */
+int
+vo_taskCheckError (handle_t tp, char *msg)
+{
+}
+
+
+
+/**
+ * VO_TASKCLOSE -- Free task resources.
+ *
+ * @brief Free task resources.
+ * @fn status = vo_taskClose (handle_t tp)
+ *
+ * @param tp Task handle
+ * @returns zero if OK, one on ERROR
+ */
+int
+vo_taskClose (handle_t tp)
+{
+ return (OK);
+}
diff --git a/vendor/voclient/voapps/task/voTask.h b/vendor/voclient/voapps/task/voTask.h
new file mode 100644
index 00000000..6bedc35e
--- /dev/null
+++ b/vendor/voclient/voapps/task/voTask.h
@@ -0,0 +1,133 @@
+/**
+ * VOTASK.h -- Tasking interface declarations for the VOClient Package.
+ *
+ * @file voTask.h
+ * @author Mike Fitzpatrick
+ * @date 9/24/12
+ *
+ * @brief Tasking interface declarations for the VOClient Package.
+ */
+
+
+#include <stdio.h>
+#include <stdlib.h>
+
+
+typedef int handle_t;
+
+#ifdef OK
+#undef OK
+#endif
+#define OK 0
+
+#ifdef ERR
+#undef ERR
+#endif
+#define ERR 1
+
+#ifdef SZ_FORMAT
+#undef SZ_FORMAT
+#endif
+#define SZ_FORMAT 32
+
+#ifdef SZ_FNAME
+#undef SZ_FNAME
+#endif
+#define SZ_FNAME 256
+
+#ifdef SZ_LINE
+#undef SZ_LINE
+#endif
+#define SZ_LINE 4096
+
+
+#define MAX_TASKS 128
+
+
+/* Debug and verbose flags.
+ */
+#define VOTASK_DEBUG (getenv("VOTASK_DBG")||access("/tmp/VOTASK_DBG",F_OK)==0)
+#define VOTASK_VERB (getenv("VOTASK_VERB")||access("/tmp/VOTASK_VERB",F_OK)==0)
+
+/**
+ * Output parameter types.
+ */
+#define FORMATS "|int|rel|string|bool|raw|votable|xml|fits|html|"
+
+#define TY_INT 1 /* integer */
+#define TY_REAL 2 /* double-precision */
+#define TY_STRING 3 /* string */
+#define TY_BOOL 4 /* bool */
+#define TY_RAW 5 /* blob */
+
+#define TY_VOTABLE 6 /* A VOTable */
+#define TY_XML 7 /* A raw XML doc */
+#define TY_FITS 8 /* A FITS file */
+#define TY_HTML 9 /* A HTML doc */
+
+
+
+/* Parameter structure.
+ */
+typedef struct {
+ char name[SZ_FNAME]; /* parameter name */
+ char descr[SZ_FNAME]; /* parameter description */
+
+ int type; /* parameter type (int, etc) */
+ int encoding; /* parameter encoding */
+ int numValues; /* number of parameter values */
+
+ void *defaultValue; /* default value */
+ void *value; /* ptr to value */
+ size_t valueLen; /* size of value */
+
+ void *next; /* next linked-list param */
+} Param, *ParamP;
+
+typedef struct {
+ int nParams; /* number of params */
+ Param *param; /* parameter itself */
+} PSet, *PSetP;
+
+
+
+/* Task structure.
+ */
+typedef struct {
+ char name[SZ_FNAME]; /* package name */
+ char descr[SZ_FNAME]; /* package description */
+
+ Param *inParams; /* input params */
+ int nInParams; /* number of input params */
+ Param *outParams; /* output params */
+ int nOutParams; /* number of output params */
+
+ int status; /* task return status */
+ char *msg; /* task return err message */
+
+ int ntasks; /* number of tasks in list */
+ void *next; /* next linked-list task */
+} Task, *TaskP;
+
+
+
+/* Package structure.
+ */
+typedef struct {
+ char name[SZ_FNAME]; /* package name */
+ char descr[SZ_FNAME]; /* package description */
+ char author[SZ_FNAME]; /* package author */
+ char contact[SZ_FNAME]; /* package contact email */
+ char iconUrl[SZ_FNAME]; /* package icon URL */
+ char version[SZ_FNAME]; /* package version string */
+
+ Task tasks[MAX_TASKS]; /* task list */
+ int ntasks; /* number of tasks in package */
+ Param *params; /* package params */
+ int nparams; /* number of package params */
+
+ char cwd[SZ_FNAME]; /* current working directory */
+
+ int npkgs; /* number of packages in list */
+ void *next; /* next linked-list pkg */
+} Package, *PackageP;
diff --git a/vendor/voclient/voapps/task/voTaskMethod.c b/vendor/voclient/voapps/task/voTaskMethod.c
new file mode 100644
index 00000000..555d5c96
--- /dev/null
+++ b/vendor/voclient/voapps/task/voTaskMethod.c
@@ -0,0 +1,49 @@
+/**
+ *
+ *
+ * Task Interface: # Called by the task itself at runtime
+ *
+ * tp = vo_taskStart ()
+ * char *vo_taskGetPackageName (tp)
+ * char *vo_taskGetTaskName (tp)
+ * *char = vo_taskGetStringParam (tp, paramName)
+ * ival = vo_taskGetBoolParam (tp, paramName)
+ * ival = vo_taskGetIntParam (tp, paramName)
+ * dval = vo_taskGetBoolParam (tp, paramName)
+ *
+ * status = vo_setIntOutputParam (tp, paramName, ival)
+ * status = vo_setRealOutputParam (tp, paramName, dval)
+ * status = vo_setStringOutputParam (tp, paramName, sval)
+ * status = vo_setOutputParam (tp, paramName, paramType, paramEncoding,
+ * *len, **void)
+ * tp = vo_taskEnd (tp)
+ *
+ *
+ * Notes:
+ * 1. Task should call vo_taskStart initially to get a runtime context,
+ * and vo_taskEnd when done to free resources, flush any output, and
+ * so forth.
+ * 2. When a task is run in a "connected" (remote) fashion it is passed
+ * a keyword table of parameter values, via argc/argv or whatever.
+ * True host level, CLI (argc/argv) mode can be provided as
+ * well in which case all the -help etc. generics can be provided by
+ * the task main (container).
+ * Defaulting can be performed task-side if provided.
+ * 3. Input parameters can be retrieved by name (do we need to walk a
+ * list as well? probably not in this case).
+ * 4. Output parameters are flushed through to the client in each
+ * setOutputParam call, allowing interactive output at runtime. A
+ * single output parameter may be set multiple times, e.g.,
+ * for stdout, warning, status, etc. this could be normal. The
+ * client tasking code accumulates output parameters in an output
+ * param set during execution. Whether or not parameters are passed
+ * on to a client callback is up to the client.
+ *
+ * Whether or not a task executes directly in the client process or in a
+ * separate process is transparent to the client; normally tasks will execute
+ * in a subprocess.
+ *
+ */
+
+#include "voTask.h"
+
diff --git a/vendor/voclient/voapps/task/voTaskUtil.c b/vendor/voclient/voapps/task/voTaskUtil.c
new file mode 100644
index 00000000..0664da6e
--- /dev/null
+++ b/vendor/voclient/voapps/task/voTaskUtil.c
@@ -0,0 +1,133 @@
+/**
+ * VOTASKUTIL.C -- Utility methods to convert pointers to user handles.
+ *
+ * @brief Utility methods to convert pointers to user handles.
+ *
+ * @file voTaskUtil.c
+ * @author Mike Fitzpatrick
+ * @date 9/24/12
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <string.h>
+#include <time.h>
+#include <ctype.h>
+#include "voTask.h"
+
+
+#define MAX_HANDLES 128
+
+
+int numHandles = 0;
+long taskHandles[MAX_HANDLES];
+
+/* Public procedures
+*/
+handle_t task_P2H (void *ptr);
+void *task_H2P (handle_t handle);
+handle_t task_newHandle (void *ptr);
+void task_freeHandle (handle_t handle);
+
+
+
+/* Utility routines for keep track of handles.
+*/
+
+/**
+ * TASK_NEWHANDLE -- Get an unused object handle.
+ *
+ * @brief Get an unused object handle
+ * @fn handle_t task_newHandle (void *ptr)
+ *
+ * @param ptr pointer to object to be stored
+ * @return new object handle
+ */
+handle_t
+task_newHandle (void *ptr)
+{
+ /* Initialize the handle-to-ptr converter the first time we're called,
+ ** or whenever we've restarted.
+ */
+ if (numHandles == 0)
+ memset (taskHandles, 0, sizeof (taskHandles));
+ taskHandles[++numHandles] = (long) ptr;
+
+ return (numHandles);
+}
+
+
+/**
+ * TASK_FREEHANDLE -- Free the handle for later re-use.
+ *
+ * @brief Free the handle for later re-use.
+ * @fn task_freeHandle (handle_t handle)
+ *
+ * @param handle object handle
+ * @return nothing
+ */
+void
+task_freeHandle (handle_t handle)
+{
+ register int i, j;
+ void *ptr = task_H2P (handle);
+
+
+ if (handle <= 0) {
+ fprintf (stderr, "Error: Attempt to free zero handle!\n");
+ return;
+ }
+
+ for (i=1; i < MAX_HANDLES; i++) {
+ if ((void *) ptr == (void *) taskHandles[i]) {
+ for (j=i+1; j < MAX_HANDLES; j++) {
+ if (taskHandles[j])
+ taskHandles[i++] = taskHandles[j];
+ else
+ break;
+ }
+ numHandles = ((numHandles-1) >= 0 ? (numHandles-1) : 0);
+ break;
+ }
+ }
+}
+
+
+/**
+ * TASK_P2H -- Convert a pointer to a handle
+ *
+ * @brief Convert a pointer to a handle
+ * @fn handle_t task_P2H (void *ptr)
+ *
+ * @param ptr pointer to object
+ * @return handle to object, < 0 on error
+ */
+handle_t
+task_P2H (void *ptr)
+{
+ register int i;
+
+ for (i=1; i < MAX_HANDLES; i++) {
+ if ((void *) ptr == (void *) taskHandles[i])
+ return ((int) i);
+ }
+
+ return (-1);
+}
+
+
+/**
+ * TASK_H2P -- Convert a handle to a pointer
+ *
+ * @brief Convert a handle to a pointer
+ * @fn void *task_H2P (int handle)
+ *
+ * @param handle object handle
+ * @return pointer to object or NULL
+ */
+void *
+task_H2P (handle_t handle)
+{
+ return ((void *) taskHandles[handle]);
+}
diff --git a/vendor/voclient/voapps/task/votools.h b/vendor/voclient/voapps/task/votools.h
new file mode 100644
index 00000000..3e39ef8d
--- /dev/null
+++ b/vendor/voclient/voapps/task/votools.h
@@ -0,0 +1,79 @@
+/**
+ * VOTOOLS.H -- VOTools Package Declarations.
+ *
+ * @file votools.h
+ * @author Mike Fitzpatrick
+ * @date 12/13/12
+ *
+ * @brief VOTools Package Declarations.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* Run as a detached child process?
+*/
+#define RUN_DETACHED 0
+
+
+#define PKG_NAME "votools"
+
+#include "voApps.h"
+
+Task *app = (Task *) NULL;
+
+
+/* Task entry-point declarations.
+ */
+extern int vosamp (int argc, char **argv, size_t *len, void **result);
+
+extern int votcat (int argc, char **argv, size_t *len, void **result);
+extern int votcnv (int argc, char **argv, size_t *len, void **result);
+extern int votget (int argc, char **argv, size_t *len, void **result);
+extern int votinfo (int argc, char **argv, size_t *len, void **result);
+extern int votjoin (int argc, char **argv, size_t *len, void **result);
+extern int votpos (int argc, char **argv, size_t *len, void **result);
+extern int votsort (int argc, char **argv, size_t *len, void **result);
+extern int votsplit (int argc, char **argv, size_t *len, void **result);
+extern int votstat (int argc, char **argv, size_t *len, void **result);
+
+extern int vosesame (int argc, char **argv, size_t *len, void **result);
+
+extern int vodata (int argc, char **argv, size_t *len, void **result);
+extern int voatlas (int argc, char **argv, size_t *len, void **result);
+extern int voiminfo (int argc, char **argv, size_t *len, void **result);
+extern int vosloanspec (int argc, char **argv, size_t *len, void **result);
+
+extern int voregistry (int argc, char **argv, size_t *len, void **result);
+
+
+/* Task application table. Applications must be declared here to be found
+ * and used with the generic main().
+ */
+
+Task voApps[] = {
+ { "votcat", votcat }, /* VOTable apps */
+ { "votcnv", votcnv },
+ { "votget", votget },
+ { "votinfo", votinfo },
+ { "votjoin", votjoin },
+ { "votpos", votpos },
+ { "votsort", votsort },
+ { "votsplit", votsplit },
+ { "votstat", votstat },
+
+ { "vosamp", vosamp }, /* SAMP messaging */
+
+ { "vosesame", vosesame }, /* VO Name Resolution */
+
+ { "vodata", vodata }, /* VO Data access apps */
+ { "voatlas", voatlas },
+ { "voiminfo", voiminfo },
+ { "vosloanspec", vosloanspec },
+
+ { "voregistry", voregistry }, /* VO Registry apps */
+ { NULL, NULL }
+};
+
+
diff --git a/vendor/voclient/voapps/task/zz.c b/vendor/voclient/voapps/task/zz.c
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/vendor/voclient/voapps/task/zz.c
diff --git a/vendor/voclient/voapps/task/zz.py b/vendor/voclient/voapps/task/zz.py
new file mode 100644
index 00000000..81b61f80
--- /dev/null
+++ b/vendor/voclient/voapps/task/zz.py
@@ -0,0 +1,60 @@
+import sys
+import os
+import re
+import glob
+
+
+vopkg_path = ['.', "/tmp"]
+
+pkg_list = []
+pkg_struct = {}
+
+
+def pkgList (pattern=None):
+ ''' Get the list of available packages.
+ @param pattern the package name pattern to match
+
+ Returns: A list of available package names.
+ '''
+
+ pat = pattern
+ if (pattern == None):
+ pat = "*"
+
+ for dir in vopkg_path:
+ if os.path.isdir(dir):
+ pfiles = glob.glob(dir + "/" + pat + ".c")
+ print pfiles
+ for f in pfiles:
+ root,ext = os.path.splitext(os.path.basename(f))
+ pkg_struct[root] = [ f ]
+ print f
+ else:
+ root,ext = os.path.splitext(os.path.basename(dir))
+ if (re.search(pattern,root)):
+ pkg_struct[root] = [ dir ]
+ print dir
+
+ # Save just the package names as a valid list.
+ pkg_list = pkg_struct.keys()
+
+ print pkg_list
+ print pkg_struct
+
+
+print "vo*"
+pkgList("vo*")
+print " "
+
+print "z*"
+pkgList("z*")
+print " "
+
+print "None"
+pkgList()
+print " "
+
+print "zz"
+pkgList("zz")
+print " "
+
diff --git a/vendor/voclient/voapps/task/zztest.c b/vendor/voclient/voapps/task/zztest.c
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/vendor/voclient/voapps/task/zztest.c