pyasm 0.2 - dynamic x86 assembler for python

Stefan Behnel stefan.behnel-n05pAM at web.de
Thu Mar 10 09:01:41 EST 2005


Hi!

What about an interface like this:

------------------------------
@pyasm
def hello_world(*some_args):
    """
      !CHARS hello_str 'Hello world!\n\0'

      !PROC hello_world PYTHON
      !ARG  self
      !ARG  args

           PUSH hello_str
           CALL PySys_WriteStdout
           ADD ESP, 0x4
           MOV EAX,PyNone
           ADD [EAX],1
      !ENDPROC
    """

hello_world(1,2,3)
------------------------------

Meaning: Put the assembler into the doc-string of a function. Then use a
decorator to run the assembler on the function's __doc__ string and build an
assembly function that takes the same arguments to make the assembly function
directly callable.

Maybe the decorator line has to look like this:
@pyasm(globals())
or something like that, I can't tell. I don't think it would be much work to 
implement this.

Stefan



More information about the Python-list mailing list