changeset 577:53f29271d1b0

*** empty log message ***
author Jim Blandy <jimb@redhat.com>
date Sat, 14 Mar 1992 19:09:32 +0000
parents a63fdacd41b3
children a4591b4d5435
files etc/=MACHINES src/doc.c src/editfns.c src/ralloc.c
diffstat 4 files changed, 82 insertions(+), 41 deletions(-) [+]
line wrap: on
line diff
--- a/etc/=MACHINES	Fri Mar 13 19:54:03 1992 +0000
+++ b/etc/=MACHINES	Sat Mar 14 19:09:32 1992 +0000
@@ -1,5 +1,5 @@
 This is a list of the status of GNU Emacs on various machines and systems.
-Last updated 10 Feb 1992.
+Last updated 4 March 1991.
 
 For each system and machine, we give the `-opsystem' and `-machine'
 options you should pass to config.emacs to prepare to build Emacs for
@@ -326,6 +326,11 @@
 
   Series 200 HPUX runs Emacs only if it has the "HP-UX upgrade".
 
+  If you are running HP-UX release 8.0 or later, you need the optional
+  "C/ANSI C" software in order to build Emacs (older releases of HP-UX
+  do not require any special software).  If the file "/etc/filesets/C"
+  exists on your machine, you have this software, otherwise you do not.
+
   Note that HP has used two incompatible assembler syntaxes,
   and has recently changed the format of C function frames.
   src/crt0.c and src/alloca.s have been conditionalised for the new
@@ -363,6 +368,11 @@
   running HP-UX.  It has been moderately tested on the Series
   840.
 
+  If you are running HP-UX release 8.0 or later, you need the optional
+  "C/ANSI C" software in order to build Emacs (older releases of HP-UX
+  do not require any special software).  If the file "/etc/filesets/C"
+  exists on your machine, you have this software, otherwise you do not.
+
 High Level Hardware Orion (-machine=orion; -opsystem=bsd4-2)
 
   This is the original microprogrammed hardware.
--- a/src/doc.c	Fri Mar 13 19:54:03 1992 +0000
+++ b/src/doc.c	Sat Mar 14 19:09:32 1992 +0000
@@ -1,5 +1,5 @@
 /* Record indices of function doc strings stored in a file.
-   Copyright (C) 1985, 1986 Free Software Foundation, Inc.
+   Copyright (C) 1985, 1986, 1992 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -174,19 +174,17 @@
       return Fsignal (Qinvalid_function, Fcons (fun, Qnil));
     }
 
-  if (NULL (raw))
+  if (NILP (raw))
     doc = Fsubstitute_command_keys (doc);
   return doc;
 }
 
-DEFUN ("documentation-property", Fdocumentation_property, 
-       Sdocumentation_property, 2, 2, 0,
-
+DEFUN ("documentation-property", Fdocumentation_property, Sdocumentation_property, 2, 2, 0,
   "Return the documentation string that is SYMBOL's PROP property.\n\
 This is like `get', but it can refer to strings stored in the\n\
 `share-lib/DOC' file; and if the value is a string, it is passed through\n\
-`substitute-command-keys'.  A non-nil third argument avoids this
-translation."
+`substitute-command-keys'.  A non-nil third argument avoids this\n\
+translation.")
   (sym, prop, raw)
      Lisp_Object sym, prop, raw;
 {
@@ -195,7 +193,7 @@
   tem = Fget (sym, prop);
   if (XTYPE (tem) == Lisp_Int)
     tem = get_doc_string (XINT (tem) > 0 ? XINT (tem) : - XINT (tem));
-  if (NULL (raw) && XTYPE (tem) == Lisp_String)
+  if (NILP (raw) && XTYPE (tem) == Lisp_String)
     return Fsubstitute_command_keys (tem);
   return tem;
 }
--- a/src/editfns.c	Fri Mar 13 19:54:03 1992 +0000
+++ b/src/editfns.c	Sat Mar 14 19:09:32 1992 +0000
@@ -1,5 +1,5 @@
 /* Lisp functions pertaining to editing.
-   Copyright (C) 1985, 1986, 1987, 1989 Free Software Foundation, Inc.
+   Copyright (C) 1985, 1986, 1987, 1989, 1992 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -21,7 +21,7 @@
 #include "config.h"
 
 #ifdef VMS
-#include "pwd.h"
+#include "vms-pwd.h"
 #else
 #include <pwd.h>
 #endif
@@ -30,13 +30,7 @@
 #include "buffer.h"
 #include "window.h"
 
-#ifdef NEED_TIME_H
-#include <time.h>
-#else /* not NEED_TIME_H */
-#ifdef HAVE_TIMEVAL
-#include <sys/time.h>
-#endif /* HAVE_TIMEVAL */
-#endif /* not NEED_TIME_H */
+#include "systime.h"
 
 #define min(a, b) ((a) < (b) ? (a) : (b))
 #define max(a, b) ((a) > (b) ? (a) : (b))
