Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Ispell (binary patching Emacs)

Received: by 10.66.82.2 with SMTP id e2mr1793021pay.40.1344317777841;
        Mon, 06 Aug 2012 22:36:17 -0700 (PDT)
Path: g9ni2514024pbo.0!nntp.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!ctu-peer!news.nctu.edu.tw!goblin1!goblin2!goblin.stu.neva.ru!feeder3.cambriumusenet.nl!feed.tweaknews.nl!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
From: rugx...@gmail.com
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Ispell (binary patching Emacs)
Date: Thu, 2 Aug 2012 22:03:15 -0700 (PDT)
Organization: http://groups.google.com
Lines: 167
Message-ID: <b41365e0-2819-4ee6-bd92-c0399cfa6c35@googlegroups.com>
References: <MPG.2a61256b7098af43989680@news60.forteinc.com>
 <83sjd412pe.fsf@gnu.org> <b7563c8c-4248-499f-a8fe-bcffa12eb5e9@googlegroups.com>
 <83obnql106.fsf@gnu.org> <44cbf133-ea8b-47d6-9f01-0c7cef19c13a@googlegroups.com>
 <8fd215eb-bc43-4739-b68b-50d0b27fb7b4@r33g2000yqd.googlegroups.com> <dd4a89be-da91-49e7-8c6b-f8b2cbc16bc5@googlegroups.com>
