comparison lisp/calc/calc-vec.el @ 41271:fcd507927105

Change all toplevel `setq' forms to `defvar' forms, and move them before their first use. Use `when', `unless'. Remove trailing periods from error forms. Add description and headers suggested by Emacs Lisp coding conventions.
author Colin Walters <walters@gnu.org>
date Mon, 19 Nov 2001 07:43:43 +0000
parents 73f364fd8aaa
children f4d68f97221e
comparison
equal deleted inserted replaced
41270:711f18abaf57 41271:fcd507927105
1 ;; Calculator for GNU Emacs, part II [calc-vec.el] 1 ;;; calc-vec.el --- vector functions for Calc
2
2 ;; Copyright (C) 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc. 3 ;; Copyright (C) 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc.
3 ;; Written by Dave Gillespie, daveg@synaptics.com. 4
5 ;; Author: David Gillespie <daveg@synaptics.com>
6 ;; Maintainer: Colin Walters <walters@debian.org>
4 7
5 ;; This file is part of GNU Emacs. 8 ;; This file is part of GNU Emacs.
6 9
7 ;; GNU Emacs is distributed in the hope that it will be useful, 10 ;; GNU Emacs is distributed in the hope that it will be useful,
8 ;; but WITHOUT ANY WARRANTY. No author or distributor 11 ;; but WITHOUT ANY WARRANTY. No author or distributor
17 ;; supposed to have been given to you along with GNU Emacs so you 20 ;; supposed to have been given to you along with GNU Emacs so you
18 ;; can know your rights and responsibilities. It should be in a 21 ;; can know your rights and responsibilities. It should be in a
19 ;; file named COPYING. Among other things, the copyright notice 22 ;; file named COPYING. Among other things, the copyright notice
20 ;; and this notice must be preserved on all copies. 23 ;; and this notice must be preserved on all copies.
21 24
22 25 ;;; Commentary:
26
27 ;;; Code:
23 28
24 ;; This file is autoloaded from calc-ext.el. 29 ;; This file is autoloaded from calc-ext.el.
25 (require 'calc-ext) 30 (require 'calc-ext)
26 31
27 (require 'calc-macs) 32 (require 'calc-macs)
31 36
32 (defun calc-display-strings (n) 37 (defun calc-display-strings (n)
33 (interactive "P") 38 (interactive "P")
34 (calc-wrapper 39 (calc-wrapper
35 (message (if (calc-change-mode 'calc-display-strings n t t) 40 (message (if (calc-change-mode 'calc-display-strings n t t)
36 "Displaying vectors of integers as quoted strings." 41 "Displaying vectors of integers as quoted strings"
37 "Displaying vectors of integers normally.")))) 42 "Displaying vectors of integers normally"))))
38 43
39 44
40 (defun calc-pack (n) 45 (defun calc-pack (n)
41 (interactive "P") 46 (interactive "P")
42 (calc-wrapper 47 (calc-wrapper
202 (list 'calcFunc-float (car items)) 207 (list 'calcFunc-float (car items))
203 (nth 1 items))))) 208 (nth 1 items)))))
204 (t 209 (t
205 (error "Invalid packing mode: %d" mode)))) 210 (error "Invalid packing mode: %d" mode))))
206 211
212 (defvar calc-unpack-with-type nil)
207 (defun calc-unpack (mode) 213 (defun calc-unpack (mode)
208 (interactive "P") 214 (interactive "P")
209 (calc-wrapper 215 (calc-wrapper
210 (let ((calc-unpack-with-type t)) 216 (let ((calc-unpack-with-type t))
211 (calc-pop-push-record-list 1 "unpk" (calc-unpack-item 217 (calc-pop-push-record-list 1 "unpk" (calc-unpack-item
326 (if (eq (car-safe item) 'float) 332 (if (eq (car-safe item) 'float)
327 (list (calcFunc-mant item) (calcFunc-xpon item)) 333 (list (calcFunc-mant item) (calcFunc-xpon item))
328 (error "Expected a floating-point number"))) 334 (error "Expected a floating-point number")))
329 (t 335 (t
330 (error "Invalid unpacking mode: %d" mode)))) 336 (error "Invalid unpacking mode: %d" mode))))
331 (setq calc-unpack-with-type nil)
332 337
333 (defun calc-diag (n) 338 (defun calc-diag (n)
334 (interactive "P") 339 (interactive "P")
335 (calc-wrapper 340 (calc-wrapper
336 (calc-enter-result 1 "diag" (if n 341 (calc-enter-result 1 "diag" (if n