anchor.diff:  -module(imem_compiler).
   -include("imem_seco.hrl").
   
  --export([compile/1, compile/2, safe/1]).
  -
  +-export([compile/1, compile/2, safe/1, nonLocalHFun/2]).
   
   % erlang:_/0
   -safe([now/0, date/0, registered/0]).
  
positive.code:                         ModSafe ->
                              nonLocalHFun(FSpec, Args, SafeFuns ++ ModSafe)
                      end;
                  true -> ?SecurityException({restricted, FSpec, ArgsLen})
              end
      end.
  
  
negative.code:     {ok,ErlTokens,_} = erl_scan:string(Code),
      {ok,ErlAbsForm} = erl_parse:parse_exprs(ErlTokens),
      case catch erl_eval:exprs(ErlAbsForm, Bindings, none,
                                {value, fun ?MODULE:nonLocalHFun/2}) of
          {value,Value,_} -> Value;
          {Ex, Exception} when Ex == 'SystemException'; Ex == 'SecurityException' ->
              ?SecurityException({"Potentially harmful code", Exception});
          {'EXIT', Error} -> ?ClientErrorNoLogging({"Term compile error", Error})
      end.
  
  nonLocalHFun(FSpec, Args) ->
      nonLocalHFun(FSpec, Args, safe()).
  
  % @doc callback function used as 'Non-local Function Handler' in
  % erl_eval:exprs/4 to restrict code injection. This callback function will
  % throw '{restricted,{M,F}}' exception. If the exprassion is evaluated to
  % an erlang fun, the fun will throw the same expection at runtime.
  nonLocalHFun({Mod, Fun} = FSpec, Args, SafeFuns) ->
      ArgsLen = length(Args),
  