@@ -509,10 +503,25 @@
 }
 
 DEFUN ("current-time", Fcurrent_time, Scurrent_time, 0, 0, 0,
-  "Return the current time, as an integer.")
+  "Return the current time, as the number of seconds since 12:00 AM January 1970.\n\
+The time is returned as a list of three integers.  The first has the\n\
+most significant 16 bits of the seconds, while the second has the\n\
+least significant 16 bits.  The third integer gives the microsecond\n\
+count.\n\
+\n\
+The microsecond count is zero on systems that do not provide\n\
+resolution finer than a second.")
   ()
 {
-  return make_number (time(0));
+  EMACS_TIME t;
+  Lisp_Object result[3];
+
+  EMACS_GET_TIME (t);
+  XSET (result[0], Lisp_Int, (EMACS_SECS (t) >> 16) & 0xffff);
+  XSET (result[1], Lisp_Int, (EMACS_SECS (t) >> 0)  & 0xffff);
+  XSET (result[2], Lisp_Int, EMACS_USECS (t));
+
+  return Flist (3, result);
 }
 
 
--- a/src/ralloc.c	Fri Mar 13 19:54:03 1992 +0000
+++ b/src/ralloc.c	Sat Mar 14 19:09:32 1992 +0000
@@ -1,5 +1,5 @@
 /* Block-relocating memory allocator. 
-   Copyright (C) 1990 Free Software Foundation, Inc.
+   Copyright (C) 1992 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -24,14 +24,15 @@
    hole between the first bloc and the end of malloc storage. */
 
 #include "config.h"
-#include "lisp.h"		/* Needed for xterm.h */
+#include "lisp.h"		/* Needed for VALBITS.  */
 #undef NULL
 #include "mem_limits.h"
-#include "xterm.h"		/* Needed for BLOCK_INPUT */
 
 #define NIL ((POINTER) 0)
 
 
+/* Declarations for working with the malloc, ralloc, and system breaks.  */
+
 /* System call to set the break value. */
 extern POINTER sbrk ();
 
@@ -52,6 +53,8 @@
 #define ROUND_TO_PAGE(addr) (addr & (~(PAGE - 1)))
 #define EXCEEDS_ELISP_PTR(ptr) ((unsigned int) (ptr) >> VALBITS)
 
+/* Managing "almost out of memory" warnings.  */
+
 /* Level of warnings issued. */
 static int warnlevel;
 
@@ -100,6 +103,8 @@
       memory_full ();
 }
 
+/* Functions to get and return memory from the system.  */
+
 /* Obtain SIZE bytes of space.  If enough space is not presently available
    in our process reserve, (i.e., (page_break_value - break_value)),
    this means getting more page-aligned space from the system. */
@@ -112,7 +117,7 @@
 
   if (already_available < size)
     {
-      SIZE get = ROUNDUP (size);
+      SIZE get = ROUNDUP (size - already_available);
 
       if (warnfunction)
 	check_memory_limits (page_break_value);
@@ -138,26 +143,37 @@
 }
 
 /* Note that SIZE bytes of space have been relinquished by the process.
-   If SIZE is more than a page, return the space the system. */
+   If SIZE is more than a page, return the space to the system. */
 
 static void
 relinquish (size)
      SIZE size;
 {
-  SIZE page_part = ROUND_TO_PAGE (size);
+  POINTER new_page_break;
 
-  if (page_part)
+  break_value -= size;
+  new_page_break = (POINTER) ROUNDUP (break_value);
+  
+  if (new_page_break != page_break_value)
     {
-      if (((int) (sbrk (- page_part))) < 0)
+      if (((int) (sbrk ((char *) new_page_break
+			- (char *) page_break_value))) < 0)
 	abort ();
 
-      page_break_value -= page_part;
+      page_break_value = new_page_break;
     }
 
-  break_value -= size;
-  bzero (break_value, (size - page_part));
+  /* Zero the space from the end of the "official" break to the actual
+     break, so that bugs show up faster.  */
+  bzero (break_value, ((char *) page_break_value - (char *) break_value));
 }
 
