[erlang-questions] macro - newbie question

Balathasan Sayanthan bsayanthan@REDACTED
Wed Apr 2 15:24:56 CEST 2008


Hi,

I tried do the following using macros
///////////////////////////////////////
-module(trial).
-include("xx.hrl").

getval(OpId) ->
    Oe = ?OP_NAME(OpId),
    {ok, Oe}.

////////////////////////////////////////

and within the xx.hrl

i have some thing like

-define(OP_NAME(OpId),
        if
...............
...............
        end).


when I try to compile the  i get an error
./trial.erl:7: syntax error before: 'end'
./trial.erl:3: function getval/1 undefined

Please let me know how I should use macros in this way.

regards,



-- 
Balathasan Sayanthan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080402/d2c5a420/attachment.htm>


More information about the erlang-questions mailing list