blob: 4b8206d08ba2f2065766328699aba86d2e08b818 [file] [log] [blame]
% ---------------------------------------------------------------------------
% Copyright (C) 2008 0x6e6562
%
% Licensed under the Apache License, Version 2.0 (the "License");
% you may not use this file except in compliance with the License.
% You may obtain a copy of the License at
%
% http://www.apache.org/licenses/LICENSE-2.0
%
% Unless required by applicable law or agreed to in writing, software
% distributed under the License is distributed on an "AS IS" BASIS,
% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
% See the License for the specific language governing permissions and
% limitations under the License.
% ---------------------------------------------------------------------------
-ifndef(HESSIAN_H).
-define(HESSIAN_H,1).
-define(M, 2).
-define(m, 0).
-define(CHUNK_SIZE, 1024).
-define(MegaSeconds, 1000000000).
-define(Seconds, 1000).
-define(MicroSeconds, 1000).
-define(UnixEpoch, 62167219200).
%% Equivalents: type_def and class
-record(type_def,{defineNo=-1,native_type, foreign_type, fieldnames}).
-record(class, {typeNo=-1, encoded=false, name=[], fields=[]}).
-record(list, {refNo=-1, len=-1, type=untyped, values=[]}).
-record(map, {refNo=-1, type=untyped, dict=dict:new()}).
-record(object, {refNo=-1, typeRef=-1, class=auto, values=[]}).
-record(set, {ref=-1, value=[]}).
-ifdef(DEBUG).
% Application Logging
-define(LOG(Msg), io:format("{~p:~p}: ~p~n", [?MODULE, ?LINE, Msg])).
-define(ERROR(Error,Reason), io:format("Error @ ~p:~p: ~p (Reason: ~p)~n", [?MODULE, ?LINE,Error,Reason])).
% Protocol Logging
-define(START(Msg,Value), io:format("~s -> ~p~n", [Msg,Value])).
-define(METHOD(Value), io:format("\tMethod -> ~p~n", [ binary_to_list(Value) ] )).
-define(VALUE(Value), io:format("\t\tValue -> ~p~n", [ Value ] )).
-define(TYPEDEF(Value), io:format("\t\tTypeDef -> ~p~n", [ Value ] )).
-define(INSTANCE(Value), io:format("\t\tInstance -> ~p~n", [ Value ] )).
-else.
% Application Logging
-define(LOG(Msg), true).
-define(ERROR(Msg), true).
% Protocol Logging
-define(START(Msg,Value), true).
-define(METHOD(Value), true).
-define(VALUE(Value), true).
-define(TYPEDEF(Value), true).
-define(INSTANCE(Value), true).
-endif.
-endif.