aesop Repository branch, master, updated. 4f797c1277d3fb7a83222119351bfff6478ce4d5
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "aesop Repository". The branch, master has been updated via 4f797c1277d3fb7a83222119351bfff6478ce4d5 (commit) via b700e83bbe63654a94dc480291fe6432a10af76e (commit) via 5b6fa8974a5725fb7502d55d2b3e179416ec3efe (commit) via c8cacb28c8961d7decb0468efd2000ff0d1b989f (commit) via 97a0592e56c1645bd5213a85ac2bf2e6408b0ca0 (commit) via 8a9a6144639749e2c2a5ce54db23b53c0ef155b3 (commit) via e8579e02b2911193f9aca8aaa94b99995341df1a (commit) via cca6ba6caf0bb267cc5eddbf88db2b89e722bf7e (commit) via a0d4dcb8f30435276a5047a643fdd05a3ac46d13 (commit) via 9eff311e9f8b537598f7832cbb91dacafe535598 (commit) via c20d9d3e99de35eb7d5a53fc5ec2cebe5baf1dab (commit) via f7714356368c55866934b58be52359a1b303c6cd (commit) via 5ba22a064b477db36835dc15714e0cc26eaf54fd (commit) via 588b8d34781081c188edb57412447330701fc186 (commit) from 8fd3b4619b2c5b0d6e230c0b243d4824eb07551c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 4f797c1277d3fb7a83222119351bfff6478ce4d5 Author: Phil Carns <[email protected]> Date: Mon Mar 26 15:54:26 2012 -0400 adjust header path in parser commit b700e83bbe63654a94dc480291fe6432a10af76e Author: Phil Carns <[email protected]> Date: Mon Mar 26 15:50:51 2012 -0400 install resource headers commit 5b6fa8974a5725fb7502d55d2b3e179416ec3efe Author: Phil Carns <[email protected]> Date: Mon Mar 26 15:39:57 2012 -0400 fix include path commit c8cacb28c8961d7decb0468efd2000ff0d1b989f Author: Phil Carns <[email protected]> Date: Mon Mar 26 15:34:36 2012 -0400 reorganizing various headers - some resource.h functionality moved to aesop.h - reduced set of installed headers - installed headers are self-sufficient (no references back to tree) - various other assorted cleanups commit 97a0592e56c1645bd5213a85ac2bf2e6408b0ca0 Author: Phil Carns <[email protected]> Date: Mon Mar 26 15:24:16 2012 -0400 update c-utils commit 8a9a6144639749e2c2a5ce54db23b53c0ef155b3 Author: Phil Carns <[email protected]> Date: Mon Mar 26 14:55:19 2012 -0400 new version of c-utils commit e8579e02b2911193f9aca8aaa94b99995341df1a Author: Phil Carns <[email protected]> Date: Mon Mar 26 14:29:10 2012 -0400 update to new c-utils commit cca6ba6caf0bb267cc5eddbf88db2b89e722bf7e Author: Phil Carns <[email protected]> Date: Mon Mar 26 14:02:17 2012 -0400 remove op.h from installed headers commit a0d4dcb8f30435276a5047a643fdd05a3ac46d13 Author: Phil Carns <[email protected]> Date: Mon Mar 26 13:59:39 2012 -0400 remove opcache.h from installed headers commit 9eff311e9f8b537598f7832cbb91dacafe535598 Author: Phil Carns <[email protected]> Date: Mon Mar 26 13:48:10 2012 -0400 still tinkering with symlinks commit c20d9d3e99de35eb7d5a53fc5ec2cebe5baf1dab Author: Phil Carns <[email protected]> Date: Mon Mar 26 13:14:58 2012 -0400 force symlink commit f7714356368c55866934b58be52359a1b303c6cd Author: Phil Carns <[email protected]> Date: Mon Mar 26 13:13:36 2012 -0400 force symlink commit 5ba22a064b477db36835dc15714e0cc26eaf54fd Author: Phil Carns <[email protected]> Date: Mon Mar 26 11:36:43 2012 -0400 build-tree symlinks to headers to be installed commit 588b8d34781081c188edb57412447330701fc186 Author: Phil Carns <[email protected]> Date: Mon Mar 26 10:59:34 2012 -0400 variable to track headers to install ----------------------------------------------------------------------- Summary of changes: Makefile.in | 44 +++--- ae-blocking-parser.h | 8 +- ae-ctl.h | 10 +- ae-types.h | 5 +- aesop.h | 211 +++++++++++++++++++++++++-- hints.h | 6 +- module.mk.in | 10 +- parser/ae-blocking-parser.lhs | 4 +- parser/tests/blocking/btest-impl.c | 2 + resource.h | 200 +------------------------ resources/resourcebuilder/module.mk.in | 2 + resources/resourcebuilder/resourcebuilder.c | 1 + resources/thread/aethread.c | 1 + resources/thread/aethread.hae | 2 +- resources/thread/module.mk.in | 2 + resources/timer/module.mk.in | 2 + resources/timer/timer.c | 1 + resources/timer/timer.hae | 2 +- src/aefile/aefile.ae | 1 + src/aefile/aefile.hae | 2 +- src/aefile/module.mk.in | 2 + src/c-utils | 2 +- src/ssm/module.mk.in | 1 + 23 files changed, 274 insertions(+), 247 deletions(-) Diff of changes: diff --git a/Makefile.in b/Makefile.in index 9b08410..b653aba 100644 --- a/Makefile.in +++ b/Makefile.in @@ -78,7 +78,7 @@ ifeq ($(BUILD_SSM),1) LIBS += -lssm_ref -lssmp_mpi endif -CFLAGS= -I$(srcdir)/src/c-utils -I$(srcdir)/include -I. -I src/c-utils -I$(srcdir) @CFLAGS@ $(CPPFLAGS) +CFLAGS= -I$(srcdir)/src/c-utils -I$(srcdir)/include -I. -Iinclude -I src/c-utils -I$(srcdir) @CFLAGS@ $(CPPFLAGS) # enable relocatable #CFLAGS += -fPIC @@ -131,6 +131,7 @@ GENLIBHDR := AETESTSRC := AEPROGRAMSRC := AESOP_HDR := +INSTALL_HDR := AETESTLIBSRC := TESTLIBSRC := HSSRC := @@ -435,7 +436,7 @@ $(GENLIBOBJS) $(LIBOBJS) $(TESTOBJS): %.o: %.c $(call MODCFLAGS_C,$*) $< # Auto-generated dependencies for .c files -$(LIBDEPS) $(GENLIBDEPS) $(TESTDEPS) $(TESTLIBDEPS): %.d: %.c +$(LIBDEPS) $(GENLIBDEPS) $(TESTDEPS) $(TESTLIBDEPS): %.d: %.c in_tree_include $(Q) " DEP $@" $(E)CC=$(call MCC_C,$*) $(srcdir)/maint/depend.sh $(call dirname,$*) $(LIBCFLAGS) $(CFLAGS) $(call MODCFLAGS_C,$*) $< > $@ @@ -496,7 +497,7 @@ $(AEOBJS): %.o: $(HSBIN) %.ae -- $(LIBCFLAGS) $(CFLAGS) $(CWARNS) $(call MODCFLAGS_AE,$*) # Auto-generated dependencies for .ae files -$(AEDEPS): %.ae.d: %.ae +$(AEDEPS): %.ae.d: %.ae in_tree_include $(Q) " DEP $@" $(E)CC=$(call MCC_C,$*) $(srcdir)/maint/depend-ae.sh $(call dirname,$*) $(srcdir) $(LIBCFLAGS) $(CFLAGS) $(call MODCFLAGS_C,$*) $< > $@ @@ -510,7 +511,7 @@ $(AESOP_TRHDR): %.h: %.hae $(HSBIN) -j -c $(call MCC_AE,$*) $(VA) $(DA) $(AEPRETTY) \ -- $(LIBCFLAGS) $(CFLAGS) $(CWARNS) $(call MODCFLAGS_AE,$*) -$(AESOP_TRHDR_DEPS): %.h.d: %.hae +$(AESOP_TRHDR_DEPS): %.h.d: %.hae in_tree_include $(Q) " DEP $@" $(E)CC=$(call MCC_C,$*) $(srcdir)/maint/depend-hae.sh $(call dirname,$*) $(srcdir) $(LIBCFLAGS) $(CFLAGS) $(call MODCFLAGS_C,$*) $< > $@ @@ -671,6 +672,25 @@ doc: $(DOCPDF) docshtml: $(DOCHTML) dochtml: $(DOCHTML) +# manually add some c-utils headers to the install list + +INSTALL_HDR += src/c-utils/triton-list.h \ + src/c-utils/triton-thread.h \ + src/c-utils/triton-base.h \ + src/c-utils/triton-uint128.h + +INSTALL_HDR_SRC=$(patsubst %,$(abs_srcdir)/%,$(INSTALL_HDR)) + +.PHONY: in_tree_include include/aesop + +in_tree_include: include/aesop + +include/aesop: + mkdir -p include/aesop + for hdr in $(INSTALL_HDR_SRC); do \ + ln -s $$hdr include/aesop 2> /dev/null; \ + done + install:: all install -d $(bindir) install -d $(libdir) @@ -678,18 +698,4 @@ install:: all install -m 755 bin/aecc $(bindir) install -m 755 bin/aecc-utils $(bindir) install -m 644 lib/libaesop.* $(libdir) - install -m 644 $(srcdir)/src/c-utils/triton-list.h $(includedir) - install -m 644 $(srcdir)/ae-types.h $(includedir) - install -m 644 $(srcdir)/ae-ctl.h $(includedir) - install -m 644 $(srcdir)/ae-log.h $(includedir) - install -m 644 $(srcdir)/aesop.h $(includedir) - install -m 644 $(srcdir)/ae-error.h $(includedir) - install -m 644 $(srcdir)/ae-blocking-parser.h $(includedir) - install -m 644 $(srcdir)/resource.h $(includedir) - install -m 644 $(srcdir)/hints.h $(includedir) - install -m 644 $(srcdir)/opcache.h $(includedir) - install -m 644 $(srcdir)/ae-init.h $(includedir) - install -m 644 $(srcdir)/src/c-utils/triton-thread.h $(includedir) - install -m 644 $(srcdir)/src/c-utils/triton-base.h $(includedir) - install -m 644 $(srcdir)/ae-debug.h $(includedir) - install -m 644 $(srcdir)/op.h $(includedir) + install -m 644 $(INSTALL_HDR_SRC) $(includedir) diff --git a/ae-blocking-parser.h b/ae-blocking-parser.h index f744294..a044b05 100644 --- a/ae-blocking-parser.h +++ b/ae-blocking-parser.h @@ -8,10 +8,10 @@ * either a C statement, a C declaration, or a C expression. */ -#include "aesop.h" -#include "ae-error.h" -#include "ae-log.h" -#include "ae-debug.h" +#include <aesop/aesop.h> +#include <aesop/ae-error.h> +#include <aesop/ae-log.h> +#include <aesop/ae-debug.h> #define AE_MK_START_OF_BLOCKING(__fname__) \ ae_debug_blocking("[START]: %s (%p)\n", #__fname__, __ae_ctl); diff --git a/ae-ctl.h b/ae-ctl.h index 18b0bdf..4e27594 100644 --- a/ae-ctl.h +++ b/ae-ctl.h @@ -1,11 +1,11 @@ #ifndef __AE_CTL_H__ #define __AE_CTL_H__ -#include "ae-types.h" -#include "src/c-utils/triton-thread.h" -#include "src/c-utils/triton-list.h" -#include "ae-error.h" -#include "hints.h" +#include <aesop/triton-thread.h> +#include <aesop/triton-list.h> +#include <aesop/ae-types.h> +#include <aesop/ae-error.h> +#include <aesop/hints.h> #include <opa_primitives.h> diff --git a/ae-types.h b/ae-types.h index f880957..4fcdeb1 100644 --- a/ae-types.h +++ b/ae-types.h @@ -7,8 +7,7 @@ * want to use Triton. */ -#include "triton-string.h" -#include "triton-uint128.h" +#include <aesop/triton-uint128.h> #define ae_op_id_t uint128_t #define ae_op_id_clear triton_uint128_setzero @@ -17,6 +16,4 @@ #define ae_op_id_equal(id1, id2) !memcmp(&id1, &id2, sizeof(ae_op_id_t)) -#define ae_string_t triton_string_t - #endif diff --git a/aesop.h b/aesop.h index 511e798..89276a4 100644 --- a/aesop.h +++ b/aesop.h @@ -1,17 +1,14 @@ #ifndef __AESOP_H__ #define __AESOP_H__ -#include "src/c-utils/triton-base.h" -#include "ae-error.h" -#include "src/c-utils/triton-list.h" -#include "src/c-utils/triton-thread.h" -#include "ae-log.h" -#include "ae-debug.h" - -#include "resource.h" -#include "op.h" -#include "opcache.h" - +#include <aesop/triton-base.h> +#include <aesop/triton-list.h> +#include <aesop/triton-thread.h> +#include <aesop/ae-error.h> +#include <aesop/ae-log.h> +#include <aesop/ae-debug.h> +#include <aesop/ae-ctl.h> +#include <aesop/triton-uint128.h> int aesop_init(const char *resource_list); void aesop_finalize(void); @@ -19,4 +16,196 @@ void aesop_finalize(void); int aesop_set_config(const char* key, const char* value); int aesop_set_debugging(const char* resource, int value); +/* ae_post_blocking allows us to post a blocking function from normal C code and if we're doing a syntax + * check with the normal compiler (GCC), we don't get a 'too many arguments to function' error. + */ +#ifdef AESOP_PARSER +#define ae_post_blocking(__fname, __callback, __user_ptr, __hints, __resource_ctx, __op_id, __fargs...) \ + __fname(__callback, __user_ptr, __hints, __resource_ctx, __op_id, 0, ##__fargs) +#else +#define ae_post_blocking(__fname, __callback, __user_ptr, __hints, __resource_ctx, __op_id, __fargs...) AE_SUCCESS +#endif + +#define ext_post_blocking(__fname, __callback, __user_ptr, __hints, __resource_ctx, __op_id, __fargs...) \ + __fname(__callback, __user_ptr, __hints, __resource_ctx, __op_id, 0, ##__fargs) + +/* Called by c programs to break ae_poll() calls once callbacks are complete */ +void ae_poll_break(ae_context_t context); + +/* Contexts are created to allow separation of polling for different logical + * groups of operations. Don't use this function. Instead, use the associated + * ae_context_create macro. + */ +int _ae_context_create(ae_context_t *context, const char *format, int resource_count, ...) __attribute__((format (printf, 2, 4))) ; + +/* macro to calculate the number of resources passed in as string + * arguments so we don't have to pass in the count explicitly. */ +#define ae_context_create(_context, ...) \ + _ae_context_create(_context, FORMAT_ARGS(__VA_ARGS__) , ##__VA_ARGS__) + +/* Context destruction. Called to cleanup state allocated in ae_context_create. + */ +int ae_context_destroy(ae_context_t context); + +/* Poll for completion of the operations within the given context up to a + * timeout value. + */ +int ae_poll(ae_context_t context, int ms); + +int ae_cancel_branches(struct ae_ctl *ctl); + +int ae_count_branches(struct ae_ctl *ctl); + +#ifdef AESOP_PARSER +#define aesop_cancel_branches() ae_cancel_branches(__ae_ctl->parent ? &__ae_ctl->parent->gen : NULL) +#define aesop_count_branches() ae_count_branches(__ae_ctl->parent ? &__ae_ctl->parent->gen : NULL) +#else +static inline int aesop_cancel_branches(void) { return AE_ERR_SYSTEM; } +static inline int aesop_count_branches(void) { return -1; } +#endif + +/* Set this to zero to cause the main_set macros to busy spin on ae_poll(), + * although this probably is not a good idea. + */ +#define AESOP_MAIN_SET_POLL_TIMEOUT 100 + +/* A macro to implement the boilerplate main function that posts an initial + * blocking function. The blocking function should have the same signature as main(). + * The variable parameters are the const char * names of the resources to initialize + * for the context. In this macro, ae_init() is called with no parameters, so + * all modules get initialized. + * + * Example: + * __blocking int aesop_main(int argc, char **argv) { ... } + * aesop_main_set(aesop_main, "timer", "bdb", "sched"); + */ +#define aesop_main_set(__main_blocking_function__, ...) \ +static int __main_done=0; \ +static int __main_ret; \ +static void __main_cb(void *user_ptr, int t) \ +{ \ + ae_context_t ctx = (ae_context_t)user_ptr; \ + __main_done = 1; \ + __main_ret = t; \ + ae_poll_break(ctx); \ +} \ +int main(int argc, char **argv) \ +{ \ + ae_context_t __main_ctx = NULL; \ + ae_hints_t __main_hints; \ + ae_op_id_t __main_opid; \ + int ret; \ + ret = aesop_init(""); \ + aesop_error_assert(ret); \ + if(COUNT_ARGS(__VA_ARGS__) > 0) \ + { \ + ret = ae_context_create(&__main_ctx, ##__VA_ARGS__); \ + aesop_error_assert(ret); \ + } \ + ret = ae_hints_init(&__main_hints); \ + assert(ret == 0); \ + ret = ae_post_blocking( \ + __main_blocking_function__, \ + __main_cb, \ + __main_ctx, \ + &__main_hints, \ + __main_ctx, \ + &__main_opid, \ + &__main_ret, \ + argc, \ + argv); \ + if(ret == AE_SUCCESS) \ + { \ + while(!__main_done) \ + { \ + ret = ae_poll(__main_ctx, AESOP_MAIN_SET_POLL_TIMEOUT); \ + if(ret == AE_ERR_TIMEDOUT) continue; \ + aesop_error_assert(ret); \ + } \ + } \ + aesop_error_assert(ret); \ + ae_hints_destroy(&__main_hints); \ + if(COUNT_ARGS(__VA_ARGS__) > 0) \ + { \ + ae_context_destroy(__main_ctx); \ + } \ + aesop_finalize(); \ + return __main_ret; \ +} + +/* Similar to above, but this one takes an initialization function + * that gets called before ae_init, + * and a single string to specify the aesop module to initialize. + * + * Example: + * + * __blocking int aesop_main(int argc, char **argv) { ... } + * int set_zeroconf_params(void) { ... } + * aesop_main_set_with_init(set_zeroconf_params, "aesop.client", aesop_main, "bdb", "file"); + */ +#define aesop_main_set_with_init(__init_before_main__, \ + __resource_list__, \ + __main_blocking_function__, ...) \ +static int __main_done=0; \ +static int __main_ret; \ +static void __main_cb(void *user_ptr, int t) \ +{ \ + ae_context_t ctx = (ae_context_t)user_ptr; \ + __main_done = 1; \ + __main_ret = t; \ + ae_poll_break(ctx); \ +} \ +int main(int argc, char **argv) \ +{ \ + ae_context_t __main_ctx = NULL; \ + ae_hints_t __main_hints; \ + ae_op_id_t __main_opid; \ + int ret; \ + int (*__main_init_func)(void) = __init_before_main__; \ + if(__init_before_main__) \ + { \ + ret = __main_init_func(); \ + aesop_error_assert(ret); \ + } \ + ret = aesop_init(__resource_list__); \ + aesop_error_assert(ret); \ + if(COUNT_ARGS(__VA_ARGS__) > 0) \ + { \ + ret = ae_context_create(&__main_ctx, ##__VA_ARGS__); \ + aesop_error_assert(ret); \ + } \ + ret = ae_hints_init(&__main_hints); \ + assert(ret == 0); \ + ret = ae_post_blocking( \ + __main_blocking_function__, \ + __main_cb, \ + __main_ctx, \ + &__main_hints, \ + __main_ctx, \ + &__main_opid, \ + &__main_ret, \ + argc, \ + argv); \ + if(ret == AE_SUCCESS) \ + { \ + while(!__main_done) \ + { \ + ret = ae_poll(__main_ctx, AESOP_MAIN_SET_POLL_TIMEOUT); \ + if(ret == AE_ERR_TIMEDOUT) continue; \ + aesop_error_assert(ret); \ + } \ + } \ + aesop_error_assert(ret); \ + ae_hints_destroy(&__main_hints); \ + if(COUNT_ARGS(__VA_ARGS__) > 0) \ + { \ + ae_context_destroy(__main_ctx); \ + } \ + aesop_finalize(); \ + return __main_ret; \ +} + +ae_op_id_t ae_id_gen(int resource_id, intptr_t ptr); +intptr_t ae_id_lookup(ae_op_id_t id, int *resource_id); + #endif diff --git a/hints.h b/hints.h index cd0d4f8..5c3d17e 100644 --- a/hints.h +++ b/hints.h @@ -1,9 +1,9 @@ #ifndef __AE_HINTS_H__ #define __AE_HINTS_H__ -#include "src/c-utils/triton-base.h" -#include "src/c-utils/triton-list.h" -#include "src/c-utils/triton-thread.h" +#include <aesop/triton-base.h> +#include <aesop/triton-list.h> +#include <aesop/triton-thread.h> struct ae_hints { diff --git a/module.mk.in b/module.mk.in index c48b173..ffe87c5 100644 --- a/module.mk.in +++ b/module.mk.in @@ -7,4 +7,12 @@ LIBSRC += opcache.c \ ae-ctl.c \ ae-init.c - +INSTALL_HDR += ae-types.h \ + ae-ctl.h \ + ae-log.h \ + aesop.h \ + ae-error.h \ + ae-blocking-parser.h \ + hints.h \ + ae-init.h \ + ae-debug.h diff --git a/parser/ae-blocking-parser.lhs b/parser/ae-blocking-parser.lhs index fd210ec..bacb30f 100644 --- a/parser/ae-blocking-parser.lhs +++ b/parser/ae-blocking-parser.lhs @@ -1364,7 +1364,7 @@ a BlockingContext as we go along
let r = if isJust report then fromJust report else headerfile ctu <- generateAST headerfile let tdIdents = getTypeDefIdents ctu -> w <- newWalkerState debug r compiler "ae-blocking-parser.h" gccopts tdIdents +> w <- newWalkerState debug r compiler "aesop/ae-blocking-parser.h" gccopts tdIdents (pairs, w) <- runStateT (getBlockingHeaderDecls ctu) w writeFile outfile "\n\n/* This is an auto-generated file created by the ae-blocking-parser tool. DO NOT MODIFY! */\n\n" outputHeader r outfile pairs @@ -1390,7 +1390,7 @@ a BlockingContext as we go along let r = if isJust report then fromJust report else f ctu <- generateAST f let typeDefIdents = getTypeDefIdents ctu -> w <- newWalkerState debug r compiler "ae-blocking-parser.h" gccopts typeDefIdents +> w <- newWalkerState debug r compiler "aesop/ae-blocking-parser.h" gccopts typeDefIdents let extDecls (CTranslUnit d _) = d let (preBlockingCTU, mainCTU) = splitExtDeclsAtAesop ctu let (CTranslUnit mainExtDecls _) = mainCTU diff --git a/parser/tests/blocking/btest-impl.c b/parser/tests/blocking/btest-impl.c index 20e0f53..1503ec3 100644 --- a/parser/tests/blocking/btest-impl.c +++ b/parser/tests/blocking/btest-impl.c @@ -6,7 +6,9 @@ #include <pthread.h> #include "aesop.h" #include "triton-list.h" +#include "opcache.h" #include "parser/tests/blocking/btest.h" +#include "resource.h"
#define RESOURCE_NAME "btest" diff --git a/resource.h b/resource.h index 7f68ddd..4b9065c 100644 --- a/resource.h +++ b/resource.h @@ -2,11 +2,13 @@ #define __RESOURCE_H__ #include "ae-types.h" -#include "src/c-utils/triton-thread.h" -#include "src/c-utils/triton-list.h" #include "ae-error.h" #include "ae-ctl.h" #include "hints.h" +#include "src/c-utils/triton-uint128.h" +#include "src/c-utils/triton-thread.h" +#include "src/c-utils/triton-list.h" +#include "src/c-utils/triton-string.h" #define AE_MAX_RESOURCES 255 #define AE_MAX_CONTEXTS 1024 @@ -15,18 +17,6 @@ #define AE_GET_RESOURCE_MASK(resource_id) (AE_RESOURCE_MASK&(((uint64_t)resource_id)<<56)) #define AE_GET_RESOURCE_ID(op_id) (((op_id&AE_RESOURCE_MASK)>>56)&0xFF) -/* ae_post_blocking allows us to post a blocking function from normal C code and if we're doing a syntax - * check with the normal compiler (GCC), we don't get a 'too many arguments to function' error. - */ -#ifdef AESOP_PARSER -#define ae_post_blocking(__fname, __callback, __user_ptr, __hints, __resource_ctx, __op_id, __fargs...) \ - __fname(__callback, __user_ptr, __hints, __resource_ctx, __op_id, 0, ##__fargs) -#else -#define ae_post_blocking(__fname, __callback, __user_ptr, __hints, __resource_ctx, __op_id, __fargs...) AE_SUCCESS -#endif - -#define ext_post_blocking(__fname, __callback, __user_ptr, __hints, __resource_ctx, __op_id, __fargs...) \ - __fname(__callback, __user_ptr, __hints, __resource_ctx, __op_id, 0, ##__fargs) #define ae_define_post(__ret_type, __fname, __fargs...) \ int __fname(void (*__ae_callback)(void *ptr, __ret_type ret), \ @@ -43,9 +33,6 @@ int ae_check_debug_flag(int resource_id); #define ae_debug(__resource_id, __format, ...) \ if(ae_check_debug_flag(__resource_id)) fprintf(stderr, __format, ## __VA_ARGS__) -ae_op_id_t ae_id_gen(int resource_id, intptr_t ptr); -intptr_t ae_id_lookup(ae_op_id_t id, int *resource_id); - /* this structure defines a configuration parameter for a resource */ struct ae_resource_config { @@ -89,58 +76,23 @@ void ae_resource_unregister(int resource_id); /* Called by resources to request polling from the event loop */ void ae_resource_request_poll(ae_context_t context, int resource_id); -/* Called by c programs to break ae_poll() calls once callbacks are complete */ -void ae_poll_break(ae_context_t context); /* this function is used by resources that want access to the event loop * used by aesop for this context */ struct ev_loop * ae_resource_get_eloop(ae_context_t context); -/* Contexts are created to allow separation of polling for different logical - * groups of operations. Don't use this function. Instead, use the associated - * ae_context_create macro. - */ -int _ae_context_create(ae_context_t *context, const char *format, int resource_count, ...) __attribute__((format (printf, 2, 4))) ; - -/* macro to calculate the number of resources passed in as string - * arguments so we don't have to pass in the count explicitly. */ -#define ae_context_create(_context, ...) \ - _ae_context_create(_context, FORMAT_ARGS(__VA_ARGS__) , ##__VA_ARGS__) - -/* Context destruction. Called to cleanup state allocated in ae_context_create. - */ -int ae_context_destroy(ae_context_t context); - -/* Poll for completion of the operations within the given context up to a - * timeout value. - */ -int ae_poll(ae_context_t context, int ms); - /* Cancel an operation */ int ae_cancel_op(ae_context_t context, ae_op_id_t op_id); void ae_backtrace(void); -int ae_cancel_branches(struct ae_ctl *ctl); - -int ae_count_branches(struct ae_ctl *ctl); - -void ae_get_stack(struct ae_ctl *ctl, ae_string_t *stack, int *inout_count); - -#ifdef AESOP_PARSER -#define aesop_cancel_branches() ae_cancel_branches(__ae_ctl->parent ? &__ae_ctl->parent->gen : NULL) -#define aesop_count_branches() ae_count_branches(__ae_ctl->parent ? &__ae_ctl->parent->gen : NULL) -#else -static inline int aesop_cancel_branches(void) { return AE_ERR_SYSTEM; } -static inline int aesop_count_branches(void) { return -1; } -#endif - +void ae_get_stack(struct ae_ctl *ctl, triton_string_t *stack, int *inout_count); void ae_print_stack(FILE *outstream, struct ae_ctl *ctl); #ifdef AESOP_PARSER #define aesop_get_stack(stack, io_count) ae_get_stack(&__ae_ctl->gen, stack, io_count) #else -static inline void aesop_get_stack(ae_string_t *strings, int *inout_count) +static inline void aesop_get_stack(triton_string_t *strings, int *inout_count) { *inout_count = 0; } @@ -152,146 +104,6 @@ static inline void aesop_get_stack(ae_string_t *strings, int *inout_count) static inline void aesop_print_stack(FILE *stream) { } #endif -/* Set this to zero to cause the main_set macros to busy spin on ae_poll(), - * although this probably is not a good idea. - */ -#define AESOP_MAIN_SET_POLL_TIMEOUT 100 - -/* A macro to implement the boilerplate main function that posts an initial - * blocking function. The blocking function should have the same signature as main(). - * The variable parameters are the const char * names of the resources to initialize - * for the context. In this macro, ae_init() is called with no parameters, so - * all modules get initialized. - * - * Example: - * __blocking int aesop_main(int argc, char **argv) { ... } - * aesop_main_set(aesop_main, "timer", "bdb", "sched"); - */ -#define aesop_main_set(__main_blocking_function__, ...) \ -static int __main_done=0; \ -static int __main_ret; \ -static void __main_cb(void *user_ptr, int t) \ -{ \ - ae_context_t ctx = (ae_context_t)user_ptr; \ - __main_done = 1; \ - __main_ret = t; \ - ae_poll_break(ctx); \ -} \ -int main(int argc, char **argv) \ -{ \ - ae_context_t __main_ctx = NULL; \ - ae_hints_t __main_hints; \ - ae_op_id_t __main_opid; \ - int ret; \ - ret = aesop_init(""); \ - aesop_error_assert(ret); \ - if(COUNT_ARGS(__VA_ARGS__) > 0) \ - { \ - ret = ae_context_create(&__main_ctx, ##__VA_ARGS__); \ - aesop_error_assert(ret); \ - } \ - ret = ae_hints_init(&__main_hints); \ - assert(ret == 0); \ - ret = ae_post_blocking( \ - __main_blocking_function__, \ - __main_cb, \ - __main_ctx, \ - &__main_hints, \ - __main_ctx, \ - &__main_opid, \ - &__main_ret, \ - argc, \ - argv); \ - if(ret == AE_SUCCESS) \ - { \ - while(!__main_done) \ - { \ - ret = ae_poll(__main_ctx, AESOP_MAIN_SET_POLL_TIMEOUT); \ - if(ret == AE_ERR_TIMEDOUT) continue; \ - aesop_error_assert(ret); \ - } \ - } \ - aesop_error_assert(ret); \ - ae_hints_destroy(&__main_hints); \ - if(COUNT_ARGS(__VA_ARGS__) > 0) \ - { \ - ae_context_destroy(__main_ctx); \ - } \ - aesop_finalize(); \ - return __main_ret; \ -} - -/* Similar to above, but this one takes an initialization function - * that gets called before ae_init, - * and a single string to specify the aesop module to initialize. - * - * Example: - * - * __blocking int aesop_main(int argc, char **argv) { ... } - * int set_zeroconf_params(void) { ... } - * aesop_main_set_with_init(set_zeroconf_params, "aesop.client", aesop_main, "bdb", "file"); - */ -#define aesop_main_set_with_init(__init_before_main__, \ - __resource_list__, \ - __main_blocking_function__, ...) \ -static int __main_done=0; \ -static int __main_ret; \ -static void __main_cb(void *user_ptr, int t) \ -{ \ - ae_context_t ctx = (ae_context_t)user_ptr; \ - __main_done = 1; \ - __main_ret = t; \ - ae_poll_break(ctx); \ -} \ -int main(int argc, char **argv) \ -{ \ - ae_context_t __main_ctx = NULL; \ - ae_hints_t __main_hints; \ - ae_op_id_t __main_opid; \ - int ret; \ - int (*__main_init_func)(void) = __init_before_main__; \ - if(__init_before_main__) \ - { \ - ret = __main_init_func(); \ - aesop_error_assert(ret); \ - } \ - ret = aesop_init(__resource_list__); \ - aesop_error_assert(ret); \ - if(COUNT_ARGS(__VA_ARGS__) > 0) \ - { \ - ret = ae_context_create(&__main_ctx, ##__VA_ARGS__); \ - aesop_error_assert(ret); \ - } \ - ret = ae_hints_init(&__main_hints); \ - assert(ret == 0); \ - ret = ae_post_blocking( \ - __main_blocking_function__, \ - __main_cb, \ - __main_ctx, \ - &__main_hints, \ - __main_ctx, \ - &__main_opid, \ - &__main_ret, \ - argc, \ - argv); \ - if(ret == AE_SUCCESS) \ - { \ - while(!__main_done) \ - { \ - ret = ae_poll(__main_ctx, AESOP_MAIN_SET_POLL_TIMEOUT); \ - if(ret == AE_ERR_TIMEDOUT) continue; \ - aesop_error_assert(ret); \ - } \ - } \ - aesop_error_assert(ret); \ - ae_hints_destroy(&__main_hints); \ - if(COUNT_ARGS(__VA_ARGS__) > 0) \ - { \ - ae_context_destroy(__main_ctx); \ - } \ - aesop_finalize(); \ - return __main_ret; \ -} #endif /* __AE_RESOURCE_H__ */ /* diff --git a/resources/resourcebuilder/module.mk.in b/resources/resourcebuilder/module.mk.in index 5031b63..6949220 100644 --- a/resources/resourcebuilder/module.mk.in +++ b/resources/resourcebuilder/module.mk.in @@ -2,6 +2,8 @@ DIR := resources/resourcebuilder AESOP_HDR += $(DIR)/resourcebuilder.hae +INSTALL_HDR += $(DIR)/resourcebuilder.hae + LIBSRC += $(DIR)/resourcebuilder.c diff --git a/resources/resourcebuilder/resourcebuilder.c b/resources/resourcebuilder/resourcebuilder.c index 7bf8ca1..257d467 100644 --- a/resources/resourcebuilder/resourcebuilder.c +++ b/resources/resourcebuilder/resourcebuilder.c @@ -3,6 +3,7 @@ */ #include "resources/resourcebuilder/resourcebuilder.h" #include "src/c-utils/triton-thread.h" +#include "resource.h" #define RB_DEFAULT_SIZE 64 #define RB_RESOURCE_NAME "resourcebuilder" diff --git a/resources/thread/aethread.c b/resources/thread/aethread.c index b7782a0..0dc77da 100644 --- a/resources/thread/aethread.c +++ b/resources/thread/aethread.c @@ -7,6 +7,7 @@ #include "op.h" #include "opcache.h" #include "resources/thread/aethread.h" +#include "resource.h" struct aethread_op { diff --git a/resources/thread/aethread.hae b/resources/thread/aethread.hae index c41b0f3..5267c3e 100644 --- a/resources/thread/aethread.hae +++ b/resources/thread/aethread.hae @@ -1,7 +1,7 @@ #ifndef __AETHREAD_HAE__ #define __AETHREAD_HAE__ -#include "aesop.h" +#include <aesop/aesop.h> struct aethread_group; diff --git a/resources/thread/module.mk.in b/resources/thread/module.mk.in index c952dab..5a060b8 100644 --- a/resources/thread/module.mk.in +++ b/resources/thread/module.mk.in @@ -2,4 +2,6 @@ DIR := resources/thread AESOP_HDR += $(DIR)/aethread.hae +INSTALL_HDR += $(DIR)/aethread.hae + LIBSRC += $(DIR)/aethread.c diff --git a/resources/timer/module.mk.in b/resources/timer/module.mk.in index ee14128..08a6475 100644 --- a/resources/timer/module.mk.in +++ b/resources/timer/module.mk.in @@ -2,4 +2,6 @@ DIR := resources/timer AESOP_HDR += $(DIR)/timer.hae +INSTALL_HDR += $(DIR)/timer.hae + LIBSRC += $(DIR)/timer.c diff --git a/resources/timer/timer.c b/resources/timer/timer.c index bc8df00..b21977d 100644 --- a/resources/timer/timer.c +++ b/resources/timer/timer.c @@ -8,6 +8,7 @@ #include <assert.h> #include <unistd.h> #include "aesop.h" +#include "resource.h" #include "op.h" #include "opcache.h" #include "resources/timer/timer.h" diff --git a/resources/timer/timer.hae b/resources/timer/timer.hae index eee04b5..c8f7c3a 100644 --- a/resources/timer/timer.hae +++ b/resources/timer/timer.hae @@ -3,7 +3,7 @@ #include <errno.h> -#include "aesop.h" +#include <aesop/aesop.h> /** * run a timer for the specified number of milliseconds diff --git a/src/aefile/aefile.ae b/src/aefile/aefile.ae index e9f510c..c592081 100644 --- a/src/aefile/aefile.ae +++ b/src/aefile/aefile.ae @@ -12,6 +12,7 @@ #include "src/aefile/aefile.hae" #include "resources/thread/aethread.hae" +#include "resource.h" struct aethread_group* file_threads = NULL; diff --git a/src/aefile/aefile.hae b/src/aefile/aefile.hae index f10eb1e..803f365 100644 --- a/src/aefile/aefile.hae +++ b/src/aefile/aefile.hae @@ -1,7 +1,7 @@ #ifndef __AEFILE_HAE__ #define __AEFILE_HAE__ -#include "aesop.h" +#include <aesop/aesop.h> #include <unistd.h> #include <sys/types.h> diff --git a/src/aefile/module.mk.in b/src/aefile/module.mk.in index aa0887d..b24851c 100644 --- a/src/aefile/module.mk.in +++ b/src/aefile/module.mk.in @@ -2,4 +2,6 @@ DIR := src/aefile AESOP_HDR += $(DIR)/aefile.hae +INSTALL_HDR += $(DIR)/aefile.hae + AELIBSRC += $(DIR)/aefile.ae diff --git a/src/c-utils b/src/c-utils index e4d1f58..7f4af54 160000 --- a/src/c-utils +++ b/src/c-utils @@ -1 +1 @@ -Subproject commit e4d1f589cf370787f8d62aedf5887251c0d0ab81 +Subproject commit 7f4af54f5af9a97f346cfb1d8fc122b1f2203178 diff --git a/src/ssm/module.mk.in b/src/ssm/module.mk.in index e54fa08..d7557ef 100644 --- a/src/ssm/module.mk.in +++ b/src/ssm/module.mk.in @@ -4,5 +4,6 @@ ifeq ($(BUILD_SSM),1) AELIBSRC += $(DIR)/aessm.ae AESOP_HDR += $(DIR)/aessm.hae +INSTALL_HDR += $(DIR)/aessm.hae endif hooks/post-receive -- aesop Repository
participants (1)
-
noreply@mcs.anl.gov