Commit daa37602 authored by Jim Blandy's avatar Jim Blandy

*** empty log message ***

parent a4275ad1
......@@ -410,7 +410,7 @@ DEFINEST definedef;
* for self-documentation only.
*/
#define LEVEL_OK_FOR_FUNCDEF() \
(level==0 || c_ext && level==1 && structdef==sinbody)
(level==0 || (c_ext && level==1 && structdef==sinbody))
/*
* next_token_is_func
......@@ -1283,7 +1283,7 @@ put_entries (node)
fprintf (stdout, "%s %s %d\n",
node->name, node->file, (node->lno + 63) / 64);
else
fprintf (stdout, "%-16s%4d %-16s %s\n",
fprintf (stdout, "%-16s %3d %-16s %s\n",
node->name, node->lno, node->file, node->pat);
/* Output subentries that follow this one */
......@@ -1468,7 +1468,8 @@ C_entries (c_ext)
{
if (c == '"')
inquote = FALSE;
continue;
else if (c == '\\')
c = *lp++;
}
else if (inchar)
{
......@@ -1493,7 +1494,8 @@ C_entries (c_ext)
}
else if (c_ext && *lp == '/')
{
c = 0; /* C++ comment: skip rest of line */
c = 0;
break;
}
continue;
case '#':
......@@ -1886,7 +1888,10 @@ consider_token (c, lpp, tokp, is_func, c_ext, level)
/* Detect GNUmacs's function-defining macros. */
if (definedef == dnone)
{
if (strneq (tokp->p, "DEF", 3))
if (strneq (tokp->p, "DEF", 3)
|| strneq (tokp->p, "ENTRY", 5)
|| strneq (tokp->p, "SYSCALL", 7)
|| strneq (tokp->p, "PSEUDO", 6))
{
next_token_is_func = TRUE;
goto badone;
......@@ -2084,7 +2089,10 @@ getit ()
while (isspace (*dbp))
dbp++;
if (*dbp == 0 || (!isalpha (*dbp)) && (*dbp != '_') && (*dbp != '$'))
if (*dbp == 0
|| (!isalpha (*dbp)
&& *dbp != '_'
&& *dbp != '$'))
return;
for (cp = dbp + 1; *cp && (isalpha (*cp) || isdigit (*cp)
|| (*cp == '_') || (*cp == '$')); cp++)
......
......@@ -59,14 +59,29 @@ the section of autoloads for a file.")
(defconst generate-autoload-section-trailer "\n;;;***\n"
"String which indicates the end of the section of autoloads for a file.")
;; Forms which have doc-strings which should be printed specially.
;; A doc-string-elt property of ELT says that (nth ELT FORM) is
;; the doc-string in FORM.
;; Note: defconst and defvar should NOT be marked in this way.
;; We don't want to produce defconsts and defvars that make-docfile can
;; grok, because then it would grok them twice, once in foo.el (where they
;; are given with ;;;###autoload) and once in loaddefs.el.
;;; Forms which have doc-strings which should be printed specially.
;;; A doc-string-elt property of ELT says that (nth ELT FORM) is
;;; the doc-string in FORM.
;;;
;;; There used to be the following note here:
;;; ;;; Note: defconst and defvar should NOT be marked in this way.
;;; ;;; We don't want to produce defconsts and defvars that
;;; ;;; make-docfile can grok, because then it would grok them twice,
;;; ;;; once in foo.el (where they are given with ;;;###autoload) and
;;; ;;; once in loaddefs.el.
;;;
;;; Counter-note: Yes, they should be marked in this way.
;;; make-docfile only processes those files that are loaded into the
;;; dumped Emacs, and those files should never have anything
;;; autoloaded here. The above-feared problem only occurs with files
;;; which have autoloaded entries *and* are processed by make-docfile;
;;; there should be no such files.
(put 'autoload 'doc-string-elt 3)
(put 'defun 'doc-string-elt 3)
(put 'defvar 'doc-string-elt 3)
(put 'defconst 'doc-string-elt 3)
(put 'defmacro 'doc-string-elt 3)
(defun generate-file-autoloads (file)
"Insert at point a loaddefs autoload section for FILE.
......@@ -86,6 +101,21 @@ are used."
(floating-output-format "%20e")
(done-any nil)
output-end)
;; If the autoload section we create here uses an absolute
;; pathname for FILE in its header, and then Emacs is installed
;; under a different path on another system,
;; `update-autoloads-here' won't be able to find the files to be
;; autoloaded. So, if FILE is in the same directory or a
;; subdirectory of the current buffer's file, we'll make it
;; relative to the current buffer's directory.
(setq file (expand-file-name file))
(if (and (< (length default-directory) (length file))
(string= default-directory
(substring file 0 (length default-directory))))
(progn
(setq file (substring file (length default-directory)))))
(message "Generating autoloads for %s..." file)
(save-excursion
(set-buffer inbuf)
......
......@@ -175,7 +175,6 @@
;; Put edebug.el in some directory in your load-path and byte-compile it.
;; Put the following forms in your .emacs file.
;; (setq edebug-global-prefix "...whatever you want") ; default is C-xX
;; (define-key emacs-lisp-mode-map "\^Xx" 'edebug-defun)
;; (autoload 'edebug-defun "edebug")
;; (autoload 'edebug-debug "edebug")
......@@ -459,17 +458,32 @@ if an error occurs, point is left at the error."
))
;; The standard eval-current-buffer doesn't use eval-region.
(if (not (fboundp 'edebug-emacs-eval-current-buffer))
(fset 'edebug-emacs-eval-current-buffer
(symbol-function 'eval-current-buffer)))
;; (fset 'eval-current-buffer (symbol-function 'edebug-emacs-eval-current-buffer))
(defun eval-current-buffer (&optional edebug-e-c-b-output)
(defun edebug-eval-current-buffer (&optional edebug-e-c-b-output)
"Call eval-region on the whole buffer."
(interactive)
(eval-region (point-min) (point-max) edebug-e-c-b-output))
(defun edebug-eval-buffer (&optional buffer edebug-e-c-b-output)
"Call eval-region on the whole buffer."
(interactive "bEval buffer: ")
(save-excursion
(set-buffer buffer)
(eval-region (point-min) (point-max) edebug-e-c-b-output)))
;; The standard eval-current-buffer doesn't use eval-region.
(if (and (fboundp 'eval-current-buffer)
(not (fboundp 'edebug-emacs-eval-current-buffer)))
(progn
(fset 'edebug-emacs-eval-current-buffer
(symbol-function 'eval-current-buffer))
(fset 'eval-current-buffer 'edebug-eval-current-buffer)))
(if (and (fboundp 'eval-buffer)
(not (fboundp 'edebug-emacs-eval-buffer)))
(progn
(fset 'edebug-emacs-eval-buffer
(symbol-function 'eval-buffer))
(fset 'eval-buffer 'edebug-eval-buffer)))
;;;======================================================================
......@@ -498,6 +512,7 @@ if an error occurs, point is left at the error."
;;; for more details.
;;;###autoload
(defun edebug-defun ()
"Evaluate defun or defmacro, like eval-defun, but with edebug calls.
Print its name in the minibuffer and leave point after any error it finds,
......@@ -2416,6 +2431,7 @@ Global commands prefixed by global-edbug-prefix:
;; Note that debug and its utilities must be byte-compiled to work, since
;; they depend on the backtrace looking a certain way.
;;;###autoload
(defun edebug-debug (&rest debugger-args)
"Replacement for debug.
If an error or quit occurred and we are running an edebugged function,
......
......@@ -490,9 +490,11 @@ of the start of the containing expression."
If optional arg ENDPOS is given, indent each line, stopping when
ENDPOS is encountered."
(interactive)
(let ((indent-stack (list nil)) (next-depth 0) last-depth bol
outer-loop-done inner-loop-done state this-indent
(last-point (point)))
(let ((indent-stack (list nil))
(next-depth 0)
(starting-point (point))
(last-point (point))
last-depth bol outer-loop-done inner-loop-done state this-indent)
;; Get error now if we don't have a complete sexp after point.
(save-excursion (forward-sexp 1))
(save-excursion
......@@ -529,10 +531,12 @@ ENDPOS is encountered."
(setcar (nthcdr 5 state) nil))
(setq inner-loop-done t)))
(and endpos
(while (<= next-depth 0)
(setq indent-stack (append indent-stack (list nil)))
(setq next-depth (1+ next-depth))
(setq last-depth (1+ last-depth))))
(<= next-depth 0)
(progn
(setq indent-stack (append indent-stack
(make-list (- next-depth) nil))
last-depth (- last-depth next-depth)
next-depth 0)))
(or outer-loop-done
(setq outer-loop-done (<= next-depth 0)))
(if outer-loop-done
......@@ -557,7 +561,7 @@ ENDPOS is encountered."
(setq this-indent (car indent-stack))
(let ((val (calculate-lisp-indent
(if (car indent-stack) (- (car indent-stack))
last-point))))
starting-point))))
(if (integerp val)
(setcar indent-stack
(setq this-indent val))
......
......@@ -264,8 +264,10 @@ under the X Window System."
(list (cons 'horizontal-scroll-bar toggle))))
;;;; Key bindings
(define-prefix-command 'ctl-x-5-map)
(define-key ctl-x-map "5" 'ctl-x-5-map)
(defvar ctl-x-5-map (make-sparse-keymap)
"Keymap for screen commands.")
(fset 'ctl-x-5-prefix ctl-x-5-map)
(define-key ctl-x-map "5" 'ctl-x-5-prefix)
(define-key ctl-x-5-map "2" 'new-screen)
(define-key ctl-x-5-map "0" 'delete-screen)
......
;;; blackbox.el --- blackbox game in Emacs Lisp
;; Copyright (C) 1985, 1986, 1987 Free Software Foundation, Inc.
;; Copyright (C) 1985, 1986, 1987, 1992 Free Software Foundation, Inc.
;; This file is part of GNU Emacs.
;; GNU Emacs is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 1, or (at your option)
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
......@@ -114,6 +114,7 @@ The usual mnemonic keys move the cursor around the box.
(setq major-mode 'blackbox-mode)
(setq mode-name "Blackbox"))
;;;###autoload
(defun blackbox (num)
"Play blackbox. Optional prefix argument is the number of balls;
the default is 4.
......
;;; compile.el --- run compiler as inferior of Emacs, and parse its error messages.
;;; compile.el --- run compiler as inferior of Emacs, parse error messages.
;;;!!! dup removal is broken.
......@@ -84,21 +84,24 @@ are found.")
("^\\([^:( \t\n]+\\)[:( \t]+\\([0-9]+\\)[:) \t]" 1 2)
;; 4.3BSD lint pass 2
;; strcmp: variable # of args. llib-lc(359) :: /usr/src/foo/foo.c(8)
("[ \t:]+\\([^:( \t\n]+\\)[ \t]*[:(]+[ \t]*\\([0-9]+\\)[:) \t]*$" 1 2)
("[ \t:]+\\([^:( \t\n]+\\)[ \t]*[:(]*(+[ \t]*\\([0-9]+\\))[:) \t]*$" 1 2)
;; 4.3BSD lint pass 3
;; bloofle defined( /users/wolfgang/foo.c(4) ), but never used
("[ \t(]+\\([^:( \t\n]+\\)[:( \t]+\\([0-9]+\\)[:) \t]+" 1 2)
;; This used to be
;; ("[ \t(]+\\([^:( \t\n]+\\)[:( \t]+\\([0-9]+\\)[:) \t]+" 1 2)
;; which is regexp Impressionism - it matches almost anything!
("([ \t]*\\([^:( \t\n]+\\)[ \t]*[:(][ \t]*\\([0-9]+\\))" 1 2)
;; Line 45 of "foo.c": bloofel undefined (who does this?)
("^[Ll]ine[ \t]+\\([0-9]+\\)[ \t]+of[ \t]+\"\\([^\"]+\\)\":" 2 1)
("^[Ll]ine[ \t]+\\([0-9]+\\)[ \t]+of[ \t]+\"\\([^\"\n]+\\)\":" 2 1)
;; Apollo cc, 4.3BSD fc
;; "foo.f", line 3: Error: syntax error near end of statement
("^\"\\([^\"]+\\)\", line \\([0-9]+\\):" 1 2)
("^\"\\([^\"\n]+\\)\", line \\([0-9]+\\):" 1 2)
;; HP-UX 7.0 fc
;; foo.f :16 some horrible error message
("\\([^ \t:]+\\)[ \t]*:\\([0-9]+\\)" 1 2)
("^\\([^ \t\n:]+\\)[ \t]*:\\([0-9]+\\)" 1 2)
;; IBM AIX PS/2 C version 1.1
;; ****** Error number 140 in line 8 of file errors.c ******
("in line \\([0-9]+\\) of file \\([^ ]+[^. ]\\)\\.? " 2 1)
("in line \\([0-9]+\\) of file \\([^ \n]+[^. \n]\\)\\.? " 2 1)
;; IBM AIX lint is too painful to do right this way. File name
;; prefixes entire sections rather than being on each line.
)
......@@ -132,18 +135,18 @@ Typically \"grep -n\" or \"egrep -n\".
\(The \"-n\" option tells grep to output line numbers.)")
(defconst compilation-enter-directory-regexp
": Entering directory `\\\(.*\\\)'$"
": Entering directory `\\(.*\\)'$"
"Regular expression for a line in the compilation log that
changes the current directory. This must contain one \\\(, \\\) pair
changes the current directory. This must contain one \\(, \\) pair
around the directory name.
The default value matches lines printed by the `-w' option of GNU Make.")
(defconst compilation-leave-directory-regexp
": Leaving directory `\\\(.*\\\)'$"
": Leaving directory `\\(.*\\)'$"
"Regular expression for a line in the compilation log that
changes the current directory to a previous value. This may
contain one \\\(, \\\) pair around the name of the directory
contain one \\(, \\) pair around the name of the directory
being moved from. If it does not, the last directory entered
\(by a line matching `compilation-enter-directory-regexp'\) is assumed.
......@@ -343,6 +346,8 @@ Runs `compilation-mode-hook' with `run-hooks' (which see)."
(setq omax (point-max)
opoint (point))
(goto-char omax)
;; Record where we put the message, so we can ignore it
;; later on.
(insert ?\n mode-name " " msg)
(forward-char -1)
(insert " at " (substring (current-time-string) 0 19))
......
;;; etags.el --- tags facility for Emacs.
;; Copyright (C) 1985, 1986, 1988 Free Software Foundation, Inc.
;; Copyright (C) 1985, 1986, 1988, 1992 Free Software Foundation, Inc.
;; This file is part of GNU Emacs.
;; GNU Emacs is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 1, or (at your option)
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
......@@ -244,6 +244,26 @@ See documentation of variable tags-file-name."
;;;###autoload
(define-key ctl-x-4-map "." 'find-tag-other-window)
;;;###autoload
(defun find-tag-other-frame (tagname &optional next)
"Find tag (in current tag table) whose name contains TAGNAME.
Selects the buffer that the tag is contained in in another frame
and puts point at its definition.
If TAGNAME is a null string, the expression in the buffer
around or before point is used as the tag name.
If second arg NEXT is non-nil (interactively, with prefix arg),
searches for the next tag in the tag table
that matches the tagname used in the previous find-tag.
See documentation of variable tags-file-name."
(interactive (if current-prefix-arg
'(nil t)
(find-tag-tag "Find tag other window: ")))
(let ((pop-up-screens t))
(find-tag tagname next t)))
;;;###autoload
(define-key ctl-x-5-map "." 'find-tag-other-frame)
(defvar next-file-list nil
"List of files for next-file to process.")
......
This diff is collapsed.
......@@ -724,7 +724,14 @@ text that other programs have provided for pasting.
The function should be called with no arguments. If the function
returns nil, then no other program has provided such text, and the top
of the Emacs kill ring should be used. If the function returns a
string, that string should be put in the kill ring as the latest kill.")
string, that string should be put in the kill ring as the latest kill.
Note that the function should return a string only if a program other
than Emacs has provided a string for pasting; if Emacs provided the
most recent string, the function should return nil. If it is
difficult to tell whether Emacs or some other program provided the
current string, it is probably good enough to return nil if the string
is equal (according to `string=') to the last text Emacs provided.")
......
......@@ -447,6 +447,11 @@ This returns ARGS with the arguments that have been processed removed."
'(lambda ()
(error "Suspending an emacs running under X makes no sense")))
;;; We keep track of the last text selected here, so we can check the
;;; current selection against it, and avoid passing back our own text
;;; from x-cut-buffer-or-selection-value.
(defvar x-last-selected-text nil)
;;; Make TEXT, a string, the primary and clipboard X selections.
;;; If you are running xclipboard, this means you can effectively
;;; have a window on a copy of the kill-ring.
......@@ -455,14 +460,19 @@ This returns ARGS with the arguments that have been processed removed."
(defun x-select-text (text)
(x-own-selection text 'cut-buffer0)
(x-own-selection text 'clipboard)
(x-own-selection text))
(x-own-selection text)
(setq x-last-selected-text text))
;;; Return the value of the current X selection. For compatibility
;;; with older X applications, this checks cut buffer 0 before
;;; retrieving the value of the primary selection.
(defun x-cut-buffer-or-selection-value ()
(or (x-selection-value 'cut-buffer0)
(x-selection-value)))
(let ((text (or (x-selection-value 'cut-buffer0)
(x-selection-value))))
(if (string= text x-last-selected-text)
nil
(setq x-last-selected-text nil)
text)))
;;; Arrange for the kill and yank functions to set and check the clipboard.
(setq interprogram-cut-function 'x-select-text)
......
;;; text-mode.el --- text mode, and its idiosyncratic commands.
;; Copyright (C) 1985 Free Software Foundation, Inc.
;; Copyright (C) 1985, 1992 Free Software Foundation, Inc.
;; This file is part of GNU Emacs.
;; GNU Emacs is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 1, or (at your option)
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
......@@ -94,18 +94,6 @@ if that value is non-nil."
(setq major-mode 'indented-text-mode)
(run-hooks 'text-mode-hook))
(defun change-log-mode ()
"Major mode for editing ChangeLog files. See M-x add-change-log-entry.
Almost the same as Indented Text mode, but prevents numeric backups
and sets `left-margin' to 8 and `fill-column' to 74."
(interactive)
(indented-text-mode)
(setq left-margin 8)
(setq fill-column 74)
(make-local-variable 'version-control)
(setq version-control 'never)
(run-hooks 'change-log-mode-hook))
(defun center-paragraph ()
"Center each nonblank line in the paragraph at or after point.
See center-line for more info."
......
......@@ -32,9 +32,12 @@ end
define xwindow
print (struct window *) ($ & 0x00ffffff)
print ($->left)@4
print $$
end
document xwindow
Print $ as a window pointer, assuming it is an Elisp window value.
Print the window's position as { left, top, height, width }.
end
define xmarker
......@@ -46,9 +49,12 @@ end
define xbuffer
print (struct buffer *) ($ & 0x00ffffff)
print &((struct Lisp_String *) (($->name) & 0x00ffffff))->data
print $$
end
document xbuffer
Print $ as a buffer pointer, assuming it is an Elisp buffer value.
Set $ as a buffer pointer, assuming it is an Elisp buffer value.
Print the name of the buffer.
end
define xsymbol
......
......@@ -960,7 +960,7 @@ Does not copy symbols.")
struct gcpro *gcprolist;
#define NSTATICS 256
#define NSTATICS 512
Lisp_Object *staticvec[NSTATICS] = {0};
......
......@@ -41,8 +41,9 @@ struct backtrace
struct backtrace *next;
Lisp_Object *function;
Lisp_Object *args; /* Points to vector of args. */
int nargs; /* length of vector */
/* if nargs is UNEVALLED, args points to slot holding list of unevalled args */
int nargs; /* Length of vector.
If nargs is UNEVALLED, args points to slot holding
list of unevalled args */
char evalargs;
/* Nonzero means call value of debugger when done with this operation. */
char debug_on_exit;
......@@ -451,20 +452,33 @@ and input is currently coming from the keyboard (not in keyboard macro).")
if (!INTERACTIVE)
return Qnil;
/* Unless the object was compiled, skip the frame of interactive-p itself
(if interpreted) or the frame of byte-code (if called from
compiled function). */
btp = backtrace_list;
if (XTYPE (*btp->function) != Lisp_Compiled)
/* If this isn't a byte-compiled function, there may be a frame at
the top for Finteractive_p itself. If so, skip it. */
fun = Findirect_function (*btp->function);
if (XTYPE (fun) == Lisp_Subr
&& (struct Lisp_Subr *) XPNTR (fun) == &Sinteractive_p)
btp = btp->next;
while (btp
&& (btp->nargs == UNEVALLED || EQ (*btp->function, Qbytecode)))
/* If we're running an Emacs 18-style byte-compiled function, there
may be a frame for Fbytecode. Now, given the strictest
definition, this function isn't really being called
interactively, but because that's the way Emacs 18 always builds
byte-compiled functions, we'll accept it for now. */
if (EQ (*btp->function, Qbytecode))
btp = btp->next;
/* If this isn't a byte-compiled function, then we may now be
looking at several frames for special forms. Skip past them. */
while (btp &&
btp->nargs == UNEVALLED)
btp = btp->next;
/* btp now points at the frame of the innermost function
that DOES eval its args.
If it is a built-in function (such as load or eval-region)
return nil. */
/* btp now points at the frame of the innermost function that isn't
a special form, ignoring frames for Finteractive_p and/or
Fbytecode at the top. If this frame is for a built-in function
(such as load or eval-region) return nil. */
fun = Findirect_function (*btp->function);
if (XTYPE (fun) == Lisp_Subr)
return Qnil;
......@@ -2320,8 +2334,8 @@ See also variable `debug-on-quit'.");
DEFVAR_BOOL ("debug-on-quit", &debug_on_quit,
"*Non-nil means enter debugger if quit is signaled (C-G, for example).\n\
Does not apply if quit is handled by a `condition-case'.
A non-nil value is equivalent to a `debug-on-error' value containing 'quit.");
Does not apply if quit is handled by a `condition-case'.\n\
A non-nil value is equivalent to a `debug-on-error' value containing `quit'.");
debug_on_quit = 0;
DEFVAR_BOOL ("debug-on-next-call", &debug_on_next_call,
......
......@@ -20,41 +20,6 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "config.h"
#ifdef LOAD_AVE_TYPE
#ifdef BSD
/* It appears param.h defines BSD and BSD4_3 in 4.3
and is not considerate enough to avoid bombing out
if they are already defined. */
#undef BSD
#ifdef BSD4_3
#undef BSD4_3
#define XBSD4_3 /* XBSD4_3 says BSD4_3 is supposed to be defined. */
#endif
#include <sys/param.h>
/* Now if BSD or BSD4_3 was defined and is no longer,
define it again. */
#ifndef BSD
#define BSD
#endif
#ifdef XBSD4_3
#ifndef BSD4_3
#define BSD4_3
#endif
#endif /* XBSD4_3 */
#endif /* BSD */
#ifndef VMS
#ifndef NLIST_STRUCT
#include <a.out.h>
#else /* NLIST_STRUCT */
#include <nlist.h>
#endif /* NLIST_STRUCT */
#endif /* not VMS */
#endif /* LOAD_AVE_TYPE */
#ifdef DGUX
#include <sys/dg_sys_info.h> /* for load average info - DJB */
#endif
/* Note on some machines this defines `vector' as a typedef,
so make sure we don't use that name in this file. */
#undef vector
......@@ -1226,171 +1191,27 @@ and can rub it out if not confirmed.")
UNGCPRO;
}
/* Avoid static vars inside a function since in HPUX they dump as pure. */
#ifdef DGUX
static struct dg_sys_info_load_info load_info; /* what-a-mouthful! */
#else /* Not DGUX */
static int ldav_initialized;
static int ldav_channel;
#ifdef LOAD_AVE_TYPE
#ifndef VMS
static struct nlist ldav_nl[2];
#endif /* VMS */
#endif /* LOAD_AVE_TYPE */
#define channel ldav_channel
#define initialized ldav_initialized
#define nl ldav_nl
#endif /* Not DGUX */
DEFUN ("load-average", Fload_average, Sload_average, 0, 0, 0,
"Return list of 1 minute, 5 minute and 15 minute load averages.\n\
Each of the three load averages is multiplied by 100,\n\
then converted to integer.")
then converted to integer.\n\
If the 5-minute or 15-minute load averages are not available, return a\n\
shortened list, containing only those averages which are available.")
()
{
#ifdef DGUX
/* perhaps there should be a "sys_load_avg" call in sysdep.c?! - DJB */
load_info.one_minute = 0.0; /* just in case there is an error */
load_info.five_minute = 0.0;
load_info.fifteen_minute = 0.0;
dg_sys_info (&load_info, DG_SYS_INFO_LOAD_INFO_TYPE,
DG_SYS_INFO_LOAD_VERSION_0);
return Fcons (make_number ((int)(load_info.one_minute * 100.0)),
Fcons (make_number ((int)(load_info.five_minute * 100.0)),
Fcons (make_number ((int)(load_info.fifteen_minute * 100.0)),
Qnil)));
#else /* not DGUX */
#ifndef LOAD_AVE_TYPE
error ("load-average not implemented for this operating system");
#else /* LOAD_AVE_TYPE defined */
LOAD_AVE_TYPE load_ave[3];
#ifdef VMS
#ifndef eunice
#include <iodef.h>
#include <descrip.h>
#else
#include <vms/iodef.h>
struct {int dsc$w_length; char *dsc$a_pointer;} descriptor;
#endif /* eunice */
#endif /* VMS */
/* If this fails for any reason, we can return (0 0 0) */
load_ave[0] = 0.0; load_ave[1] = 0.0; load_ave[2] = 0.0;
#ifdef VMS
/*
* VMS specific code -- read from the Load Ave driver
*/
/*
* Ensure that there is a channel open to the load ave device
*/
if (initialized == 0)
{
/* Attempt to open the channel */
#ifdef eunice
descriptor.size = 18;
descriptor.ptr = "$$VMS_LOAD_AVERAGE";
#else
$DESCRIPTOR(descriptor, "LAV0:");
#endif
if (sys$assign (&descriptor, &channel, 0, 0) & 1)
initialized = 1;
}
/*
* Read the load average vector
*/
if (initialized)
{
if (!(sys$qiow (0, channel, IO$_READVBLK, 0, 0, 0,
load_ave, 12, 0, 0, 0, 0)
& 1))
{
sys$dassgn (channel);
initialized = 0;
}
}
#else /* not VMS */
/*
* 4.2BSD UNIX-specific code -- read _avenrun from /dev/kmem
*/