+/* The meat - allocating, freeing, and relocating blocs.  */
+
+/* These structures are allocated in the malloc arena.
+   The linked list is kept in order of increasing '.data' members.
+   The data blocks abut each other; if b->next is non-nil, then
+   b->data + b->size == b->next->data.  */
 typedef struct bp
 {
   struct bp *next;
@@ -173,10 +189,11 @@
 /* Head and tail of the list of relocatable blocs. */
 static bloc_ptr first_bloc, last_bloc;
 
-/* Declared in dispnew.c, this version dosen't fuck up if regions overlap. */
+/* Declared in dispnew.c, this version doesn't screw up if regions
+   overlap.  */
 extern void safe_bcopy ();
 
-/* Find the bloc reference by the address in PTR.  Returns a pointer
+/* Find the bloc referenced by the address in PTR.  Returns a pointer
    to that block. */
 
 static bloc_ptr
@@ -285,6 +302,8 @@
   free (bloc);
 }
 
+/* Interface routines.  */
+
 static int use_relocatable_buffers;
 
 /* Obtain SIZE bytes of storage from the free pool, or the system,
@@ -306,6 +325,9 @@
       if (first_bloc)
 	{
 	  relocate_some_blocs (first_bloc, first_bloc->data + size);
+
+	  /* Zero out the space we just allocated, to help catch bugs
+	     quickly.  */
 	  bzero (virtual_break_value, size);
 	}
     }
@@ -332,11 +354,9 @@
 {
   register bloc_ptr new_bloc;
 
-  BLOCK_INPUT;
   new_bloc = get_bloc (size);
   new_bloc->variable = ptr;
   *ptr = new_bloc->data;
-  UNBLOCK_INPUT;
 
   return *ptr;
 }
@@ -349,13 +369,11 @@
 {
   register bloc_ptr dead_bloc;
 
-  BLOCK_INPUT;
   dead_bloc = find_bloc (ptr);
   if (dead_bloc == NIL_BLOC)
     abort ();
 
   free_bloc (dead_bloc);
-  UNBLOCK_INPUT;
 }
 
 /* Given a pointer at address PTR to relocatable data, resize it
@@ -373,12 +391,12 @@
 {
   register bloc_ptr old_bloc, new_bloc;
 
-  BLOCK_INPUT;
   old_bloc = find_bloc (ptr);
   if (old_bloc == NIL_BLOC)
     abort ();
 
   if (size <= old_bloc->size)
+    /* Wouldn't it be useful to actually resize the bloc here?  */
     return *ptr;
 
   new_bloc = get_bloc (size);
@@ -387,7 +405,6 @@
   *ptr = new_bloc->data;
 
   free_bloc (old_bloc);
-  UNBLOCK_INPUT;
 
   return *ptr;
 }
@@ -396,6 +413,15 @@
    from the system.  */
 extern POINTER (*__morecore) ();
 
+/* A flag to indicate whether we have initialized ralloc yet.  For
+   Emacs's sake, please do not make this local to malloc_init; on some
+   machines, the dumping procedure makes all static variables
+   read-only.  On these machines, the word static is #defined to be
+   the empty string, meaning that malloc_initialized becomes an
+   automatic variable, and loses its value each time Emacs is started
+   up.  */
+static int malloc_initialized = 0;
+
 /* Intialize various things for memory allocation. */
 
 void
@@ -403,8 +429,6 @@
      POINTER start;
      void (*warn_func) ();
 {
-  static int malloc_initialized = 0;
-
   if (start)
     data_space_start = start;