diff options
author | Doug Zongker <dougz@android.com> | 2009-06-12 17:25:38 +0200 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-06-12 17:25:38 +0200 |
commit | 6c301e244d0d14e3b2983350d7c383abf52b89f7 (patch) | |
tree | c6d6705c9cf240991a29b4773180691afadaf623 /edify/expr.h | |
parent | fix simulator build by excluding more of recovery (diff) | |
parent | edify extensions for OTA package installation, part 1 (diff) | |
download | android_bootable_recovery-6c301e244d0d14e3b2983350d7c383abf52b89f7.tar android_bootable_recovery-6c301e244d0d14e3b2983350d7c383abf52b89f7.tar.gz android_bootable_recovery-6c301e244d0d14e3b2983350d7c383abf52b89f7.tar.bz2 android_bootable_recovery-6c301e244d0d14e3b2983350d7c383abf52b89f7.tar.lz android_bootable_recovery-6c301e244d0d14e3b2983350d7c383abf52b89f7.tar.xz android_bootable_recovery-6c301e244d0d14e3b2983350d7c383abf52b89f7.tar.zst android_bootable_recovery-6c301e244d0d14e3b2983350d7c383abf52b89f7.zip |
Diffstat (limited to 'edify/expr.h')
-rw-r--r-- | edify/expr.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/edify/expr.h b/edify/expr.h index ac5df1869..cfbef903b 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 |