Date: Wed, 20 Sep 2000 17:15:07 -0700 From: Mike Smith <msmith@freebsd.org> To: Mitsuru IWASAKI <iwasaki@FreeBSD.org> Cc: cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/dev/acpi/aml aml_evalobj.c aml_evalobj.h aml_obj.c aml_parse.c Message-ID: <200009210015.RAA00846@mass.osd.bsdi.com> In-Reply-To: Your message of "Wed, 20 Sep 2000 15:53:39 PDT." <200009202253.PAA59611@freefall.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
I'd really like to be able to invoke methods that take arguments and return values, actually. To do this "more or less" right will require something like a printf format string. The best proposal I've come up with so far goes something like this: int aml_invoke_method(name, format, ...) where 'name' is the AML method's name (probably an aml_name, actually), and 'format' is a printf-like string. The first format specifier in the format should describe the value that the method is expected to return. It should be %* if the method does not return anything. The remaining specifiers in the format string should describe arguments to be placed on the stack for the method. I would stack from left to right (even though C stacks the other way around) for simplicity's sake. You'd use format specifiers specific to the AML object types, eg. %* nothing (ignored) %n aml_t_namestr = -3, %r aml_t_regfield, %o aml_t_objref, %0 aml_t_null = 0, %d aml_t_num, %s aml_t_string, %b aml_t_buffer, %p aml_t_package, %D aml_t_device, %f aml_t_field, %e aml_t_event, %m aml_t_method, %M aml_t_mutex, %o aml_t_opregion, %P aml_t_powerres, %C aml_t_processor, %T aml_t_therm, %B aml_t_bufferfield, %x aml_t_ddbhandle, %X aml_t_debug Note that the leading '%' is actually redundant, and leaving it out wouldn't hurt anything. You might also want to put a separator between the return value and arguments, eg. a method that takes two numeric values and returns a string would have a format of "%s:%d%d". This would make it very easy to invoke arbitrary methods without the cumbersome glue currently involved in initialising a context and then stacking variables manually. (I still don't understand how to stack variables into an aml_environment rather than just the local stack anyway...) Just a thought... > iwasaki 2000/09/20 15:53:39 PDT > > Modified files: > sys/dev/acpi/aml aml_evalobj.c aml_evalobj.h aml_obj.c > aml_parse.c > Log: > 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. > > Revision Changes Path > 1.3 +15 -5 src/sys/dev/acpi/aml/aml_evalobj.c > 1.2 +3 -1 src/sys/dev/acpi/aml/aml_evalobj.h > 1.2 +1 -2 src/sys/dev/acpi/aml/aml_obj.c > 1.3 +1 -2 src/sys/dev/acpi/aml/aml_parse.c > > > -- ... every activity meets with opposition, everyone who acts has his rivals and unfortunately opponents also. But not because people want to be opponents, rather because the tasks and relationships force people to take different points of view. [Dr. Fritz Todt] To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200009210015.RAA00846>