#define (from C) in Python

Ulrich Eckhardt eckhardt at satorlaser.com
Fri Nov 13 09:43:14 CET 2009


Santiago Romero wrote:
> Well, In the above concrete example, that would work, but I was
> talking for multiple code lines, like:
> 
> 
> #define LD_r_n(reg) (reg) = Z80ReadMem(r_PC++)
> 
> #define LD_rr_nn(reg)   r_opl = Z80ReadMem(r_PC); r_PC++; \
>                         r_oph = Z80ReadMem(r_PC); r_PC++; \
>                         reg = r_op
> 
> #define LOAD_r(dreg, saddreg)   (dreg)=Z80ReadMem((saddreg))
> 
> #define LOAD_rr_nn(dreg)   r_opl = Z80ReadMem(r_PC); r_PC++; \
>                            r_oph = Z80ReadMem(r_PC); r_PC++; \
>                            r_tmpl = Z80ReadMem(r_op); \
>                            r_tmph = Z80ReadMem((r_op)+1); \
>                            dreg=r_tmp
> 
> #define STORE_nn_rr(dreg) \
>                         r_opl = Z80ReadMem(r_PC); r_PC++;\
>                         r_oph = Z80ReadMem(r_PC); r_PC++; \
>                         r_tmp = dreg; \
>                         Z80WriteMem((r_op),r_tmpl, regs); \
>                         Z80WriteMem((r_op+1),r_tmph, regs)

Someone writing such code and calling it C should be taken behind the barn
and shot. Which system runs Python but doesn't have a C compiler that knows
inlining?

>  But it seems that is not possible :-(

Thank getenv("DEITY") not!

Uli





More information about the Python-list mailing list