Add new function in AML interpreter; aml_invoke_method().
Also remove unneeded includes in aml_obj.c and aml_parse.c. This new function takes 'struct aml_name *' as a argument rather than 'char *' where aml_invoke_method_by_name() does. It's worth to have these two interfaces in many cases.
This commit is contained in:
parent
d186a392ba
commit
80d92dc27e
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=66150
@ -55,7 +55,6 @@
|
|||||||
|
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#else /* _KERNEL */
|
#else /* _KERNEL */
|
||||||
#include <sys/bus.h>
|
|
||||||
#include <sys/systm.h>
|
#include <sys/systm.h>
|
||||||
#endif /* !_KERNEL */
|
#endif /* !_KERNEL */
|
||||||
|
|
||||||
@ -378,10 +377,9 @@ aml_execute_method(struct aml_environ *env)
|
|||||||
}
|
}
|
||||||
|
|
||||||
union aml_object *
|
union aml_object *
|
||||||
aml_invoke_method_by_name(char *method, int argc, union aml_object *argv)
|
aml_invoke_method(struct aml_name *name, int argc, union aml_object *argv)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
struct aml_name *name;
|
|
||||||
struct aml_name *tmp;
|
struct aml_name *tmp;
|
||||||
struct aml_environ *env;
|
struct aml_environ *env;
|
||||||
struct aml_local_stack *stack;
|
struct aml_local_stack *stack;
|
||||||
@ -394,7 +392,6 @@ aml_invoke_method_by_name(char *method, int argc, union aml_object *argv)
|
|||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
bzero(env, sizeof(struct aml_environ));
|
bzero(env, sizeof(struct aml_environ));
|
||||||
name = aml_find_from_namespace(aml_get_rootname(), method);
|
|
||||||
|
|
||||||
if (name != NULL && name->property != NULL &&
|
if (name != NULL && name->property != NULL &&
|
||||||
name->property->type == aml_t_method) {
|
name->property->type == aml_t_method) {
|
||||||
@ -424,3 +421,16 @@ aml_invoke_method_by_name(char *method, int argc, union aml_object *argv)
|
|||||||
memman_free(aml_memman, memid_aml_environ, env);
|
memman_free(aml_memman, memid_aml_environ, env);
|
||||||
return (retval);
|
return (retval);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
union aml_object *
|
||||||
|
aml_invoke_method_by_name(char *method, int argc, union aml_object *argv)
|
||||||
|
{
|
||||||
|
struct aml_name *name;
|
||||||
|
|
||||||
|
name = aml_find_from_namespace(aml_get_rootname(), method);
|
||||||
|
if (name == NULL) {
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (aml_invoke_method(name, argc, argv));
|
||||||
|
}
|
||||||
|
@ -40,6 +40,8 @@ int aml_eval_name_simple(struct aml_name *, va_list);
|
|||||||
int aml_objtonum(struct aml_environ *,
|
int aml_objtonum(struct aml_environ *,
|
||||||
union aml_object *);
|
union aml_object *);
|
||||||
struct aml_name *aml_execute_method(struct aml_environ *);
|
struct aml_name *aml_execute_method(struct aml_environ *);
|
||||||
|
union aml_object *aml_invoke_method(struct aml_name *,
|
||||||
|
int, union aml_object *);
|
||||||
union aml_object *aml_invoke_method_by_name(char *,
|
union aml_object *aml_invoke_method_by_name(char *,
|
||||||
int, union aml_object *);
|
int, union aml_object *);
|
||||||
|
|
||||||
|
@ -48,7 +48,6 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#else /* _KERNEL */
|
#else /* _KERNEL */
|
||||||
#include <sys/bus.h>
|
|
||||||
#include <sys/systm.h>
|
#include <sys/systm.h>
|
||||||
#endif /* !_KERNEL */
|
#endif /* !_KERNEL */
|
||||||
|
|
||||||
|
@ -54,7 +54,6 @@
|
|||||||
|
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#else /* _KERNEL */
|
#else /* _KERNEL */
|
||||||
#include <sys/bus.h>
|
|
||||||
#include <sys/systm.h>
|
#include <sys/systm.h>
|
||||||
#endif /* !_KERNEL */
|
#endif /* !_KERNEL */
|
||||||
|
|
||||||
|
@ -55,7 +55,6 @@
|
|||||||
|
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#else /* _KERNEL */
|
#else /* _KERNEL */
|
||||||
#include <sys/bus.h>
|
|
||||||
#include <sys/systm.h>
|
#include <sys/systm.h>
|
||||||
#endif /* !_KERNEL */
|
#endif /* !_KERNEL */
|
||||||
|
|
||||||
@ -378,10 +377,9 @@ aml_execute_method(struct aml_environ *env)
|
|||||||
}
|
}
|
||||||
|
|
||||||
union aml_object *
|
union aml_object *
|
||||||
aml_invoke_method_by_name(char *method, int argc, union aml_object *argv)
|
aml_invoke_method(struct aml_name *name, int argc, union aml_object *argv)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
struct aml_name *name;
|
|
||||||
struct aml_name *tmp;
|
struct aml_name *tmp;
|
||||||
struct aml_environ *env;
|
struct aml_environ *env;
|
||||||
struct aml_local_stack *stack;
|
struct aml_local_stack *stack;
|
||||||
@ -394,7 +392,6 @@ aml_invoke_method_by_name(char *method, int argc, union aml_object *argv)
|
|||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
bzero(env, sizeof(struct aml_environ));
|
bzero(env, sizeof(struct aml_environ));
|
||||||
name = aml_find_from_namespace(aml_get_rootname(), method);
|
|
||||||
|
|
||||||
if (name != NULL && name->property != NULL &&
|
if (name != NULL && name->property != NULL &&
|
||||||
name->property->type == aml_t_method) {
|
name->property->type == aml_t_method) {
|
||||||
@ -424,3 +421,16 @@ aml_invoke_method_by_name(char *method, int argc, union aml_object *argv)
|
|||||||
memman_free(aml_memman, memid_aml_environ, env);
|
memman_free(aml_memman, memid_aml_environ, env);
|
||||||
return (retval);
|
return (retval);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
union aml_object *
|
||||||
|
aml_invoke_method_by_name(char *method, int argc, union aml_object *argv)
|
||||||
|
{
|
||||||
|
struct aml_name *name;
|
||||||
|
|
||||||
|
name = aml_find_from_namespace(aml_get_rootname(), method);
|
||||||
|
if (name == NULL) {
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (aml_invoke_method(name, argc, argv));
|
||||||
|
}
|
||||||
|
@ -40,6 +40,8 @@ int aml_eval_name_simple(struct aml_name *, va_list);
|
|||||||
int aml_objtonum(struct aml_environ *,
|
int aml_objtonum(struct aml_environ *,
|
||||||
union aml_object *);
|
union aml_object *);
|
||||||
struct aml_name *aml_execute_method(struct aml_environ *);
|
struct aml_name *aml_execute_method(struct aml_environ *);
|
||||||
|
union aml_object *aml_invoke_method(struct aml_name *,
|
||||||
|
int, union aml_object *);
|
||||||
union aml_object *aml_invoke_method_by_name(char *,
|
union aml_object *aml_invoke_method_by_name(char *,
|
||||||
int, union aml_object *);
|
int, union aml_object *);
|
||||||
|
|
||||||
|
@ -48,7 +48,6 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#else /* _KERNEL */
|
#else /* _KERNEL */
|
||||||
#include <sys/bus.h>
|
|
||||||
#include <sys/systm.h>
|
#include <sys/systm.h>
|
||||||
#endif /* !_KERNEL */
|
#endif /* !_KERNEL */
|
||||||
|
|
||||||
|
@ -54,7 +54,6 @@
|
|||||||
|
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#else /* _KERNEL */
|
#else /* _KERNEL */
|
||||||
#include <sys/bus.h>
|
|
||||||
#include <sys/systm.h>
|
#include <sys/systm.h>
|
||||||
#endif /* !_KERNEL */
|
#endif /* !_KERNEL */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user