Permalink
Browse files

fix most unused var warnings

  • Loading branch information...
1 parent 268f369 commit caeb26374d114feba59a48d63f5f5925b71e9b22 @gleber committed Apr 23, 2012
View
@@ -1,7 +1,6 @@
{deps_dir, ["lib"]}.
%% {sub_dirs, ["examples/simple"]}.
%% {erl_opts, [{src_dirs, ["examples/simple"]}]}.
-{erl_opts, [nowarn_unused_vars]}.
{deps, [{misultin, "0.9-dev", {git, "https://github.com/gleber/misultin.git", "master"}},
{seresye, "0.0.4", {git, "https://github.com/gleber/seresye.git", "master"}}
]}.
View
@@ -50,7 +50,7 @@ erl_to_sl0([Head | Tail], Acc) ->
true -> Head
end,
erl_to_sl0(Tail, [" ", ZHead | Acc]);
-erl_to_sl0(Value, Acc) when is_atom(Value) ->
+erl_to_sl0(Value, _Acc) when is_atom(Value) ->
atom_to_list(Value).
%%%
@@ -69,9 +69,9 @@ sl0_parse(M) ->
%% returns {error, ErrorCond} or {ok, Terms}
-sl0_getslot(SearchedSlotname, []) -> ?ACL_ANY;
+sl0_getslot(_SearchedSlotname, []) -> ?ACL_ANY;
sl0_getslot(SearchedSlotname,
- [{SlotName, SlotValue} | MessageTail])
+ [{SlotName, SlotValue} | _MessageTail])
when SlotName == SearchedSlotname ->
SlotValue;
sl0_getslot(SearchedSlotname, [_ | MessageTail]) ->
@@ -120,8 +120,7 @@ translate_agent_identifier(ID = ['agent-identifier'
translate_agent_identifier(ID) -> ID.
translate_receiver_agent_identifier([set | Set]) ->
- FIPA_ID_Set = [sl_to_erlang_agent_identifier(X)
- || X <- Set];
+ [sl_to_erlang_agent_identifier(X) || X <- Set];
translate_receiver_agent_identifier(ID) ->
translate_agent_identifier(ID).
View
@@ -25,7 +25,7 @@
-export([scan/1]).
-scan([], Acc, Tokens) -> lists:reverse(Tokens);
+scan([], _Acc, Tokens) -> lists:reverse(Tokens);
scan([$( | L], [], Tokens) ->
scan(L, [], ["(" | Tokens]);
scan([$( | L], Acc, Tokens) ->
View
@@ -38,19 +38,19 @@ skiptoquote([H | T], Acc) -> skiptoquote(T, Acc ++ [H]).
scan([], L) -> accumulate(L);
scan([32], L) -> accumulate(L);
scan([$(], L) ->
- [Tokens, Acc] = accumulate(L), [Tokens ++ ["("], []];
+ [Tokens, _Acc] = accumulate(L), [Tokens ++ ["("], []];
scan([$)], L) ->
- [Tokens, Acc] = accumulate(L), [Tokens ++ [")"], []];
+ [Tokens, _Acc] = accumulate(L), [Tokens ++ [")"], []];
scan([L], L2) ->
[Tokens, Acc] = L2, [Tokens ++ [Acc ++ [L]], []];
scan([$( | T], L) ->
- [Tokens, Acc] = accumulate(L),
+ [Tokens, _Acc] = accumulate(L),
scan(T, [Tokens ++ ["("], []]);
scan([$) | T], L) ->
- [Tokens, Acc] = accumulate(L),
+ [Tokens, _Acc] = accumulate(L),
scan(T, [Tokens ++ [")"], []]);
scan([$\s, $: | T], L) ->
- [Tokens, Acc] = accumulate(L),
+ [Tokens, _Acc] = accumulate(L),
scan(T, [Tokens ++ [":"], []]);
%%scan ([$ |T], L) ->
%% [Tokens, Acc] = accumulate (L),
@@ -60,22 +60,22 @@ scan([H | T], L) ->
case H of
32 -> L2 = accumulate(L), T2 = T;
34 ->
- [Tokens2, Acc2] = accumulate(L),
+ [Tokens2, _Acc2] = accumulate(L),
[H2, T2] = skiptoquote(T, []),
L2 = [Tokens2 ++ [H2], []];
- Other -> L2 = [Tokens, Acc ++ [H]], T2 = T
+ _ -> L2 = [Tokens, Acc ++ [H]], T2 = T
end,
scan(T2, L2).
-scan(P) -> [Tokens, Acc] = scan(P, [[], []]), Tokens.
+scan(P) -> [Tokens, _Acc] = scan(P, [[], []]), Tokens.
token(X) ->
case X of
[$(] -> {'(', 1};
[$)] -> {')', 1};
[$:] -> {':', 1};
[$\s] -> {' ', 1};
- Other -> {atom, list_to_atom(X), 1}
+ _ -> {atom, list_to_atom(X), 1}
end.
tokenize([L]) -> [token(L), {'$end', 1}];
@@ -39,7 +39,7 @@
%% Function: compile/2
%% Description: Compiles an ontology file
%%====================================================================
-compile(FileName, Options) ->
+compile(FileName, _Options) ->
{ok, AbstractErlangForm} = epp:parse_file(FileName ++
".onto",
"", []),
@@ -113,8 +113,8 @@ compile_lines(Accumulator, OntoName,
compile_lines(Accumulator, OntoName,
[{attribute, _, ontology, OntoName} | Tail]) ->
compile_lines(Accumulator, OntoName, Tail);
-compile_lines(Accumulator, OntoName,
- [{attribute, Line, ontology, _} | Tail]) ->
+compile_lines(_Accumulator, _OntoName,
+ [{attribute, Line, ontology, _} | _Tail]) ->
{error,
{"ontology name does not match with filename "
"in line",
@@ -125,8 +125,8 @@ compile_lines(Accumulator, OntoName,
compile_lines(Accumulator, OntoName,
[{eof, _} | Tail]) ->
compile_lines(Accumulator, OntoName, Tail);
-compile_lines(Accumulator, _,
- [{_, Line, _, _} | Tail]) ->
+compile_lines(_Accumulator, _,
+ [{_, Line, _, _} | _Tail]) ->
{error, {"syntax error in line", Line}}.
%%====================================================================
@@ -145,18 +145,18 @@ compile_clauses(Acc, [H | T]) ->
%% given its erlang abstract form
%% Returns: #ontology_class
%%====================================================================
-compile_clause({clause, LineNum, [{atom, _, ClassName}],
+compile_clause({clause, _LineNum, [{atom, _, ClassName}],
[], [{tuple, _, ClassDef}]}) ->
#ontology_class{name = ClassName, superclass = nil,
properties =
compile_properties([], ClassName, ClassDef)};
-compile_clause({clause, LineNum, [{atom, _, ClassName}],
+compile_clause({clause, _LineNum, [{atom, _, ClassName}],
[],
[{call, _, {atom, _, is_a},
[{atom, _, SuperClass}]}]}) ->
#ontology_class{name = ClassName,
superclass = SuperClass, properties = []};
-compile_clause({clause, LineNum, [{atom, _, ClassName}],
+compile_clause({clause, _LineNum, [{atom, _, ClassName}],
[],
[{call, _, {atom, _, is_a}, [{atom, _, SuperClass}]},
{tuple, _, ClassDef}]}) ->
@@ -183,7 +183,7 @@ compile_properties(Acc, ClassName, [H | T]) ->
%% given the erlang abstract form
%% Returns: #ontology_property
%%====================================================================
-compile_property(ClassName,
+compile_property(_ClassName,
{match, _, {atom, _, FieldName}, FieldDef}) ->
L = cons_to_erl_list(FieldDef),
%%io:format ("~p~n", [L]),
@@ -198,7 +198,7 @@ compile_property(ClassName,
%% Description: transforms a "cons" abstract erlang construct to a list
%% Returns: [term()]
%%====================================================================
-cons_to_erl_list({cons, Line, OP1, OP2}) ->
+cons_to_erl_list({cons, _Line, OP1, OP2}) ->
[cons_decode(OP1) | cons_to_erl_list(OP2)];
cons_to_erl_list(X) -> [cons_decode(X)].
@@ -291,7 +291,7 @@ resolve_inheritance(Acc, Classes, [Class | T]) ->
override_property(Acc, [], _) -> lists:reverse(Acc);
override_property(Acc,
- [P = #ontology_property{name = N} | T],
+ [#ontology_property{name = N} | T],
Property = #ontology_property{name = N}) ->
override_property([Property | Acc], T, Property);
override_property(Acc, [P | T], Property) ->
@@ -302,9 +302,9 @@ override_property(Acc, [P | T], Property) ->
%% Description: Searches for a class in the list
%% Returns: #ontology_class
%%====================================================================
-get_class(ClassName, []) -> nil;
+get_class(_ClassName, []) -> nil;
get_class(ClassName,
- [Class = #ontology_class{name = ClassName} | T]) ->
+ [Class = #ontology_class{name = ClassName} | _T]) ->
Class;
get_class(ClassName, [_ | T]) ->
get_class(ClassName, T).
@@ -322,7 +322,7 @@ generate_hierarchy_tree(Acc, [Class | T], Classes) ->
Classes)},
generate_hierarchy_tree([Item | Acc], T, Classes).
-ancestors_list(Acc, nil, Classes) -> lists:reverse(Acc);
+ancestors_list(Acc, nil, _Classes) -> lists:reverse(Acc);
ancestors_list(Acc, X, Classes) ->
C = get_class(X, Classes),
ancestors_list([X | Acc], C#ontology_class.superclass,
@@ -412,7 +412,7 @@ generate_childof(Acc,
generate_is_a(Acc, []) ->
lists:flatten(lists:reverse(["is_a (_,_) -> false.\n\n"
| Acc]));
-generate_is_a(Acc, [{ClassName, []} | T]) ->
+generate_is_a(Acc, [{_ClassName, []} | T]) ->
generate_is_a(Acc, T);
generate_is_a(Acc, [{ClassName, Ancestors} | T]) ->
Line =
@@ -442,7 +442,7 @@ generate_is_class(Acc, [{ClassName, _} | T]) ->
%%====================================================================
generate_cast({Acc1, Acc2}, [], _) ->
{lists:reverse(Acc1), lists:reverse(Acc2)};
-generate_cast({Acc1, Acc2}, [{ClassName, []} | T],
+generate_cast({Acc1, Acc2}, [{_ClassName, []} | T],
ResolvedClasses) ->
generate_cast({Acc1, Acc2}, T, ResolvedClasses);
generate_cast({Acc1, Acc2}, [{ClassName, Children} | T],
@@ -83,6 +83,6 @@ substitute(L, Pred, New) ->
case catch erl_eval:exprs(Expr, erl_eval:new_bindings())
of
{'EXIT', _} -> false;
- {value, Value, Bindings} -> Value;
+ {value, Value, _Bindings} -> Value;
_ -> false
end.
View
@@ -20,7 +20,7 @@
{application, exat,
[{ mod, { exat, [] } },
{ vsn, "1.5.0" },
- { applications, [kernel, stdlib] },
+ { applications, [kernel, stdlib, seresye] },
{ description, "erlang eXperimental Agent Tool" },
{ registered, [] }
]}.
View
@@ -58,14 +58,14 @@
%% {ok, Pid, State} |
%% {error, Reason}
%%====================================================================
-start(Type, StartArgs) ->
+start(_Type, _StartArgs) ->
exat_sup:start_link().
%%====================================================================
%% Func: stop/1
%% Returns: any
%%====================================================================
-stop(State) -> ok.
+stop(_State) -> ok.
%%====================================================================
%% Func: current_platform/0
View
@@ -76,7 +76,7 @@ init([]) ->
{ok, [[ThePort]]} -> Port = list_to_integer(ThePort);
_ -> Port = (?DEFAULT_PORT)
end,
- {ok, Pid} = seresye:start(agent_registry),
+ {ok, _Pid} = seresye:start(agent_registry),
MTP = {exat_platform, {exat_server, start_link, [Port]},
permanent, brutal_kill, supervisor, [exat_server]},
MTP_SENDER = {mtp_sender_service,
@@ -28,13 +28,11 @@
extends() -> semantics.
-is_feasible(Self, Agent, KB,
- AclMessage = #aclmessage{speechact = 'INFORM'}) ->
+is_feasible(_Self, _Agent, _KB, #aclmessage{speechact = 'INFORM'}) ->
%%io:format ("[Agent: ~w] Doing FP test on ~w\n", [Agent, AclMessage]),
true.
-rational_effect(Self, Agent, KB,
- AclMessage = #aclmessage{speechact = 'INFORM'}) ->
+rational_effect(_Self, _Agent, KB, AclMessage = #aclmessage{speechact = 'INFORM'}) ->
%%io:format ("[Agent: ~w] Performing RE on ~p\n", [Agent, AclMessage]),
seresye:assert(KB, AclMessage#aclmessage.content),
true.
View
@@ -99,10 +99,10 @@ handle_info(Info, State) ->
%% Func: terminate/2
%% Returns: ok
%%====================================================================
-terminate(Args, State) -> ok.
+terminate(_Args, _State) -> ok.
%%====================================================================
%% Func: code_change/3
%% Returns: {ok, NewState}
%%====================================================================
-code_change(OldVsn, State, _) -> {ok, State}.
+code_change(_OldVsn, State, _) -> {ok, State}.
View
@@ -36,8 +36,8 @@ match_atoms(Atom1, Atom2) ->
%%matches lists
match_lists([], []) -> true;
match_lists([L1], [L2]) -> match_atoms(L1, L2);
-match_lists([L], [H | T]) -> false;
-match_lists([H | T], [L]) -> false;
+match_lists([_L], [_H | _T]) -> false;
+match_lists([_H | _T], [_L]) -> false;
match_lists([H1 | T1], [H2 | T2]) ->
X = match_atoms(H1, H2),
if X -> match_lists(T1, T2);
@@ -59,7 +59,7 @@ match_all(Fact1, Fact2) ->
%%example:
%% match_lib:match_acl ({aclmessage,infom,nil,..,..,..,..}).
%%
-match_acl([], Data) -> false;
+match_acl([], _Data) -> false;
match_acl([Clause | Clauses], Data) ->
Match = match_all(Clause, Data),
if Match -> true;
View
@@ -83,7 +83,7 @@ handle_http(Req) ->
Req:resource([lowercase, urldecode]), Req:get(headers),
Req).
-http_mtp_post('POST', Url, Headers, Req) ->
+http_mtp_post('POST', _Url, _Headers, Req) ->
%%io:format ("URL = ~s~n", [Url]),
%%display_params (Headers),
Content = Req:parse_post(),
@@ -93,11 +93,11 @@ http_mtp_post('POST', Url, Headers, Req) ->
|| V2 <- Content, http_mtp_post_2(V2)],
http_mtp_decode(Req, XmlContent, SLContent).
-http_mtp_post_1({part, H, D}) ->
+http_mtp_post_1({part, H, _D}) ->
"application/xml" ==
misultin_utility:header_get_value('Content-Type', H).
-http_mtp_post_2({part, H, D}) ->
+http_mtp_post_2({part, H, _D}) ->
"application/text" ==
misultin_utility:header_get_value('Content-Type', H).
@@ -220,10 +220,10 @@ http_mtp_encode_and_send(To, From, Message) ->
{ok, RequestID} = HTTPID,
Result = RequestID,
%%io:format ("Result ~p, ~p~n", [self (), Result]),
- {StatusLine, ReceivedHeaders, ReceivedBody} = Result,
+ {StatusLine, _ReceivedHeaders, _ReceivedBody} = Result,
%%io:format ("Status ~w,~s~n", [StatusCode, ReasonPhrase]),
%%io:format ("Body ~s~n", [ReceivedBody]).
- {HttpVersion, StatusCode, ReasonPhrase} = StatusLine.
+ {_HttpVersion, _StatusCode, _ReasonPhrase} = StatusLine.
%%====================================================================
%% Func: init/1
@@ -233,7 +233,7 @@ init(_) -> {ok, []}.
%%====================================================================
%% Func: handle_call/3
%%====================================================================
-handle_call({http_post, Request}, From, State) ->
+handle_call({http_post, Request}, _From, State) ->
HTTPID = httpc:request(post, Request, [],
[{sync, true}]),
{reply, HTTPID, State}.
@@ -246,4 +246,4 @@ terminate(_, _) -> ok.
%%====================================================================
%% Func: code_change/3
%%====================================================================
-code_change(OldVsn, State, Extra) -> {ok, State}.
+code_change(_OldVsn, State, _Extra) -> {ok, State}.
Oops, something went wrong.

0 comments on commit caeb263

Please sign in to comment.