aboutsummaryrefslogtreecommitdiffstats
path: root/edify/expr.h
diff options
context:
space:
mode:
authorDoug Zongker <dougz@android.com>2009-06-10 14:11:53 -0700
committerDoug Zongker <dougz@android.com>2009-06-11 16:25:29 -0700
commit9931f7f3c1288171319e9ff7d053ebaad07db720 (patch)
tree42ae5b40309f6ea3410c5ad496f81368675274f7 /edify/expr.h
parent9b9c2114bd7d02200ce43cb9ec513473079dfad9 (diff)
downloadbootable_recovery-9931f7f3c1288171319e9ff7d053ebaad07db720.zip
bootable_recovery-9931f7f3c1288171319e9ff7d053ebaad07db720.tar.gz
bootable_recovery-9931f7f3c1288171319e9ff7d053ebaad07db720.tar.bz2
edify extensions for OTA package installation, part 1
Adds the following edify functions: mount unmount format show_progress delete delete_recursive package_extract symlink set_perm set_perm_recursive This set is enough to extract and install the system part of a (full) OTA package. Adds the updater binary that extracts an edify script from the OTA package and then executes it. Minor changes to the edify core (adds a sleep() builtin for debugging, adds "." to the set of characters that can appear in an unquoted string).
Diffstat (limited to 'edify/expr.h')
-rw-r--r--edify/expr.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/edify/expr.h b/edify/expr.h
index ac5df18..cfbef90 100644
--- a/edify/expr.h
+++ b/edify/expr.h
@@ -57,6 +57,14 @@ char* IfElseFn(const char* name, void* cookie, int argc, Expr* argv[]);
char* AssertFn(const char* name, void* cookie, int argc, Expr* argv[]);
char* AbortFn(const char* name, void* cookie, int argc, Expr* argv[]);
+
+// For setting and getting the global error string (when returning
+// NULL from a function).
+void SetError(const char* message); // makes a copy
+const char* GetError(); // retains ownership
+void ClearError();
+
+
typedef struct {
const char* name;
Function fn;
@@ -77,4 +85,19 @@ void FinishRegistration();
// exists.
Function FindFunction(const char* name);
+
+// --- convenience functions for use in functions ---
+
+// Evaluate the expressions in argv, giving 'count' char* (the ... is
+// zero or more char** to put them in). If any expression evaluates
+// to NULL, free the rest and return -1. Return 0 on success.
+int ReadArgs(void* cookie, Expr* argv[], int count, ...);
+
+// Evaluate the expressions in argv, returning an array of char*
+// results. If any evaluate to NULL, free the rest and return NULL.
+// The caller is responsible for freeing the returned array and the
+// strings it contains.
+char** ReadVarArgs(void* cookie, int argc, Expr* argv[]);
+
+
#endif // _EXPRESSION_H