diff options
author | Doohwan Kim <dh8210.kim@samsung.com> | 2015-02-26 17:39:16 +0900 |
---|---|---|
committer | Doohwan Kim <dh8210.kim@samsung.com> | 2015-02-26 17:39:45 +0900 |
commit | da07ee69267b4557028357eae802d2a7a57c34e7 (patch) | |
tree | 02a5d7590fc35cd3ad08aa8894ca5f32947a1da1 /src/resolver/resolver.h | |
parent | 34c41c0eecd122a3dd92b30f30267ea4d951343a (diff) | |
download | murphy-tizen_3.0.2015.q1_common.tar.gz murphy-tizen_3.0.2015.q1_common.tar.bz2 murphy-tizen_3.0.2015.q1_common.zip |
Initialize Tizen 3.0submit/tizen_3.0.2015.q1_common/20150320.000000submit/tizen/20150313.025220accepted/tizen/wearable/20150313.084641accepted/tizen/tv/20150313.084515accepted/tizen/mobile/20150313.084815accepted/tizen/common/20150313.083743accepted/tizen/3.0.2015.q1/common/20150323.084221tizen_3.0.2015.q2_commontizen_3.0.2015.q1_commonaccepted/tizen_3.0.2015.q1_common
Signed-off-by: Doohwan Kim <dh8210.kim@samsung.com>
Change-Id: I2ad7e23e121506673a724f512fea429489928451
Diffstat (limited to 'src/resolver/resolver.h')
-rw-r--r-- | src/resolver/resolver.h | 134 |
1 files changed, 134 insertions, 0 deletions
diff --git a/src/resolver/resolver.h b/src/resolver/resolver.h new file mode 100644 index 0000000..09682ee --- /dev/null +++ b/src/resolver/resolver.h @@ -0,0 +1,134 @@ +/* + * Copyright (c) 2012, Intel Corporation + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Intel Corporation nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __MURPHY_RESOLVER_H__ +#define __MURPHY_RESOLVER_H__ + +#include <stdio.h> +#include <stdbool.h> + +typedef struct mrp_resolver_s mrp_resolver_t; + +#include <murphy/common/macros.h> +#include <murphy/core/context.h> +#include <murphy/core/scripting.h> + +MRP_CDECL_BEGIN + + +/* + * tags and names of resolver-related events we emit + */ + +#define MRP_RESOLVER_BUS "resolver-bus" +#define MRP_RESOLVER_EVENT_STARTED "resolver-update-start" +#define MRP_RESOLVER_EVENT_FAILED "resolver-update-failed" +#define MRP_RESOLVER_EVENT_DONE "resolver-update-done" + +#define MRP_RESOLVER_TAG_TARGET ((uint16_t)1) +#define MRP_RESOLVER_TAG_LEVEL ((uint16_t)2) + +/** Just create a resolver context without parsing any input. */ +mrp_resolver_t *mrp_resolver_create(mrp_context_t *ctx); + +/** Parse the given resolver input file into a resolver context. */ +mrp_resolver_t *mrp_resolver_parse(mrp_resolver_t *r, mrp_context_t *ctx, + const char *path); + +/** Add a new target with the given parameters to the resolver context. */ +int mrp_resolver_add_target(mrp_resolver_t *r, const char *target, + const char **depend, int ndepend, + const char *script_type, + const char *script_source); + +/** Add a precompiled target to the resolver context. */ +int mrp_resolver_add_prepared_target(mrp_resolver_t *r, const char *target, + const char **depend, int ndepend, + mrp_interpreter_t *interpreter, + void *compiled_data, void *target_data); + +/** Add an alias for the given target. */ +int mrp_resolver_add_alias(mrp_resolver_t *r, const char *target, + const char *alias); + +/** Enable autoupdate, generate autoupdate target if needed. */ +int mrp_resolver_enable_autoupdate(mrp_resolver_t *r, const char *name); + +/** Destroy the given resolver context, freeing all associated resources. */ +void mrp_resolver_destroy(mrp_resolver_t *r); + +/** Prepare the targets for resolution (link scriptlets, etc.). */ +int mrp_resolver_prepare(mrp_resolver_t *r); + +/** Update the given target. The NULL-terminated variable argument list + after the target name sepcifies the resolver context variables to + set during the update. Use a single NULL to omit variables. */ +int mrp_resolver_update_targetl(mrp_resolver_t *r, + const char *target, ...) MRP_NULLTERM; + +#define mrp_resolver_update_target mrp_resolver_update_targetl + +/** Update the given target. The variable name and type/value arrays + specify the resolver context variables to set during the update. */ +int mrp_resolver_update_targetv(mrp_resolver_t *r, const char *target, + const char **variables, + mrp_script_value_t *values, + int nvariable); + +/** Declare a context variable with a given type. */ +int mrp_resolver_declare_variable(mrp_resolver_t *r, const char *name, + mrp_script_type_t type); + + +/** Get the value of a context variable by id. */ +int mrp_resolver_get_value(mrp_resolver_t *r, int id, mrp_script_value_t *v); +#define mrp_resolver_get_value_by_id mrp_resolver_get_value + +/** Get the value of a context variable by name. */ +int mrp_resolver_get_value_by_name(mrp_resolver_t *r, const char *name, + mrp_script_value_t *v); + +/** Print the given value to the given buffer. */ +char *mrp_print_value(char *buf, size_t size, mrp_script_value_t *value); + +/** Produce a debug dump of all targets. */ +void mrp_resolver_dump_targets(mrp_resolver_t *r, FILE *fp); + +/** Produce a debug dump of all tracked facts. */ +void mrp_resolver_dump_facts(mrp_resolver_t *r, FILE *fp); + +/** Register a script interpreter. */ +int mrp_resolver_register_interpreter(mrp_interpreter_t *i); + +/** Unregister a script interpreter. */ +int mrp_resolver_unregister_interpreter(const char *name); + +MRP_CDECL_END + +#endif /* __MURPHY_RESOLVER_H__ */ |