<br><div class="gmail_quote">On Tue, Sep 6, 2011 at 4:50 PM, caox <span dir="ltr"><<a href="mailto:caox@lightpole.net">caox@lightpole.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div style="word-wrap: break-word;">Hi<div><br></div><div><span style="white-space: pre-wrap;"> </span>When reading the source code of beam_emu.c, I found the following marcos:</div><div><br></div><div><div style="margin: 0px;">
<span style="color: rgb(160, 0, 105);">#if</span> defined(NO_JUMP_TABLE)</div><div style="margin: 0px;"><span style="color: rgb(160, 0, 105);"># define</span> OpCase(OpCode) <span style="color: rgb(160, 0, 105);">case</span> op_<span style="color: rgb(160, 0, 105);">##</span>OpCode: lb_<span style="color: rgb(160, 0, 105);">##</span>OpCode</div>
<div style="margin: 0px;"><span style="color: rgb(160, 0, 105);"># define</span> CountCase(OpCode) <span style="color: rgb(160, 0, 105);">case</span> op_count_<span style="color: rgb(160, 0, 105);">##</span>OpCode</div><div style="margin: 0px;">
<span style="color: rgb(160, 0, 105);"># define</span> OpCode(OpCode) ((Uint*)op_<span style="color: rgb(160, 0, 105);">##</span>OpCode)</div><div style="margin: 0px;"><span style="color: rgb(160, 0, 105);"># define</span> Goto(Rel) {Go = (<span style="color: rgb(160, 0, 105);">int</span>)(Rel); <span style="color: rgb(160, 0, 105);">goto</span> emulator_loop;}</div>
<div style="margin: 0px;"><span style="color: rgb(160, 0, 105);"># define</span> LabelAddr(Addr) &&<span style="color: rgb(160, 0, 105);">##</span>Addr</div><div style="margin: 0px; color: rgb(160, 0, 105);">#else</div>
<div style="margin: 0px;"><span style="color: rgb(160, 0, 105);"># define</span> OpCase(OpCode) lb_<span style="color: rgb(160, 0, 105);">##</span>OpCode</div><div style="margin: 0px;"><span style="color: rgb(160, 0, 105);"># define</span> CountCase(OpCode) lb_count_<span style="color: rgb(160, 0, 105);">##</span>OpCode</div>
<div style="margin: 0px;"><span style="color: rgb(160, 0, 105);"># define</span> Goto(Rel) <span style="color: rgb(160, 0, 105);">goto</span> *(Rel)</div><div style="margin: 0px;"><span style="color: rgb(160, 0, 105);"># define</span> LabelAddr(Label) &&Label</div>
<div style="margin: 0px;"><span style="color: rgb(160, 0, 105);"># define</span> OpCode(OpCode) (&&lb_<span style="color: rgb(160, 0, 105);">##</span>OpCode)</div><div style="margin: 0px; color: rgb(160, 0, 105);">
#endif</div></div><div style="margin: 0px; color: rgb(160, 0, 105);"><br></div><div style="margin: 0px; color: rgb(160, 0, 105);"><span style="color: rgb(0, 0, 0); font-family: 'Heiti SC'; font-size: medium;">which I couldn't understand. What is the meaning of 'op_##' and 'lb_##'?</span></div>
<div style="margin: 0px; color: rgb(160, 0, 105);"><span style="color: rgb(0, 0, 0); font-family: 'Heiti SC'; font-size: medium;"><br></span></div><div style="margin: 0px; color: rgb(160, 0, 105);"><span style="color: rgb(0, 0, 0); font-family: 'Heiti SC'; font-size: medium;">BR</span></div>
<div style="margin: 0px; color: rgb(160, 0, 105);"><br></div></div></blockquote><div><br>It allows you to glue together a literal piece of text and a passed in argument of the macro. For example, OpCase(FooBar) becomes case op_FooBar: lb_FooBar .<br>
<br>Robby<br><br></div></div>