From 82561b0555cdf18b921742a44f6807c10c2ed48e Mon Sep 17 00:00:00 2001 From: Masatake YAMATO Date: Sun, 23 May 2021 15:19:53 +0900 Subject: [PATCH] optscript: introduce opt_dict_known_and_get as new C API Signed-off-by: Masatake YAMATO --- dsl/optscript.c | 6 ++++++ dsl/optscript.h | 1 + 2 files changed, 7 insertions(+) diff --git a/dsl/optscript.c b/dsl/optscript.c index 02f322dbc3..55c5c263d4 100644 --- a/dsl/optscript.c +++ b/dsl/optscript.c @@ -690,6 +690,12 @@ opt_dict_known_and_get_cstr (EsObject *dict, const char* name, EsObject **val) return dict_op_known_and_get (dict, sym, val); } +bool +opt_dict_known_and_get (EsObject *dict, EsObject *key, EsObject **val) +{ + return dict_op_known_and_get (dict, key, val); +} + bool opt_dict_foreach (EsObject *dict, bool (* fn) (EsObject *, EsObject *, void*), void *data) { diff --git a/dsl/optscript.h b/dsl/optscript.h index 6176779377..f1a3d56727 100644 --- a/dsl/optscript.h +++ b/dsl/optscript.h @@ -53,6 +53,7 @@ unsigned int opt_vm_ostack_count (OptVM *vm); EsObject *opt_dict_new (unsigned int size); bool opt_dict_known_and_get_cstr (EsObject *dict, const char* name, EsObject **val); +bool opt_dict_known_and_get (EsObject *dict, EsObject *key, EsObject **val); bool opt_dict_foreach (EsObject *dict, bool (* fn) (EsObject *, EsObject *, void*), void *data); void opt_dict_def (EsObject *dict, EsObject *sym, EsObject *val); bool opt_dict_undef (EsObject *dict, EsObject *sym);