🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.bug
Article #662

Re: emacs should be able to load compressed files,

#662
From: Michael Meissner
Date: Fri, 04 Sep 1992 21:14
104 lines
3704 bytes
In article <9208271934.AA11136@hpnmdla.sr.hp.com> darrylo@hpnmdla.sr.hp.com (Darryl Okahata) writes:

| In gnu.emacs.bug, nickel@cs.tu-berlin.DE (Juergen Nickelsen)s writes:
| 
| > Has anyone implemented *loading* (as opposed to editing) compressed
| > files yet?  I'm not *too* eager to re-implement yet another wheel.
| 
|      The wheel was invented a long time ago, by Michael Meissner of the
| OSF.  I added his changes to the "unofficial HP GNU Emacs", and so here
| are the pertinent diffs (relative to the virginal FSF 18.58 Emacs).  You
| must #define READ_COMPRESSED_BYTE_COMPILED_FILES in config.h to turn on
| the code; otherwise the old code remains in place.

Umm, you also need the following function to be added to process.c.  I
also have had reports that create_filter doesn't work too well on
System V.3 systems (probably due to SIGCHILD vs. SIGCHLD signal
differences and the such).

/* Internal function to create a filter process, that given an
   input file descriptor and an argument list, invokes the
   process with the output directed to a pipe, and return the
   file descriptor of the read end of the pipe.  */

int
create_filter (infd, new_argv)
     int infd;			/* input file descriptor */
     char *new_argv[];		/* argument list */
{
  int pipe_fd[2];
  int pid;
  char **env;
  /* child_setup must clobber environ on systems with true vfork.
       Protect it from permanent change.  */
  extern char **environ;
  char **save_environ = environ;

#ifdef MAINTAIN_ENVIRONMENT
    env = (char **) alloca (size_of_current_environ ());
    get_current_environ (env);
#else
    env = environ;
#endif /* MAINTAIN_ENVIRONMENT */

  if (pipe (pipe_fd) < 0)
    {
      error ("Failure to create pipe for %s command", new_argv[0]);
      return -1;
    }

  /* Delay interrupts until we have a chance to store
     the new fork's pid in its process structure */
#ifdef SIGCHLD
#ifdef BSD4_1
  sighold (SIGCHLD);
#else /* not BSD4_1 */
#ifdef HPUX
  sigsetmask (1 << (SIGCHLD - 1));
#endif /* HPUX */
#if defined (BSD) || defined (UNIPLUS)
  sigsetmask (1 << (SIGCHLD - 1));
#else /* ordinary USG */
  sigchld = (int (*)()) signal (SIGCHLD, SIG_DFL);
#endif /* ordinary USG */
#endif /* not BSD4_1 */
#endif /* SIGCHLD */

  pid = vfork ();
  if (pid == 0)
    /* don't do controlling terminal stuff, since we are using pipes. */
    child_setup (infd, pipe_fd[1], pipe_fd[1], new_argv, env);

  environ = save_environ;

  close (pipe_fd[1]);
  close (infd);
  if (pid < 0)
    {
      close (pipe_fd[0]);
      pipe_fd[0] = -1;
      report_file_error ("Doing vfork", Qnil);
    }

#ifdef SIGCHLD
#ifdef BSD4_1
  sigrelse (SIGCHLD);
#else /* not BSD4_1 */
#ifdef HPUX
  sigsetmask (0);
#endif /* HPUX */
#if defined (BSD) || defined (UNIPLUS)
  sigsetmask (0);
#else /* ordinary USG */
  signal (SIGCHLD, sigchld);
#endif /* ordinary USG */
#endif /* not BSD4_1 */
#endif /* SIGCHLD */

  return pipe_fd[0];
}
--
Michael Meissner	email: meissner@osf.org		phone: 617-621-8861
Open Software Foundation, 11 Cambridge Center, Cambridge, MA, 02142

You are in a twisty little passage of standards, all conflicting.
Technical Details
Message-ID: <MEISSNER.92Sep4171438@curley.osf.org>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!osf.ORG!meissner
References: meissner@osf.ORG (Michael Meissner)

Show Full Headers
Complete Article Headers
Newsgroups: gnu.emacs.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!osf.ORG!meissner
From: meissner@osf.ORG (Michael Meissner)
Subject: Re: emacs should be able to load compressed files,
Message-ID: <MEISSNER.92Sep4171438@curley.osf.org>
Sender: gnulists@ai.mit.edu
Organization: Open Software Foundation
References: meissner@osf.ORG (Michael Meissner)
Distribution: gnu
Date: Fri, 4 Sep 1992 21:14:38 GMT
Approved: bug-gnu-emacs@prep.ai.mit.edu
Lines: 105