NNTP-Posting-Host: 65.13.115.246
Mime-Version: 1.0
X-Trace: posting.google.com 1343970274 24957 127.0.0.1 (3 Aug 2012 05:04:34 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Fri, 3 Aug 2012 05:04:34 +0000 (UTC)
In-Reply-To: <dd4a89be-da91-49e7-8c6b-f8b2cbc16bc5@googlegroups.com>
Complaints-To: groups-abuse@google.com
Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=65.13.115.246;
 posting-account=p5rsXQoAAAB8KPnVlgg9E_vlm2dvVhfO
User-Agent: G2/1.0
Bytes: 7302
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Hi,
   I had a longer reply, but it didn't post correctly (blech). Not a huge l=
oss, just saying ....

On Tuesday, July 31, 2012 6:55:06 AM UTC-5, rug...@gmail.com wrote:
>=20
> On Saturday, July 28, 2012 10:35:02 AM UTC-5, USA Choice User wrote:
>=20
> > Sorry I took so long to reply.  I finally got Emacs
> > 23.3 so it will compile using DJGPP on Windows 98SE,
> > with LFN set to "Y".  Following your version suggestion,
> > I only had to make one change--I substituted GCC 4.4.4
> > for GCC 4.7.0.  I also substituted GPP 4.4.4 for GPP
> > 4.7.0 for consistency.
>=20
> > However, I can't figure out how or where to splice
> > in your patch, in callproc.c.  I did find the file
> > in the source folder, but to me at least it's not
> > obvious how to fix it (I'm not a C programmer yet,
> > but I can figure things out and follow directions).
>=20
> > If you could walk me through the process I'd
> > appreciate it.  Thanks.

As mentioned, for text files, the best way to send small fixes is via (unif=
ied) Diff (and Patch in lieu of Ed). But you'd still have to grab the (big)=
 sources and recompile, assuming you had all the correct tools. Even a refr=
eshed, patched binary would make everyone download 40+ MB yet again. Yuck.

So a binary patch (as shown by my FC output) is easier, IMHO, but it's stil=
l not automatic. GNU Diff and Patch may? support binary files, but I've not=
 tried. I've also not tried new Xdelta3 nor Courgette nor Open-VCdiff nor b=
sdiff (needs Bzip2) nor others. Emacs' own hexl-mode is broken by this same=
 bug, so that's ruled out too!

DJGPP does have older XDelta 1.12 (from 2002) in /current/v2apps/ so I did =
earlier today make a quick patch and UUencode it.

EDIT: Google Groups is having problems posting this, ugh. Maybe if I remove=
 this .uue below it will help (doh).

(snip, email me directly if it's desired)

I also wrote a really crappy tool in .C that you can compile that will read=
 the FC output and automatically fix it for you. For cleanliness in this ne=
wsgroup, I've edited out the 8-bit chars, as they were unnecessary anyways.

=3D=3Demacs.pat=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D
fc /m35 /b emacs.old emacs.exe

Comparing G:\TONY\EMACS.OLD and G:\TONY\EMACS.EXE
00115D83:     A9         AE  =20
00145F00:     80         E8  =20
00145F01:     7B         1E  =20
00145F02:     FF         01  =20
00145F03:     58         00  =20
00145F04:     75         00  =20
00145F05:     0C         90  =20
00146021:     89         C9  =20
00146022:     EC         C3  =20
00146023:     5D         80  =20
00146024:     C3         63  =20
00146025:     8D         FF  =20
00146026:     76         58  =20
00146027:     00         80  =20
00146028:     00         7B  =20
00146029:     00         FF  =20
0014602A:     00         58  =20
0014602B:     00         74  =20
0014602C:     00         07  =20
0014602D:     00         5A  =20
0014602E:     00         E9  =20
0014602F:     00         DF  =20
00146030:     55         FE  =20
00146031:     89         FF  =20
00146032:     E5         FF  =20
00146033:     81         90  =20
00146034:     EC         C3  =20
00146035:     04         C8  =20
00146036:     01         04  =20
00146037:     00         01  =20
=3D=3Demacs.pat=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D

You can optionally verify (before and after) by using "md5sum -c blah.md5":

=3D=3Doldemacs.md5=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
4f171dddc36898e8e3003d5cefae2497 *emacs.exe
=3D=3Doldemacs.md5=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

=3D=3Dnewemacs.md5=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
ad14f38a625ccbfff98510ae832bf734 *emacs.exe
=3D=3Dnewemacs.md5=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

BTW, the following .C code is rubbish, but it seems to still work anyways. =
 ;-)

=3D=3Dtonyhack.c=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

typedef FILE* FilePtr;

void seekit(FilePtr t, long o) {
  fflush(t); fseek(t,o,SEEK_SET);

  if (ftell(t) !=3D o) {
    printf("Couldn't seek!\n");
    exit(EXIT_FAILURE);
  }
}

int main(void) {
  static long offset=3D0L,lineno=3D0L;
  int rc=3DEXIT_SUCCESS,res=3D0;
  FilePtr patch, target;
  char format1[]=3D"%lX: %02X %02X", format2[]=3D"%lX: %02X %*c %02X";
  char buf[1024], *fmt;
  unsigned int hex[3];

target=3Dfopen("emacs.exe","rb+"); patch=3Dfopen("emacs.pat","r");

if ((target =3D=3D NULL) || (patch =3D=3D NULL))
  rc=3DEXIT_FAILURE;
else {
  while (fgets(buf,sizeof(buf),patch) !=3D NULL) {

    lineno++;

    /* adjust for DOS' fc.exe output if no char literal found */
    fmt=3Dformat1; if (buf[18] !=3D ' ') fmt=3Dformat2;

    res=3Dsscanf(buf,fmt,&offset,&hex[0],&hex[1]);

    if (res > 1) {
      seekit(target,offset);

      fread(&hex[2],1,1,target); hex[2]=3D(unsigned char)hex[2];

      if (hex[2] !=3D hex[0]) {
        printf("WARNING: %d !=3D %d\n",hex[2],hex[0]);
      }

      seekit(target,offset);

      if (fwrite(&hex[1],1,1,target) =3D=3D 1L) {
        printf("(res %d) [line %5ld] 0x%lX: %02X =3D> %02X\n",
               res,lineno,offset,hex[2],hex[1]);
      }
    }

  } /* while */
  fclose(patch); fclose(target);
} /* if */

return rc;
} /* main */
=3D=3Dtonyhack.c=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D

I did briefly consider making a Shar archive, but that's still more externa=
l utils you need (and probably don't have). I wanted clean, simple, and sma=
ll, esp. for mailing across the online group, so this way seemed better to =
my eyes.