From xemacs-m  Tue Sep 16 18:24:36 1997
Received: from mercury.Sun.COM (mercury.Sun.COM [192.9.25.1])
	by xemacs.org (8.8.5/8.8.5) with SMTP id SAA18967
	for <xemacs-beta@xemacs.org>; Tue, 16 Sep 1997 18:24:36 -0500 (CDT)
Received: from Eng.Sun.COM ([129.146.1.25]) by mercury.Sun.COM (SMI-8.6/mail.byaddr) with SMTP id QAA13834 for <xemacs-beta@xemacs.org>; Tue, 16 Sep 1997 16:24:08 -0700
Received: from kindra.eng.sun.com by Eng.Sun.COM (SMI-8.6/SMI-5.3)
	id QAA10319; Tue, 16 Sep 1997 16:24:03 -0700
Received: from xemacs.eng.sun.com by kindra.eng.sun.com (SMI-8.6/SMI-SVR4)
	id QAA04482; Tue, 16 Sep 1997 16:23:40 -0700
Received: by xemacs.eng.sun.com (SMI-8.6/SMI-SVR4)
	id QAA03340; Tue, 16 Sep 1997 16:23:38 -0700
Date: Tue, 16 Sep 1997 16:23:38 -0700
Message-Id: <199709162323.QAA03340@xemacs.eng.sun.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
From: Martin Buchholz <mrb@Eng.Sun.COM>
To: Hrvoje Niksic <hniksic@srce.hr>
Cc: XEmacs Developers <xemacs-beta@xemacs.org>
Subject: Re: jka-compr and Mule
In-Reply-To: <kighgbkap1b.fsf@jagor.srce.hr>
References: <kigyb4xl4ci.fsf@jagor.srce.hr>
	<m2afhdjbv1.fsf@altair.xemacs.org>
	<kig4t7lar7z.fsf@jagor.srce.hr>
	<m2lo0wj4qz.fsf@altair.xemacs.org>
	<kighgbkap1b.fsf@jagor.srce.hr>
X-Mailer: VM 6.33 under 20.3 "Vienna" XEmacs  Lucid (beta14)
Reply-To: Martin Buchholz <mrb@Eng.Sun.COM>

>>>>> "Hrvoje" == Hrvoje Niksic <hniksic@srce.hr> writes:

Hrvoje> SL Baur <steve@xemacs.org> writes:
>> Hrvoje Niksic <hniksic@srce.hr> writes:
>> 
>> > SL Baur <steve@xemacs.org> writes:
>> >> Hrvoje Niksic <hniksic@srce.hr> writes:
>> >> 
>> >> > What is the problem, exactly, between jka-compr and Mule?  Since we
>> >> > really do need an on-the-fly compressor/decompressor, and jka-compr
>> >> > looks simpler than crypt, I've decided to have a look at it.
>> >> 
>> >> It needs to perform the usual scan for coding-system after
>> >> decompression and prior to being left in a buffer.
>> 
>> > Where can I find a sample Lisp code that does it correctly?
>> 
>> To the best of my understanding, it's not done in Lisp.

Hrvoje> Then it is very bad design, which makes it impossible to implement
Hrvoje> jka-compr correctly.

>> Check out mule-coding.c.  Around line 1200 underneath a comment
>> reading:
Hrvoje> [...]

Hrvoje> Hmm, the Fdetect_coding_region function found below looks promising!
Hrvoje> Maybe that's what jka-compr should use after decompression.

I think it can be all done in lisp.  One naive way that would work is
to do the compression/decompression into another external temporary
file with the `normal' extension etc..., and read that in using the
standard mechanisms, which can then do the appropriate decoding.

detect-coding-region is another approach that should work.
One can read in any file using the binary coding system, and then
convert it using the *-coding-region functions.

decode-coding-region
  Function: Decode the text between START and END which is encoded in CODING-SYSTEM.
detect-coding-region
  Function: Detect coding system of the text in the region between START and END.
encode-coding-region
  Function: Encode the text between START and END using CODING-SYSTEM.

I won't have time to work on this soon.

Martin

