Skip to content

Commit

Permalink
Merge pull request #51 from massemanet/fix-cl-warnings
Browse files Browse the repository at this point in the history
Fix cl warnings
  • Loading branch information
massemanet committed Aug 11, 2015
2 parents 5ad9270 + 17127a5 commit 2e55927
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 31 deletions.
16 changes: 8 additions & 8 deletions elisp/erlext.el
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
;; March 2002: Big cleanup for use in distributed erlang. Removed the
;; old networking code.

(require 'cl)
(eval-when-compile (require 'cl))

;; type tags

Expand Down Expand Up @@ -121,7 +121,7 @@
(defun erlext-write-obj (obj)
(cond ((listp obj) ; lists at top since (symbolp '()) => t
(if (and (memq (car obj) '(bigneg bigpos))
(ignore-errors (every #'integerp (cdr obj))))
(ignore-errors (cl-every #'integerp (cdr obj))))
;; math-bignum
(erlext-write-bignum obj)
(erlext-write-list obj)))
Expand Down Expand Up @@ -262,7 +262,7 @@
;; => (t t t t)
(defun erlext-encode-ieee-double (n)
;; Ref: http://en.wikipedia.org/wiki/Double-precision_floating-point_format
(labels ((fill-mantissa (vec frac)
(cl-labels ((fill-mantissa (vec frac)
(loop for i from 12 to 63
for tmp = (- frac (expt 0.5 (- i 11)))
when (>= tmp 0)
Expand All @@ -281,12 +281,12 @@
(when (< S 0)
(setf (aref result 0) 1))
;; Exponent & Mantissa
(cond ((isnan n) (fill result 1 :start 1 :end 64))
(cond ((isnan n) (cl-fill result 1 :start 1 :end 64))
((member S '(1.0e+INF -1.0e+INF))
(fill result 1 :start 1 :end 12)
(fill result 0 :start 12 :end 64))
(cl-fill result 1 :start 1 :end 12)
(cl-fill result 0 :start 12 :end 64))
((zerop E) ; subnormals
(fill result 0 :start 1 :end 12)
(cl-fill result 0 :start 1 :end 12)
(fill-mantissa result S))
;; Move factor 2 to S so that S >= 1.0
(t (loop for x = (+ (1- E) bias) then (ash x -1)
Expand Down Expand Up @@ -467,7 +467,7 @@
;; (mapcar #'test '(1.0e+INF -1.0e+INF -12.2 1.0000000000000004)))
;; => (t t t t)
(defun erlext-read-ieee-double ()
(labels ((to-bits (byte)
(cl-labels ((to-bits (byte)
(nreverse (loop repeat 8
collect (prog1 (logand byte 1)
(setq byte (ash byte -1)))))))
Expand Down
4 changes: 3 additions & 1 deletion elisp/mcase.el
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,9 @@ Sequence: (pat1 ...), [pat1 ...]
((vectorp pattern)
(if (and (vectorp object)
(= (length pattern) (length object)))
(mcase-match (coerce pattern 'list) (coerce object 'list) bindings)
(mcase-match (cl-coerce pattern 'list)
(cl-coerce object 'list)
bindings)
'fail))
(t
'fail))))
Expand Down
23 changes: 1 addition & 22 deletions src/distel.erl
Original file line number Diff line number Diff line change
Expand Up @@ -516,15 +516,6 @@ debug_subscriber(Pid) ->
end,
debug_subscriber(Pid).

debug_format(Pid, {M,F,A}, Status, Info) ->
debug_format_row(to_list(fmt("~w", [Pid])),
to_list(fmt("~p:~p/~p", [M,F,length(A)])),
to_list(fmt("~w", [Status])),
to_list(fmt("~w", [Info]))).

debug_format_row(Pid, MFA, Status, Info) ->
fmt("~-12s ~-21s ~-9s ~-21s~n", [Pid, MFA, Status, Info]).

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% re-implementation of some int.erl functions

Expand Down Expand Up @@ -750,7 +741,6 @@ free_vars(Text) ->
free_vars(Text, StartLine) ->
%% StartLine/EndLine may be useful in error messages.
{ok, Ts, EndLine} = erl_scan:string(Text, StartLine),
%%Ts1 = reverse(strip(reverse(Ts))),
Ts2 = [{'begin', 1}] ++ Ts ++ [{'end', EndLine}, {dot, EndLine}],
case erl_parse:parse_exprs(Ts2) of
{ok, Es} ->
Expand All @@ -762,17 +752,6 @@ free_vars(Text, StartLine) ->
{error, fmt("~s", [Reason])}
end.

strip([{',', _} | Ts]) -> strip(Ts);
strip([{';', _} | Ts]) -> strip(Ts);
strip([{'.', _} | Ts]) -> strip(Ts);
strip([{'|', _} | Ts]) -> strip(Ts);
strip([{'=', _} | Ts]) -> strip(Ts);
strip([{'dot', _} | Ts]) -> strip(Ts);
strip([{'->', _} | Ts]) -> strip(Ts);
strip([{'||', _} | Ts]) -> strip(Ts);
strip([{'of', _} | Ts]) -> strip(Ts);
strip(Ts) -> Ts.

%% ----------------------------------------------------------------------
%% Online documentation
%% ----------------------------------------------------------------------
Expand Down Expand Up @@ -1055,7 +1034,7 @@ who_calls(Mm, Fm, Am) ->
{ok, Calls} = xref_query(XREF),
append([[xform(M,F,A,L) || L <- Ls] || {{{{M,F,A},_},_}, Ls} <- Calls])
catch _:_ ->
{error,not_found}
{error,{who_calls,"try rebuilding callgraph (C-c C-d W)"}}
end.

xform(M, F, A, L) ->
Expand Down

0 comments on commit 2e55927

Please sign in to comment.