home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / muleos2.zip / muleos2.pat < prev    next >
Text File  |  1994-03-29  |  312KB  |  10,349 lines

  1. diff -urP /mule-1.1/etc/emacsclient.c ./etc/emacsclient.c
  2. --- /mule-1.1/etc/emacsclient.c    Fri May 28 22:55:08 1993
  3. +++ ./etc/emacsclient.c    Tue Mar 15 06:42:12 1994
  4. @@ -33,7 +33,92 @@
  5.  #undef close
  6.  #endif
  7.  
  8. +#if defined (OS2)
  9.  
  10. +#define INCL_DOS
  11. +#include <os2.h>
  12. +#include <stdio.h>
  13. +#include <stdlib.h>
  14. +
  15. +static void error (ULONG rc, const char *fun)
  16. +{
  17. +    (void)fprintf (stderr, "%s failed, rc=%lu\n", fun, rc) ;
  18. +    exit (1);
  19. +}
  20. +
  21. +#define ERROR(fun) if (rc != 0) error (rc, fun)
  22. +
  23. +int main (int argc, char *argv[])
  24. +{
  25. +    int        i, done ;
  26. +    ULONG    rc, len ;
  27. +    HQUEUE    hq_client, hq_server ;
  28. +    PID        owner_pid ;
  29. +    REQUESTDATA request ;
  30. +    BYTE    priority ;
  31. +    PVOID    data ;
  32. +    char    string[1024], *p ;
  33. +
  34. +    _wildcard (&argc, &argv) ;
  35. +    if (argc < 2) {
  36. +    (void)fprintf (stderr, "Usage: %s filename\n", argv[0]) ;
  37. +    return 1 ;
  38. +    }
  39. +    (void)sprintf (string, "/queues/emacs/clients/%d", (int)getpid ()) ;
  40. +    rc = DosCreateQueue (&hq_client, QUE_FIFO | QUE_CONVERT_ADDRESS, string) ;
  41. +    ERROR ("DosCreateQueue") ;
  42. +    rc = DosOpenQueue (&owner_pid, &hq_server, "/queues/emacs/server") ;
  43. +    ERROR ("DosOpenQueue") ;
  44. +    len = 2 ;
  45. +    for (i = 1; i < argc; i++) {
  46. +    if (argv[i][0] == '+')
  47. +        strcpy (string, argv[i]) ;
  48. +    else
  49. +        _abspath (string, argv[i], sizeof (string)) ;
  50. +    len += strlen (string) + 1 ;
  51. +    }
  52. +    rc = DosAllocSharedMem (&data, 0, len,
  53. +              PAG_COMMIT | OBJ_GIVEABLE | PAG_READ | PAG_WRITE) ;
  54. +    ERROR ("DosAllocSharedMem") ;
  55. +    rc = DosGiveSharedMem (data, owner_pid, PAG_READ) ;
  56. +    ERROR ("DosGiveSharedMem") ;
  57. +    p = data ;
  58. +    for (i = 1; i < argc; ++i) {
  59. +    if (argv[i][0] == '+')
  60. +        strcpy (string, argv[i]) ;
  61. +    else
  62. +        _abspath (string, argv[i], sizeof (string)) ;
  63. +    (void)strcpy (p, string) ;
  64. +    p += strlen (string) ;
  65. +    *p++ = ' ' ;
  66. +    }
  67. +    *p++ = '\n' ;
  68. +    *p = 0 ;
  69. +    rc = DosWriteQueue (hq_server, 0, len, data, 0) ;
  70. +    ERROR ("DosWriteQueue") ;
  71. +    rc = DosFreeMem (data) ;
  72. +    ERROR ("DosFreeMem") ;
  73. +
  74. +    (void)printf ("Waiting for Emacs...") ;
  75. +    (void)fflush (stdout) ;
  76. +    do {
  77. +    rc = DosReadQueue (hq_client, &request, &len, &data, 0,
  78. +               DCWW_WAIT, &priority, 0) ;
  79. +    ERROR ("DosReadQueue") ;
  80. +    (void)fputs (data, stdout) ;
  81. +    done = (memcmp ("Close:", data, 6) == 0) ;
  82. +    rc = DosFreeMem (data) ;
  83. +    ERROR ("DosFreeMem") ;
  84. +    } while (!done) ;
  85. +    rc = DosCloseQueue (hq_server) ;
  86. +    ERROR ("DosCloseQueue") ;
  87. +    rc = DosCloseQueue (hq_client) ;
  88. +    ERROR ("DosCloseQueue") ;
  89. +    return 0 ;
  90. +}
  91. +
  92. +#else /* not OS2 */
  93. +
  94.  #if !defined(BSD) && !defined(HAVE_SYSVIPC) && !defined(HAVE_SOCKETS)
  95.  #include <stdio.h>
  96.  
  97. @@ -287,3 +372,5 @@
  98.  #endif /* HAVE_SYSVIPC */
  99.  
  100.  #endif /* BSD or HAVE_SYSVIPC */
  101. +
  102. +#endif /* OS2 */
  103. diff -urP /mule-1.1/etc/env.c ./etc/env.c
  104. --- /mule-1.1/etc/env.c    Wed Apr 15 21:36:20 1992
  105. +++ ./etc/env.c    Sat Sep 25 13:05:26 1993
  106. @@ -82,6 +82,10 @@
  107.  
  108.  */
  109.  
  110. +#ifdef OS2
  111. +#include <signal.h>
  112. +#endif
  113. +
  114.  #ifdef EMACS
  115.  #define NO_SHORTNAMES
  116.  #include "../src/config.h"
  117. @@ -90,7 +94,12 @@
  118.  #include <stdio.h>
  119.  #include <errno.h>
  120.  
  121. +#ifdef OS2
  122. +#include <process.h>
  123. +#include <fcntl.h>
  124. +#else
  125.  extern int execvp ();
  126. +#endif
  127.  extern char *index ();
  128.  
  129.  char *xmalloc (), *xrealloc ();
  130. @@ -105,6 +114,20 @@
  131.  void setenv ();
  132.  void fatal ();
  133.  
  134. +/* 93.8.20 by O.Sasaki */
  135. +#ifdef OS2
  136. +
  137. +static int child = -1;
  138. +
  139. +static void handler (int sig)
  140. +    {
  141. +    if (child >= 0)
  142. +        kill (-child, sig);
  143. +    signal (sig, SIG_ACK);
  144. +    }
  145. +#endif
  146. +/* end of patch */
  147. +
  148.  main (argc, argv, envp)
  149.       register int argc;
  150.       register char **argv;
  151. @@ -112,6 +135,11 @@
  152.  {
  153.    register char *tem;
  154.  
  155. +#ifdef OS2 /* 93.8.20 by O.Sasaki */
  156. +  setmode(0, O_BINARY);
  157. +  setmode(1, O_BINARY);
  158. +  signal (SIGINT, handler);
  159. +#endif
  160.    progname = argv[0];
  161.    argc--;
  162.    argv++;
  163. @@ -201,7 +229,18 @@
  164.        extern char *sys_errlist[];
  165.  
  166.        environ = nenv;
  167. +#ifdef OS2
  168. +/* Wait for subprocess to keep this process alive */
  169. +/* Otherwise, Emacs would think the program ended when env ended */
  170. +      child = spawnvp (P_NOWAIT, *argv, (const char * const *)argv);
  171. +      if (child >= 0)
  172. +    {
  173. +      wait (0);
  174. +      exit (0);
  175. +    }
  176. +#else
  177.        (void) execvp (*argv, argv);
  178. +#endif
  179.  
  180.        fprintf (stderr, "%s: Cannot execute \"%s\"",
  181.             progname, *argv);
  182. diff -urP /mule-1.1/etc/killtree.c ./etc/killtree.c
  183. --- /mule-1.1/etc/killtree.c
  184. +++ ./etc/killtree.c    Mon Sep 27 19:06:06 1993
  185. @@ -0,0 +1,148 @@
  186. +/* Communication subprocess for GNU Emacs acting as server.
  187. +   Copyright (C) 1986, 1987, 1993 Free Software Foundation, Inc.
  188. +
  189. +This file is part of GNU Emacs.
  190. +
  191. +GNU Emacs is free software; you can redistribute it and/or modify
  192. +it under the terms of the GNU General Public License as published by
  193. +the Free Software Foundation; either version 1, or (at your option)
  194. +any later version.
  195. +
  196. +GNU Emacs is distributed in the hope that it will be useful,
  197. +but WITHOUT ANY WARRANTY; without even the implied warranty of
  198. +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  199. +GNU General Public License for more details.
  200. +
  201. +You should have received a copy of the GNU General Public License
  202. +along with GNU Emacs; see the file COPYING.  If not, write to
  203. +the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  204. +
  205. +#define    INCL_DOS
  206. +#include <os2.h>
  207. +#include <stdio.h>
  208. +#include <stdlib.h>
  209. +#include <process.h>
  210. +
  211. +#define    PROC_COUNT    1024
  212. +
  213. +/* #define DEBUG    1 */
  214. +
  215. +char        TempFileName[512] ;
  216. +unsigned char    Buf[2048] ;
  217. +FILE        *in ;
  218. +PID        KillPid ;
  219. +PID        KillProcessTable[512] ;
  220. +int        KillProcessTablePoint = 0 ;
  221. +PID        Pid[PROC_COUNT] ;
  222. +PID        Child[PROC_COUNT] ;
  223. +int        ProcessCount = 0 ;
  224. +
  225. +
  226. +
  227. +/****************************************/
  228. +/*                    */
  229. +/*    ÄqâvâìâZâXIDé≡îƒì⌡é╖éΘ        */
  230. +/*                    */
  231. +/* pid    ÉeâvâìâZâXID            */
  232. +/*                    */
  233. +/****************************************/
  234. +ScanChild( PID pid )
  235. +{
  236. +    int        loop ;
  237. +
  238. +    for ( loop = 0 ; loop < ProcessCount; ++loop ) {
  239. +    if ( pid == Child[loop] ) {
  240. +        KillProcessTable[KillProcessTablePoint++] = Pid[loop] ;
  241. +        ScanChild( Pid[loop] ) ;
  242. +    }
  243. +    }
  244. +}
  245. +
  246. +/****************************************/
  247. +/*                    */
  248. +/*ü@âvâìâZâXIDâeü|âuâïâ\ü|âgö╗ÆfÅêù¥    */
  249. +/*                    */
  250. +/****************************************/
  251. +int PidSort( PID *pid1, PID *pid2 )
  252. +{
  253. +    if ( *pid1 > *pid2 )
  254. +    return -1 ;
  255. +    if ( *pid1 < *pid2 )
  256. +    return 1 ;
  257. +    return 0 ;
  258. +}
  259. +
  260. +/********************************************************/
  261. +/*                            */
  262. +/*        âüâCâôÅêù¥                */
  263. +/*                            */
  264. +/* 3ö╘û┌é╠ê°Éöé╔ "-c" é≡òté»éΘé╞ÄqâvâìâZâXé╠é▌é≡ÄEé╖    */
  265. +/*                            */
  266. +/********************************************************/
  267. +main( int argc, char **argv )
  268. +{
  269. +    PID        pid, child ;
  270. +    int        loop ;
  271. +    ULONG    ret ;
  272. +    int        childonly ;
  273. +    char    *tmp ;
  274. +
  275. +    if ( argc < 3 )
  276. +    DosExit( EXIT_PROCESS, 1 ) ;
  277. +
  278. +    if ( argc == 3 ) {
  279. +    if ( strcmp( argv[2], "-c" ) == 0 )
  280. +        childonly = 1 ;
  281. +    else
  282. +        childonly = 0 ;
  283. +    }
  284. +    if ( ( tmp = getenv( "TMPDIR" ) ) == NULL )
  285. +    if ( ( tmp = getenv( "TMP" ) ) == NULL )
  286. +        if ( ( tmp = getenv( "TMEP" ) ) == NULL )
  287. +        tmp = "./" ;
  288. +    strcpy( TempFileName, tmp ) ;
  289. +    loop = strlen( TempFileName ) ; 
  290. +    if ( !(TempFileName[loop-1] == '/' || TempFileName[loop-1] == '\\') )
  291. +    strcat( TempFileName, "/" ) ;
  292. +    strcat( TempFileName, "killtree.tmp" ) ;
  293. +
  294. +    sscanf( argv[1], "%d", &KillPid ) ;
  295. +#ifdef DEBUG
  296. +    printf( "kill process = %d (0x%x)\n", KillPid, KillPid ) ;
  297. +    fflush(stdout);
  298. +    printf( "%s\n", TempFileName ) ;
  299. +    fflush(stdout);
  300. +#endif
  301. +    sprintf( Buf, "pstat/c > %s", TempFileName ) ;
  302. +    system( Buf ) ;
  303. +    in = fopen( TempFileName, "r" ) ;
  304. +
  305. +    /* â^âCâgâïé≡ô╟é▌ö≥é╬é╖ */
  306. +    for ( loop = 0; loop < 5; ++loop )
  307. +    fgets( Buf, 2048, in ) ;
  308. +
  309. +    /* âvâìâZâXâeü|âuâïé≡ì∞ɼé╖éΘ */
  310. +    while ( ( fgets( Buf, 2048, in ) ) != 0 ) {
  311. +    if ( Buf[1] == ' ' )
  312. +        continue ;
  313. +    sscanf( Buf, "%x %x", &Pid[ProcessCount], &Child[ProcessCount] ) ;
  314. +    ++ProcessCount ;
  315. +    }
  316. +    fclose( in ) ;
  317. +    unlink( TempFileName ) ;
  318. +
  319. +    if ( childonly ) {
  320. +    KillProcessTablePoint = 0 ;
  321. +    } else {
  322. +    KillProcessTable[0] = KillPid ;
  323. +    KillProcessTablePoint = 1 ;
  324. +    }
  325. +    ScanChild( KillPid ) ;
  326. +    qsort(KillProcessTable, KillProcessTablePoint, sizeof( PID ), PidSort ) ;
  327. +    for ( loop = 0; loop < KillProcessTablePoint; ++loop ) {
  328. +#ifdef DEBUG
  329. +    printf( "%d ", KillProcessTable[loop] ) ;
  330. +#endif
  331. +    DosKillProcess( DKP_PROCESS, KillProcessTable[loop] ) ;
  332. +    }
  333. +}
  334. diff -urP /mule-1.1/etc/make-docfile.c ./etc/make-docfile.c
  335. --- /mule-1.1/etc/make-docfile.c    Wed Apr 15 21:36:10 1992
  336. +++ ./etc/make-docfile.c    Sat Sep 25 07:06:48 1993
  337. @@ -48,12 +48,20 @@
  338.    i = 1;
  339.    if (argc > i + 1 && !strcmp (argv[i], "-o"))
  340.      {
  341. +#ifdef OS2 /* 93.8.20 by O.Sasaki */
  342. +      outfile = fopen (argv[i + 1], "wb");
  343. +#else
  344.        outfile = fopen (argv[i + 1], "w");
  345. +#endif
  346.        i += 2;
  347.      }
  348.    if (argc > i + 1 && !strcmp (argv[i], "-a"))
  349.      {
  350. +#ifdef OS2 /* 93.8.20 by O.Sasaki */
  351. +      outfile = fopen (argv[i + 1], "ab");
  352. +#else
  353.        outfile = fopen (argv[i + 1], "a");
  354. +#endif
  355.        i += 2;
  356.      }
  357.  
  358. @@ -282,6 +290,11 @@
  359.    register char *p;
  360.    int defvarflag;
  361.  
  362. +#ifdef OS2 /* 93.8.20 by O.Sasaki */
  363. +  if (strstr(filename, ".elc") != 0 )
  364. +    infile = fopen (filename, "rb");
  365. +  else
  366. +#endif
  367.    infile = fopen (filename, "r");
  368.    if (infile == NULL)
  369.      {
  370. diff -urP /mule-1.1/etc/Makefile.os2 ./etc/Makefile.os2
  371. --- /mule-1.1/etc/Makefile.os2
  372. +++ ./etc/Makefile.os2    Sun Nov 21 14:34:14 1993
  373. @@ -0,0 +1,187 @@
  374. +# For Solaris2. Needed for emacsclient
  375. +#  LOADLIBES= -lsocket -lnsl -lelf
  376. +# For Xenix.  Needed for movemail
  377. +#  LOADLIBES= -lx
  378. +# For Mips.  Needed for who knows what.
  379. +#  CFLAGS = -g -systype bsd43
  380. +
  381. +# 92.3.31  modified for Mule Ver.0.9.2 by K.Handa <handa@etl.go.jp>
  382. +#    Sun console feature added.
  383. +# 92.6.26  modified for Mule Ver.0.9.5 by K.Handa <handa@etl.go.jp>
  384. +#    bdftoscf uses BDF files defined by macro BDF_FILES in this file.
  385. +# 92.6.26  modified for Mule Ver.0.9.5
  386. +#        by T.Shimokawa <toshi@isl.rdc.toshiba.co.jp>
  387. +#    font.scf is created by calling "./bdftoscf".
  388. +# 92.8.6   modified for Mule Ver.0.9.6
  389. +#        by S.Kobayashi <koba@keisu-s.t.u-tokyo.ac.jp>
  390. +#    font.scf is removed under the target clean and distclean.
  391. +# 92.10.14 modified for Mule Ver.0.9.6 by K.Handa <handa@etl.go.jp>
  392. +#    font.scf is now not used, and bdfstaff and m2ps are added.
  393. +# 92.10.30 modified for Mule Ver.0.9.6 by K.Handa <handa@etl.go.jp>
  394. +#    Name change --  bdfstaff->bdf
  395. +# 92.10.30 modified for Mule Ver.0.9.7 by K.Handa <handa@etl.go.jp>
  396. +#    Change of the way to compile bdf.c.
  397. +# 93.2.10  modified for Mule Ver.0.9.7.1 by K.Handa <handa@etl.go.jp>
  398. +#    'distclean' should clean all.
  399. +# 93.5.7  modified for Mule Ver.0.9.8 by K.Handa <handa@etl.go.jp>
  400. +#    Support HEBREW and BIG5.
  401. +#    bdf.o depends on ../src/codeconv.h.
  402. +# 93.6.25 modified for Mule Ver.0.9.8 by K.Handa <handa@etl.go.jp>
  403. +#    Name change: charsets -> charset.
  404. +# 93.6.27  modified for Mule Ver.0.9.8 by K.Handa <handa@etl.go.jp>
  405. +#    m2ps depends on config.h and mule.h, compiled with ${LOADLIBS}
  406. +# 93.7.17  modified for Mule Ver.0.9.8
  407. +#            by Koaunghi Un <zraun01@hpserv.zdv.uni-tuebingen.de>
  408. +#    For Linux, /bin/sed -> sed.
  409. +# 93.7.27  modified for Mule Ver.0.9.8 by T.Saneto <sanewo@pdp.crl.sony.co.jp>
  410. +#    No need of ${LOADLIBS} for bdf.o.
  411. +
  412. +CC=gcc
  413. +CFLAGS= -g -DOS2
  414. +
  415. +EXECUTABLES = test-distrib.exe etags.exe ctags.exe wakeup.exe \
  416. +    make-docfile.exe digest-doc.exe sorted-doc.exe \
  417. +    movemail.exe cvtmail.exe sendmailuupc.exe yow.exe env.exe \
  418. +    server.exe emacsclient.exe killtree.exe
  419. +#    m2ps.exe
  420. +
  421. +all: ${EXECUTABLES}
  422. +
  423. +clean:
  424. +    -rm -f ${EXECUTABLES} core
  425. +
  426. +distclean:
  427. +    -rm -f ${EXECUTABLES} *~ \#* DOC* core bdf.o mule.1 m2ps.1 charset CHARSETS
  428. +
  429. +# This justs verifies that the non-ASCII characters
  430. +# in the file `testfile' have no been clobbered by
  431. +# whatever means were used to copy and distribute Emacs.
  432. +# If they were clobbered, all the .elc files were clobbered too.
  433. +test-distrib.exe: test-distrib.c
  434. +    $(CC) -o test-distrib.exe test-distrib.c
  435. +    ./test-distrib
  436. +
  437. +etags.exe: etags.c
  438. +    $(CC) -o etags.exe ${CFLAGS} -DETAGS etags.c $(LOADLIBES)
  439. +
  440. +ctags.exe: etags.c
  441. +    $(CC) -o ctags.exe ${CFLAGS} -DCTAGS etags.c $(LOADLIBES)
  442. +
  443. +wakeup.exe: wakeup.c
  444. +    $(CC) -o wakeup.exe ${CFLAGS} wakeup.c $(LOADLIBES)
  445. +
  446. +make-docfile.exe: make-docfile.c
  447. +    $(CC) -o make-docfile.exe ${CFLAGS} make-docfile.c $(LOADLIBES)
  448. +
  449. +digest-doc.exe: digest-doc.c
  450. +    $(CC) -o digest-doc.exe ${CFLAGS} digest-doc.c $(LOADLIBES)
  451. +
  452. +sorted-doc.exe: sorted-doc.c
  453. +    $(CC) -o sorted-doc.exe ${CFLAGS} sorted-doc.c $(LOADLIBES)
  454. +
  455. +movemail.exe: movemailuupc.c ../src/config.h
  456. +    $(CC) -o movemail.exe ${CFLAGS} movemailuupc.c $(LOADLIBES)
  457. +
  458. +cvtmail.exe: cvtmail.c
  459. +#    @echo Can't create cvtmail.exe !!!
  460. +#    $(CC) -o cvtmail ${CFLAGS} cvtmail.c $(LOADLIBES)
  461. +
  462. +#fakemail.exe: fakemail.c ../src/config.h
  463. +#    @echo Can't create fakemail.exe !!!
  464. +#    $(CC) -o fakemail.exe ${CFLAGS} fakemail.c $(LOADLIBES)
  465. +
  466. +sendmailuupc.exe: sendmailuupc.c
  467. +    $(CC) -o sendmailuupc.exe ${CFLAGS} sendmailuupc.c $(LOADLIBES)
  468. +
  469. +yow.exe: yow.c ../src/paths.h
  470. +    $(CC) -o yow.exe ${CFLAGS} yow.c $(LOADLIBES)
  471. +
  472. +# this is silly -- just use emacs to edit this file!
  473. +# (in any case this program doesn't preserve alphabetical ordering,
  474. +#  which is why I'm removing it)
  475. +#addyow: addyow.c
  476. +#    $(CC) -o addyow ${CFLAGS} addyow.c
  477. +
  478. +env.exe: env.c ../src/config.h
  479. +    $(CC) -o env.exe -DEMACS ${CFLAGS} env.c $(LOADLIBES)
  480. +
  481. +server.exe: server.c ../src/config.h
  482. +    $(CC) -o server.exe ${CFLAGS} server.c $(LOADLIBES)
  483. +
  484. +emacsclient.exe: emacsclient.c ../src/config.h
  485. +    $(CC) -o emacsclient.exe ${CFLAGS} emacsclient.c $(LOADLIBES)
  486. +
  487. +killtree.exe: killtree.c
  488. +    $(CC) -o killtree.exe ${CFLAGS} killtree.c $(LOADLIBES)
  489. +
  490. +# This one is NOT included in EXECUTABLES.
  491. +# See ../src/ymakefile.
  492. +emacstool: emacstool.c
  493. +    $(CC) -o emacstool ${CFLAGS} emacstool.c -lsuntool -lsunwindow -lpixrect $(LOADLIBES)
  494. +
  495. +nemacstool: emacstool.c
  496. +    $(CC) -o nemacstool ${CFLAGS} -DJLE emacstool.c -lsuntool -lmle -lsunwindow -lpixrect $(LOADLIBES)    # For SUN Japanese Language Environment
  497. +
  498. +xvetool: emacstool.c
  499. +    $(CC) -o xvetool ${CFLAGS} -DXVIEW         emacstool.c -lxview -lolgx -lX -I$(OPENWINHOME)/include -L$(OPENWINHOME)/lib $(LOADLIBES)
  500. +
  501. +xveterm: emacstool.c
  502. +    $(CC) -o xveterm ${CFLAGS} -DXVIEW -DTTERM emacstool.c -lxview -lolgx -lX -I$(OPENWINHOME)/include -L$(OPENWINHOME)/lib $(LOADLIBES)
  503. +
  504. +# 92.6.26, 92.10.14 by K.Handa
  505. +XV11R5 = /usr/share/src/X.V11R5
  506. +BDF_PATH = -DBDF_PATH=\"${XV11R5}/mit/fonts/bdf/misc,${XV11R5}/contrib/clients/cxterm/fonts,/usr/share/fonts/X11/ETL,/usr/share/fonts/X11/cxterm\"
  507. +# Each one-byte font may have encoding information as
  508. +#    bdf_file_name:encoding
  509. +# where encoding is 0 or 1 and defaults to 0.
  510. +# You also can specify or override the following definitions
  511. +# by manually editing 'CHARSETS'.
  512. +ASCII = etl24-latin1.bdf:0
  513. +LATIN1 = etl24-latin1.bdf:1
  514. +LATIN2 = etl24-latin2.bdf:1
  515. +LATIN3 = etl24-latin3.bdf:1
  516. +LATIN4 = etl24-latin4.bdf:1
  517. +GREEK = etl24-greek.bdf:1
  518. +HEBREW = etl24-hebrew.bdf:1
  519. +KANA = 12x24rk.bdf:1
  520. +ROMAN = 12x24rk.bdf:0
  521. +CYRILLIC = etl24-cyrillic.bdf:1
  522. +LATIN5 = etl24-latin5.bdf:1
  523. +CHINESE = cclib24st.bdf
  524. +JAPANESE = jiskan24.bdf
  525. +KOREAN = hanglm24.bdf
  526. +BIG5 = taipei24.bdf:1
  527. +SISHENG = etl24-sisheng.bdf:0
  528. +THAI = etl24-thai.bdf:1
  529. +
  530. +SED_SCRIPT =\
  531. +    -e "/LC:BYTES:/s/\(.*\)/\1[:BDF-FILE[:ENCODING]]/" \
  532. +    -e "/ASCII$$/s/\(.*\)/\1:${ASCII}/" \
  533. +    -e "/Latin-1$$/s/\(.*\)/\1:${LATIN1}/" \
  534. +    -e "/Latin-2$$/s/\(.*\)/\1:${LATIN2}/" \
  535. +    -e "/Latin-3$$/s/\(.*\)/\1:${LATIN3}/" \
  536. +    -e "/Latin-4$$/s/\(.*\)/\1:${LATIN4}/" \
  537. +    -e "/Greek$$/s/\(.*\)/\1:${GREEK}/" \
  538. +    -e "/Hebrew$$/s/\(.*\)/\1:${HEBREW}/" \
  539. +    -e "/Katakana$$/s/\(.*\)/\1:${KANA}/" \
  540. +    -e "/Roman$$/s/\(.*\)/\1:${ROMAN}/" \
  541. +    -e "/Cyrillic$$/s/\(.*\)/\1:${CYRILLIC}/" \
  542. +    -e "/Latin-5$$/s/\(.*\)/\1:${LATIN5}/" \
  543. +    -e "/Chinese$$/s/\(.*\)/\1:${CHINESE}/" \
  544. +    -e "/Japanese$$/s/\(.*\)/\1:${JAPANESE}/" \
  545. +    -e "/Korean$$/s/\(.*\)/\1:${KOREAN}/" \
  546. +    -e "/Big5/s/\(.*\)/\1:${BIG5}/" \
  547. +    -e "/ZhuYin$$/s/\(.*\)/\1:${SISHENG}/" \
  548. +    -e "/TSCII$$/s/\(.*\)/\1:${THAI}/"
  549. +
  550. +CHARSETS: charset
  551. +    sed ${SED_SCRIPT} < charset > CHARSETS
  552. +
  553. +bdf.o: bdf.c bdf.h Makefile\
  554. +    ../src/config.h ../src/mule.h ../src/paths.h ../src/codeconv.h
  555. +    $(CC) -c ${CFLAGS} bdf.c ${BDF_PATH}
  556. +
  557. +#m2ps: bdf.h m2ps.c bdf.o ../src/config.h ../src/mule.h ../src/paths.h
  558. +#    -$(CC) -o m2ps ${CFLAGS} m2ps.c bdf.o ${LOADLIBES}
  559. +
  560. +# end of patch
  561. diff -urP /mule-1.1/etc/movemailuupc.c ./etc/movemailuupc.c
  562. --- /mule-1.1/etc/movemailuupc.c
  563. +++ ./etc/movemailuupc.c    Tue Jan 18 16:51:24 1994
  564. @@ -0,0 +1,839 @@
  565. +/* movemail foo bar -- move file foo to file bar,
  566. +   locking file foo the way /bin/mail respects.
  567. +   Copyright (C) 1986 Free Software Foundation, Inc.
  568. +
  569. +This file is part of GNU Emacs.
  570. +
  571. +GNU Emacs is free software; you can redistribute it and/or modify
  572. +it under the terms of the GNU General Public License as published by
  573. +the Free Software Foundation; either version 1, or (at your option)
  574. +any later version.
  575. +
  576. +GNU Emacs is distributed in the hope that it will be useful,
  577. +but WITHOUT ANY WARRANTY; without even the implied warranty of
  578. +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  579. +GNU General Public License for more details.
  580. +
  581. +You should have received a copy of the GNU General Public License
  582. +along with GNU Emacs; see the file COPYING.  If not, write to
  583. +the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  584. +
  585. +/* Important notice: defining MAIL_USE_FLOCK *will cause loss of mail*
  586. +   if you do it on a system that does not normally use flock as its way of
  587. +   interlocking access to inbox files.  The setting of MAIL_USE_FLOCK
  588. +   *must agree* with the system's own conventions.
  589. +   It is not a choice that is up to you.
  590. +
  591. +   So, if your system uses lock files rather than flock, then the only way
  592. +   you can get proper operation is to enable movemail to write lockfiles there.
  593. +   This means you must either give that directory access modes
  594. +   that permit everyone to write lockfiles in it, or you must make movemail
  595. +   a setuid or setgid program.  */
  596. +
  597. +/*
  598. + * Modified January, 1986 by Michael R. Gretzinger (Project Athena)
  599. + *
  600. + * Added POP (Post Office Protocol) service.  When compiled -DPOP
  601. + * movemail will accept input filename arguments of the form
  602. + * "po:username".  This will cause movemail to open a connection to
  603. + * a pop server running on $MAILHOST (environment variable).  Movemail
  604. + * must be setuid to root in order to work with POP.
  605. + * 
  606. + * New module: popmail.c
  607. + * Modified routines:
  608. + *    main - added code within #ifdef MAIL_USE_POP; added setuid (getuid ())
  609. + *        after POP code. 
  610. + * New routines in movemail.c:
  611. + *    get_errmsg - return pointer to system error message
  612. + *
  613. + */
  614. +
  615. +#include <sys/types.h>
  616. +#include <sys/stat.h>
  617. +#include <sys/file.h>
  618. +#include <errno.h>
  619. +#define NO_SHORTNAMES   /* Tell config not to load remap.h */
  620. +#include "../src/config.h"
  621. +
  622. +#ifdef USG
  623. +#include <fcntl.h>
  624. +#include <unistd.h>
  625. +#ifndef F_OK
  626. +#define F_OK 0
  627. +#define X_OK 1
  628. +#define W_OK 2
  629. +#define R_OK 4
  630. +#endif
  631. +#endif /* USG */
  632. +
  633. +#ifdef XENIX
  634. +#include <sys/locking.h>
  635. +#endif
  636. +
  637. +#ifdef MAIL_USE_MMDF
  638. +extern int lk_open (), lk_close ();
  639. +#endif
  640. +
  641. +/* Cancel substitutions made by config.h for Emacs.  */
  642. +#undef open
  643. +#undef read
  644. +#undef write
  645. +#undef close
  646. +
  647. +#ifdef OS2
  648. +#include <stdio.h>
  649. +#endif
  650. +
  651. +char *concat ();
  652. +extern int errno;
  653. +
  654. +/* Nonzero means this is name of a lock file to delete on fatal error.  */
  655. +char *delete_lockname;
  656. +
  657. +main (argc, argv)
  658. +     int argc;
  659. +     char **argv;
  660. +{
  661. +  char *inname, *outname;
  662. +  int indesc, outdesc;
  663. +  char buf[1024];
  664. +  int nread;
  665. +#ifdef OS2
  666. +  FILE *infp, *outfp ;
  667. +#endif
  668. +
  669. +#ifndef MAIL_USE_FLOCK
  670. +  struct stat st;
  671. +  long now;
  672. +  int tem;
  673. +  char *lockname, *p;
  674. +  char *tempname;
  675. +  int desc;
  676. +#endif /* not MAIL_USE_FLOCK */
  677. +
  678. +  delete_lockname = 0;
  679. +
  680. +  if (argc < 3)
  681. +    fatal ("two arguments required");
  682. +
  683. +  inname = argv[1];
  684. +  outname = argv[2];
  685. +
  686. +#ifdef MAIL_USE_MMDF
  687. +  mmdf_init (argv[0]);
  688. +#endif
  689. +
  690. +  /* Check access to output file.  */
  691. +  if (access (outname, F_OK) == 0 && access (outname, W_OK) != 0)
  692. +    pfatal_with_name (outname);
  693. +
  694. +#ifndef OS2
  695. +  /* Also check that outname's directory is writeable to the real uid.  */
  696. +  {
  697. +    char *buf = (char *) malloc (strlen (outname) + 1);
  698. +    char *p, q;
  699. +    strcpy (buf, outname);
  700. +    p = buf + strlen (buf);
  701. +    while (p > buf && p[-1] != '/')
  702. +      *--p = 0;
  703. +    if (p == buf)
  704. +      *p++ = '.';
  705. +
  706. +    printf( "buf = %s\n",buf);
  707. +
  708. +    if (access (buf, W_OK) != 0)
  709. +      pfatal_with_name (buf);
  710. +    free (buf);
  711. +  }
  712. +#endif
  713. +
  714. +#ifdef MAIL_USE_POP
  715. +  if (!bcmp (inname, "po:", 3))
  716. +    {
  717. +      int status; char *user;
  718. +
  719. +      user = (char *) rindex (inname, ':') + 1;
  720. +      status = popmail (user, outname);
  721. +      exit (status);
  722. +    }
  723. +
  724. +  setuid (getuid ());
  725. +#endif /* MAIL_USE_POP */
  726. +
  727. +  /* Check access to input file.  */
  728. +  if (access (inname, R_OK | W_OK) != 0)
  729. +    pfatal_with_name (inname);
  730. +
  731. +#ifndef MAIL_USE_MMDF
  732. +#ifndef MAIL_USE_FLOCK
  733. +  /* Use a lock file named /usr/spool/mail/$USER.lock:
  734. +     If it exists, the mail file is locked.  */
  735. +  /* Note: this locking mechanism is *required* by the mailer
  736. +     (on systems which use it) to prevent loss of mail.
  737. +
  738. +     On systems that use a lock file, extracting the mail without locking
  739. +     WILL occasionally cause loss of mail due to timing errors!
  740. +
  741. +     So, if creation of the lock file fails
  742. +     due to access permission on /usr/spool/mail,
  743. +     you simply MUST change the permission
  744. +     and/or make movemail a setgid program
  745. +     so it can create lock files properly.
  746. +
  747. +     You might also wish to verify that your system is one
  748. +     which uses lock files for this purpose.  Some systems use other methods.
  749. +
  750. +     If your system uses the `flock' system call for mail locking,
  751. +     define MAIL_USE_FLOCK in config.h or the s-*.h file
  752. +     and recompile movemail.  If the s- file for your system
  753. +     should define MAIL_USE_FLOCK but does not, send a bug report
  754. +     to bug-gnu-emacs@prep.ai.mit.edu so we can fix it.  */
  755. +
  756. +  lockname = concat (inname, ".lock", "");
  757. +  tempname = (char *) xmalloc (strlen (inname) + 20);
  758. +  strcpy (tempname, inname);
  759. +  p = tempname + strlen (tempname);
  760. +  while (p != tempname && p[-1] != '/')
  761. +    p--;
  762. +  *p = 0;
  763. +  strcpy (p, "EXXXXXX");
  764. +  mktemp (tempname);
  765. +  unlink (tempname);
  766. +
  767. +  while (1)
  768. +    {
  769. +      /* Create the lock file, but not under the lock file name.  */
  770. +      /* Give up if cannot do that.  */
  771. +      desc = open (tempname, O_WRONLY | O_CREAT, 0666);
  772. +      if (desc < 0)
  773. +        pfatal_with_name ("lock file--see source file etc/movemail.c");
  774. +      close (desc);
  775. +
  776. +      /*osamu debug
  777. +      tem = link (tempname, lockname);*/
  778. +      unlink (tempname);
  779. +      if (tem >= 0)
  780. +    break;
  781. +      sleep (1);
  782. +
  783. +      /* If lock file is a minute old, unlock it.  */
  784. +      if (stat (lockname, &st) >= 0)
  785. +    {
  786. +      now = time (0);
  787. +      if (st.st_ctime < now - 60)
  788. +        unlink (lockname);
  789. +    }
  790. +    }
  791. +
  792. +  delete_lockname = lockname;
  793. +#endif /* not MAIL_USE_FLOCK */
  794. +
  795. +#ifndef OS2
  796. +#ifdef MAIL_USE_FLOCK
  797. +  indesc = open (inname, O_RDWR);
  798. +#else /* if not MAIL_USE_FLOCK */
  799. +  indesc = open (inname, O_RDONLY);
  800. +#endif /* not MAIL_USE_FLOCK */
  801. +#else /* OS2 */
  802. +  infp = fopen (inname, "r");
  803. +  if (infp == NULL )
  804. +    pfatal_with_name (inname);
  805. +#endif /* OS2 */
  806. +#else /* MAIL_USE_MMDF */
  807. +  indesc = lk_open (inname, O_RDONLY, 0, 0, 10);
  808. +#endif /* MAIL_USE_MMDF */
  809. +#ifndef OS2
  810. +  if (indesc < 0)
  811. +    pfatal_with_name (inname);
  812. +#endif
  813. +
  814. +#if defined (BSD) || defined (XENIX)
  815. +  /* In case movemail is setuid to root, make sure the user can
  816. +     read the output file.  */
  817. +  /* This is desirable for all systems
  818. +     but I don't want to assume all have the umask system call */
  819. +  umask (umask (0) & 0333);
  820. +#endif /* BSD or Xenix */
  821. +
  822. +#ifndef OS2
  823. +  outdesc = open (outname, O_WRONLY | O_CREAT | O_EXCL, 0666);
  824. +  if (outdesc < 0)
  825. +    pfatal_with_name (outname);
  826. +#else
  827. +  outfp = fopen (outname, "wb" ) ;
  828. +  if (outfp == NULL)
  829. +    pfatal_with_name (outname);
  830. +#endif /* OS2 */
  831. +
  832. +#ifdef MAIL_USE_FLOCK
  833. +#ifdef XENIX
  834. +  if (locking (indesc, LK_RLCK, 0L) < 0) pfatal_with_name (inname);
  835. +#else
  836. +  if (flock (indesc, LOCK_EX) < 0) pfatal_with_name (inname);
  837. +#endif
  838. +#endif /* MAIL_USE_FLOCK */
  839. +
  840. +#ifdef OS2
  841. +  fgets( buf, sizeof(buf), infp ) ; /* skip start line */
  842. +  while ( fgets( buf, sizeof(buf), infp ) != NULL ) {
  843. +      if ( *buf == (char)0x01 )
  844. +      strcpy( buf,"\n" ) ;
  845. +      if ( strncmp( buf, "From ", 5 ) == 0 ) {
  846. +      char    from[8] ;
  847. +      char    name[64] ;
  848. +      char    youbi[8] ;
  849. +      char    hi[8] ;
  850. +      char    tuki[8] ;
  851. +      char    nen[8] ;
  852. +      char    time[16] ;
  853. +/*
  854. +From ibmpc-request@yinu.co.jp Fri, 22 Oct 1993 09:30:50 JST remote from yinugw
  855. +From cla@yinu.co.jp           Sat Oct 16 17:32:47 1993
  856. +*/
  857. +      sscanf( buf, "%s %s %s %s %s %s %s"
  858. +         , from
  859. +         , name
  860. +         , youbi
  861. +         , hi
  862. +         , tuki
  863. +         , nen
  864. +         , time
  865. +         ) ;
  866. +      youbi[strlen( youbi ) -1] = '\0' ;
  867. +      sprintf( buf, "%s %s %s %s %s %s %s\n"
  868. +         , from
  869. +         , name
  870. +         , youbi
  871. +         , tuki
  872. +         , hi
  873. +         , time
  874. +         , nen
  875. +         ) ;
  876. +      }
  877. +#ifdef DEBUG
  878. +      printf( "%s", buf ) ;
  879. +#endif
  880. +      if ( fputs( buf, outfp ) ) {
  881. +      int saved_errno = errno;
  882. +      unlink (outname);
  883. +      errno = saved_errno;
  884. +      pfatal_with_name (outname);
  885. +      }
  886. +  }
  887. +  fputs( "\n", outfp ) ;
  888. +#else
  889. +  while (1)
  890. +    {
  891. +      nread = read (indesc, buf, sizeof buf);
  892. +      if (nread != write (outdesc, buf, nread))
  893. +    {
  894. +      int saved_errno = errno;
  895. +      unlink (outname);
  896. +      errno = saved_errno;
  897. +      pfatal_with_name (outname);
  898. +    }
  899. +      if (nread < sizeof buf)
  900. +    break;
  901. +    }
  902. +#endif
  903. +
  904. +#ifdef BSD
  905. +  if (fsync (outdesc) < 0)
  906. +    pfatal_and_delete (outname);
  907. +#endif
  908. +
  909. +#ifndef OS2
  910. +  /* Check to make sure no errors before we zap the inbox.  */
  911. +  if (close (outdesc) != 0)
  912. +    pfatal_and_delete (outname);
  913. +#else /* OS2 */
  914. +  if (fclose (outfp) != 0)
  915. +    pfatal_and_delete (outname);
  916. +#endif
  917. +
  918. +#ifdef MAIL_USE_FLOCK
  919. +#if defined (STRIDE) || defined (XENIX)
  920. +  /* Stride, xenix have file locking, but no ftruncate.  This mess will do. */
  921. +  close (open (inname, O_CREAT | O_TRUNC | O_RDWR, 0666));
  922. +#else
  923. +  ftruncate (indesc, 0L);
  924. +#endif /* STRIDE or XENIX */
  925. +#endif /* MAIL_USE_FLOCK */
  926. +
  927. +#ifdef MAIL_USE_MMDF
  928. +  lk_close (indesc, 0, 0, 0);
  929. +#else
  930. +#ifdef OS2
  931. +  fclose( infp ) ;
  932. +#else
  933. +  close (indesc);
  934. +#endif
  935. +#endif
  936. +
  937. +#ifndef MAIL_USE_FLOCK
  938. +  /* Delete the input file; if we can't, at least get rid of its contents.  */
  939. +  if (unlink (inname) < 0)
  940. +    if (errno != ENOENT)
  941. +      creat (inname, 0666);
  942. +#ifndef MAIL_USE_MMDF
  943. +  unlink (lockname);
  944. +#endif /* not MAIL_USE_MMDF */
  945. +#endif /* not MAIL_USE_FLOCK */
  946. +  exit (0);
  947. +}
  948. +
  949. +/* Print error message and exit.  */
  950. +
  951. +fatal (s1, s2)
  952. +     char *s1, *s2;
  953. +{
  954. +  if (delete_lockname)
  955. +    unlink (delete_lockname);
  956. +  error (s1, s2);
  957. +  exit (1);
  958. +}
  959. +
  960. +/* Print error message.  `s1' is printf control string, `s2' is arg for it. */
  961. +
  962. +error (s1, s2, s3)
  963. +     char *s1, *s2, *s3;
  964. +{
  965. +  printf ("movemail: ");
  966. +  printf (s1, s2, s3);
  967. +  printf ("\n");
  968. +}
  969. +
  970. +pfatal_with_name (name)
  971. +     char *name;
  972. +{
  973. +  extern int errno, sys_nerr;
  974. +  extern char *sys_errlist[];
  975. +  char *s;
  976. +
  977. +  if (errno < sys_nerr)
  978. +    s = concat ("", sys_errlist[errno], " for %s");
  979. +  else
  980. +    s = "cannot open %s";
  981. +  fatal (s, name);
  982. +}
  983. +
  984. +pfatal_and_delete (name)
  985. +     char *name;
  986. +{
  987. +  extern int errno, sys_nerr;
  988. +  extern char *sys_errlist[];
  989. +  char *s;
  990. +
  991. +  if (errno < sys_nerr)
  992. +    s = concat ("", sys_errlist[errno], " for %s");
  993. +  else
  994. +    s = "cannot open %s";
  995. +
  996. +  unlink (name);
  997. +  fatal (s, name);
  998. +}
  999. +
  1000. +/* Return a newly-allocated string whose contents concatenate those of s1, s2, s3.  */
  1001. +
  1002. +char *
  1003. +concat (s1, s2, s3)
  1004. +     char *s1, *s2, *s3;
  1005. +{
  1006. +  int len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3);
  1007. +  char *result = (char *) xmalloc (len1 + len2 + len3 + 1);
  1008. +
  1009. +  strcpy (result, s1);
  1010. +  strcpy (result + len1, s2);
  1011. +  strcpy (result + len1 + len2, s3);
  1012. +  *(result + len1 + len2 + len3) = 0;
  1013. +
  1014. +  return result;
  1015. +}
  1016. +
  1017. +/* Like malloc but get fatal error if memory is exhausted.  */
  1018. +
  1019. +int
  1020. +xmalloc (size)
  1021. +     int size;
  1022. +{
  1023. +  int result = malloc (size);
  1024. +  if (!result)
  1025. +    fatal ("virtual memory exhausted", 0);
  1026. +  return result;
  1027. +}
  1028. +
  1029. +/* This is the guts of the interface to the Post Office Protocol.  */
  1030. +
  1031. +#ifdef MAIL_USE_POP
  1032. +
  1033. +#include <sys/socket.h>
  1034. +#include <netinet/in.h>
  1035. +#include <netdb.h>
  1036. +#include <stdio.h>
  1037. +#include <pwd.h>
  1038. +
  1039. +#ifdef USG
  1040. +#include <fcntl.h>
  1041. +/* Cancel substitutions made by config.h for Emacs.  */
  1042. +#undef open
  1043. +#undef read
  1044. +#undef write
  1045. +#undef close
  1046. +#endif /* USG */
  1047. +
  1048. +#define NOTOK (-1)
  1049. +#define OK 0
  1050. +#define DONE 1
  1051. +
  1052. +char *progname;
  1053. +FILE *sfi;
  1054. +FILE *sfo;
  1055. +char Errmsg[80];
  1056. +
  1057. +static int debug = 0;
  1058. +
  1059. +char *get_errmsg ();
  1060. +char *getenv ();
  1061. +int mbx_write ();
  1062. +
  1063. +popmail (user, outfile)
  1064. +     char *user;
  1065. +     char *outfile;
  1066. +{
  1067. +  char *host;
  1068. +  int nmsgs, nbytes;
  1069. +  char response[128];
  1070. +  register int i;
  1071. +  int mbfi;
  1072. +  FILE *mbf;
  1073. +  struct passwd *pw = (struct passwd *) getpwuid (getuid ());
  1074. +  if (pw == NULL)
  1075. +    fatal ("cannot determine user name");
  1076. +
  1077. +  host = getenv ("MAILHOST");
  1078. +  if (host == NULL)
  1079. +    {
  1080. +      fatal ("no MAILHOST defined");
  1081. +    }
  1082. +
  1083. +  if (pop_init (host) == NOTOK)
  1084. +    {
  1085. +      fatal (Errmsg);
  1086. +    }
  1087. +
  1088. +  if (getline (response, sizeof response, sfi) != OK)
  1089. +    {
  1090. +      fatal (response);
  1091. +    }
  1092. +
  1093. +  if (pop_command ("USER %s", user) == NOTOK
  1094. +      || pop_command ("RPOP %s", pw->pw_name) == NOTOK)
  1095. +    {
  1096. +      pop_command ("QUIT");
  1097. +      fatal (Errmsg);
  1098. +    }
  1099. +
  1100. +  if (pop_stat (&nmsgs, &nbytes) == NOTOK)
  1101. +    {
  1102. +      pop_command ("QUIT");
  1103. +      fatal (Errmsg);
  1104. +    }
  1105. +
  1106. +  if (!nmsgs)
  1107. +    {
  1108. +      pop_command ("QUIT");
  1109. +      return 0;
  1110. +    }
  1111. +
  1112. +  mbfi = open (outfile, O_WRONLY | O_CREAT | O_EXCL, 0666);
  1113. +  if (mbfi < 0)
  1114. +    {
  1115. +      pop_command ("QUIT");
  1116. +      pfatal_and_delete (outfile);
  1117. +    }
  1118. +  fchown (mbfi, getuid (), -1);
  1119. +
  1120. +  if ((mbf = fdopen (mbfi, "w")) == NULL)
  1121. +    {
  1122. +      pop_command ("QUIT");
  1123. +      pfatal_and_delete (outfile);
  1124. +    }
  1125. +
  1126. +  for (i = 1; i <= nmsgs; i++)
  1127. +    {
  1128. +      mbx_delimit_begin (mbf);
  1129. +      if (pop_retr (i, mbx_write, mbf) != OK)
  1130. +    {
  1131. +      pop_command ("QUIT");
  1132. +      close (mbfi);
  1133. +      unlink (outfile);
  1134. +      fatal (Errmsg);
  1135. +    }
  1136. +      mbx_delimit_end (mbf);
  1137. +      fflush (mbf);
  1138. +    }
  1139. +
  1140. +  if (fsync (mbfi) < 0)
  1141. +    {
  1142. +      pop_command ("QUIT");
  1143. +      pfatal_and_delete (outfile);
  1144. +    }
  1145. +
  1146. +  if (close (mbfi) == -1)
  1147. +    {
  1148. +      pop_command ("QUIT");
  1149. +      pfatal_and_delete (outfile);
  1150. +    }
  1151. +
  1152. +  for (i = 1; i <= nmsgs; i++)
  1153. +    {
  1154. +      if (pop_command ("DELE %d", i) == NOTOK)
  1155. +    {
  1156. +      /* Better to ignore this failure.  */
  1157. +    }
  1158. +    }
  1159. +
  1160. +  pop_command ("QUIT");
  1161. +  return (0);
  1162. +}
  1163. +
  1164. +pop_init (host)
  1165. +     char *host;
  1166. +{
  1167. +  register struct hostent *hp;
  1168. +  register struct servent *sp;
  1169. +  int lport = IPPORT_RESERVED - 1;
  1170. +  struct sockaddr_in sin;
  1171. +  register int s;
  1172. +
  1173. +  hp = gethostbyname (host);
  1174. +  if (hp == NULL)
  1175. +    {
  1176. +      sprintf (Errmsg, "MAILHOST unknown: %s", host);
  1177. +      return NOTOK;
  1178. +    }
  1179. +
  1180. +  sp = getservbyname ("pop", "tcp");
  1181. +  if (sp == 0)
  1182. +    {
  1183. +      strcpy (Errmsg, "tcp/pop: unknown service");
  1184. +      return NOTOK;
  1185. +    }
  1186. +
  1187. +  sin.sin_family = hp->h_addrtype;
  1188. +  bcopy (hp->h_addr, (char *)&sin.sin_addr, hp->h_length);
  1189. +  sin.sin_port = sp->s_port;
  1190. +  s = rresvport (&lport);
  1191. +  if (s < 0)
  1192. +    {
  1193. +      sprintf (Errmsg, "error creating socket: %s", get_errmsg ());
  1194. +      return NOTOK;
  1195. +    }
  1196. +
  1197. +  if (connect (s, (char *)&sin, sizeof sin) < 0)
  1198. +    {
  1199. +      sprintf (Errmsg, "error during connect: %s", get_errmsg ());
  1200. +      close (s);
  1201. +      return NOTOK;
  1202. +    }
  1203. +
  1204. +  sfi = fdopen (s, "r");
  1205. +  sfo = fdopen (s, "w");
  1206. +  if (sfi == NULL || sfo == NULL)
  1207. +    {
  1208. +      sprintf (Errmsg, "error in fdopen: %s", get_errmsg ());
  1209. +      close (s);
  1210. +      return NOTOK;
  1211. +    }
  1212. +
  1213. +  return OK;
  1214. +}
  1215. +
  1216. +pop_command (fmt, a, b, c, d)
  1217. +     char *fmt;
  1218. +{
  1219. +  char buf[128];
  1220. +  char errmsg[64];
  1221. +
  1222. +  sprintf (buf, fmt, a, b, c, d);
  1223. +
  1224. +  if (debug) fprintf (stderr, "---> %s\n", buf);
  1225. +  if (putline (buf, Errmsg, sfo) == NOTOK) return NOTOK;
  1226. +
  1227. +  if (getline (buf, sizeof buf, sfi) != OK)
  1228. +    {
  1229. +      strcpy (Errmsg, buf);
  1230. +      return NOTOK;
  1231. +    }
  1232. +
  1233. +  if (debug)
  1234. +    fprintf (stderr, "<--- %s\n", buf);
  1235. +  if (*buf != '+')
  1236. +    {
  1237. +      strcpy (Errmsg, buf);
  1238. +      return NOTOK;
  1239. +    }
  1240. +  else
  1241. +    {
  1242. +      return OK;
  1243. +    }
  1244. +}
  1245. +
  1246. +    
  1247. +pop_stat (nmsgs, nbytes)
  1248. +     int *nmsgs, *nbytes;
  1249. +{
  1250. +  char buf[128];
  1251. +
  1252. +  if (debug)
  1253. +    fprintf (stderr, "---> STAT\n");
  1254. +  if (putline ("STAT", Errmsg, sfo) == NOTOK)
  1255. +    return NOTOK;
  1256. +
  1257. +  if (getline (buf, sizeof buf, sfi) != OK)
  1258. +    {
  1259. +      strcpy (Errmsg, buf);
  1260. +      return NOTOK;
  1261. +    }
  1262. +
  1263. +  if (debug) fprintf (stderr, "<--- %s\n", buf);
  1264. +  if (*buf != '+')
  1265. +    {
  1266. +      strcpy (Errmsg, buf);
  1267. +      return NOTOK;
  1268. +    }
  1269. +  else
  1270. +    {
  1271. +      sscanf (buf, "+OK %d %d", nmsgs, nbytes);
  1272. +      return OK;
  1273. +    }
  1274. +}
  1275. +
  1276. +pop_retr (msgno, action, arg)
  1277. +     int (*action)();
  1278. +{
  1279. +  char buf[128];
  1280. +
  1281. +  sprintf (buf, "RETR %d", msgno);
  1282. +  if (debug) fprintf (stderr, "%s\n", buf);
  1283. +  if (putline (buf, Errmsg, sfo) == NOTOK) return NOTOK;
  1284. +
  1285. +  if (getline (buf, sizeof buf, sfi) != OK)
  1286. +    {
  1287. +      strcpy (Errmsg, buf);
  1288. +      return NOTOK;
  1289. +    }
  1290. +
  1291. +  while (1)
  1292. +    {
  1293. +      switch (multiline (buf, sizeof buf, sfi))
  1294. +    {
  1295. +    case OK:
  1296. +      (*action)(buf, arg);
  1297. +      break;
  1298. +    case DONE:
  1299. +      return OK;
  1300. +    case NOTOK:
  1301. +      strcpy (Errmsg, buf);
  1302. +      return NOTOK;
  1303. +    }
  1304. +    }
  1305. +}
  1306. +
  1307. +getline (buf, n, f)
  1308. +     char *buf;
  1309. +     register int n;
  1310. +     FILE *f;
  1311. +{
  1312. +  register char *p;
  1313. +  int c;
  1314. +
  1315. +  p = buf;
  1316. +  while (--n > 0 && (c = fgetc (f)) != EOF)
  1317. +    if ((*p++ = c) == '\n') break;
  1318. +
  1319. +  if (ferror (f))
  1320. +    {
  1321. +      strcpy (buf, "error on connection");
  1322. +      return NOTOK;
  1323. +    }
  1324. +
  1325. +  if (c == EOF && p == buf)
  1326. +    {
  1327. +      strcpy (buf, "connection closed by foreign host");
  1328. +      return DONE;
  1329. +    }
  1330. +
  1331. +  *p = NULL;
  1332. +  if (*--p == '\n') *p = NULL;
  1333. +  if (*--p == '\r') *p = NULL;
  1334. +  return OK;
  1335. +}
  1336. +
  1337. +multiline (buf, n, f)
  1338. +     char *buf;
  1339. +     register int n;
  1340. +     FILE *f;
  1341. +{
  1342. +  if (getline (buf, n, f) != OK)
  1343. +    return NOTOK;
  1344. +  if (*buf == '.')
  1345. +    {
  1346. +      if (*(buf+1) == NULL)
  1347. +    return DONE;
  1348. +      else
  1349. +    strcpy (buf, buf+1);
  1350. +    }
  1351. +  return OK;
  1352. +}
  1353. +
  1354. +char *
  1355. +get_errmsg ()
  1356. +{
  1357. +  extern int errno, sys_nerr;
  1358. +  extern char *sys_errlist[];
  1359. +  char *s;
  1360. +
  1361. +  if (errno < sys_nerr)
  1362. +    s = sys_errlist[errno];
  1363. +  else
  1364. +    s = "unknown error";
  1365. +  return (s);
  1366. +}
  1367. +
  1368. +putline (buf, err, f)
  1369. +     char *buf;
  1370. +     char *err;
  1371. +     FILE *f;
  1372. +{
  1373. +  fprintf (f, "%s\r\n", buf);
  1374. +  fflush (f);
  1375. +  if (ferror (f))
  1376. +    {
  1377. +      strcpy (err, "lost connection");
  1378. +      return NOTOK;
  1379. +    }
  1380. +  return OK;
  1381. +}
  1382. +
  1383. +mbx_write (line, mbf)
  1384. +     char *line;
  1385. +     FILE *mbf;
  1386. +{
  1387. +  fputs (line, mbf);
  1388. +  fputc (0x0a, mbf);
  1389. +}
  1390. +
  1391. +mbx_delimit_begin (mbf)
  1392. +     FILE *mbf;
  1393. +{
  1394. +  fputs ("\f\n0, unseen,,\n", mbf);
  1395. +}
  1396. +
  1397. +mbx_delimit_end (mbf)
  1398. +     FILE *mbf;
  1399. +{
  1400. +  putc ('\037', mbf);
  1401. +}
  1402. +
  1403. +#endif /* MAIL_USE_POP */
  1404. diff -urP /mule-1.1/etc/sendmailuupc.c ./etc/sendmailuupc.c
  1405. --- /mule-1.1/etc/sendmailuupc.c
  1406. +++ ./etc/sendmailuupc.c    Mon Jan 24 15:46:56 1994
  1407. @@ -0,0 +1,417 @@
  1408. +/*
  1409. +  uupcùp sendmail éαé╟é½    by O.Sasaki 1993.11
  1410. +
  1411. +  û{ùêé═fakemailé≡É│Ä«é╔âTâ|ü[âgé╖é╫é½é╚é╠é╛éδéñé¬
  1412. +  uupc mailé╠ò√î╛é≡âTâ|ü[âgé╖éΘê╫é╔ò╩Åêù¥é╞é╡é╜üB
  1413. +
  1414. +  é⌐é╚éΦüAÄΦö▓é½âvâìâOâëâÇé┼üAê╚ë║é╠ûΓæΦô_é¬éáéΘ
  1415. +
  1416. +  1. âüü[âïâAâhâîâXé═âhâüâCâôî`Ä«é╠é▌é╞é╡é─éóéΘüB(UUCPî`Ä«é┼é═ô«é⌐é╚éó)
  1417. +
  1418. +  2. âüü[âïâAâhâîâXé═âtâïâlü[âÇé┼ïLÅqé╡é─éáéΘé╞Ävé┴é─éóéΘüB
  1419. +     òíÉöé╠Élè╘é¬ô»é╢â}âVâôé┼uupcé≡Ägéñé╞é═Ävéªé╚éóé╠é┼âhâüâCâôû╝û│é╡é╠
  1420. +     âAâhâîâXé≡û│Äïé╡é╜üBâìü[âJâïé╔é═âhâüâCâôû╝é≡òté»éΩé╬âüü[âïé═æùéΩéΘüB
  1421. +
  1422. +  3. âüü[âïâAâhâîâXôÖé╠ïLë»é╔î┼ÆΦÆ╖özù±é≡Ägé┴é─éóéΘüB
  1423. +
  1424. +*/
  1425. +
  1426. +#include <stdio.h>
  1427. +#include <stdlib.h>
  1428. +#include <string.h>
  1429. +#include <ctype.h>
  1430. +#include <time.h>
  1431. +
  1432. +#define BUFFER_SIZE 256
  1433. +#define HEADER_SIZE 2048
  1434. +
  1435. +typedef struct {
  1436. +    char *name ;
  1437. +    char **value ;
  1438. +} CONFIGDATA ;
  1439. +
  1440. +
  1441. +char    wbuf[BUFFER_SIZE] ;    /* ö─ùpâÅü[âNâoâbâtâ@            */
  1442. +char    ToMail[HEADER_SIZE] ;    /* Ä≤ÉMÄ╥âüü[âïâAâhâîâX            */
  1443. +char    CcMail[HEADER_SIZE] ;    /* âRâsü[Ä≤ÉMÄ╥âüü[âïâAâhâîâX        */
  1444. +char    BccMail[HEADER_SIZE] ;    /* ö±ò\ĪâRâsü[Ä≤ÉMÄ╥âüü[âïâAâhâîâX    */
  1445. +char    Header[HEADER_SIZE*2] ;    /* âüü[âïâAâhâîâXê╚èOé╠âwâbâ_ü[        */
  1446. +char    Subject[BUFFER_SIZE] ;    /* âüâbâZü[âWÄσæΦâoâbâtâ@        */
  1447. +
  1448. +char    *UupcName = NULL ;    /* æùÉMÄ╥âtâïâlü[âÇ            */
  1449. +char    *UupcMailbox = NULL ;    /* âüâCâïâ{âbâNâXû╝            */
  1450. +char    *UupcHomeDir = NULL ;    /* âzü[âÇâfâBâîâNâgâèü[            */
  1451. +char    *UupcFileSent = NULL ;    /* æùÉMâìâOò█æ╢âtâ@âCâïû╝        */
  1452. +char    *UupcOrganization =NULL;/* ægÉDüAÆcæ╠û╝                */
  1453. +char    *UupcReplyto = NULL ;    /* âèâvâëâCâAâhâîâXÄwÆΦ            */
  1454. +char    *UupcDomain = NULL ;    /* âtâïâhâüâCâôû╝            */
  1455. +char    *UupcFromDomain = NULL ;/* âüâCâïö¡ÉMâhâüâCâôû╝            */
  1456. +char    *UupcMailExt = NULL ;    /* âüâCâïâtâ@âCâïègÆúÄq            */
  1457. +char    *UupcSignature = NULL ;    /* òtë┴âtâ@âCâïû╝            */
  1458. +int    UupcAutoSign ;        /* âtâ@âCâïòtë┴é╠ùLû│            */
  1459. +
  1460. +CONFIGDATA    Conf[] = {
  1461. +    { "name",        &UupcName        } ,
  1462. +    { "mailbox",    &UupcMailbox        } ,
  1463. +    { "home",        &UupcHomeDir        } ,
  1464. +    { "filesent",    &UupcFileSent        } ,
  1465. +    { "organization",    &UupcOrganization    } ,
  1466. +    { "replyto",    &UupcReplyto        } ,
  1467. +    { "domain",        &UupcDomain        } ,
  1468. +    { "fromdomain",    &UupcFromDomain        } ,
  1469. +    { "mailext",    &UupcMailExt        } ,
  1470. +    { "signature",    &UupcSignature        } ,
  1471. +    { NULL, NULL }
  1472. +} ;
  1473. +
  1474. +
  1475. +/********************************************************/
  1476. +/*                            */
  1477. +/*    UUPCÉ▌ÆΦè┬ï½ô╟é▌ĵéΦÅêù¥            */
  1478. +/*                            */
  1479. +/* sendmailé┼òKùvé╚É▌ÆΦìÇû┌é≡ô╟é▌ì₧é▌èeò╧Éöé╔ò█æ╢é╖éΘ    */
  1480. +/*                            */
  1481. +/********************************************************/
  1482. +void GetConfigData( char *rcname )
  1483. +{
  1484. +    char    *fname, *pos ;
  1485. +    FILE    *fp ;
  1486. +    int        lp, find ;
  1487. +    char    tmp[BUFFER_SIZE] ;
  1488. +
  1489. +    fname = getenv( rcname ) ;
  1490. +    fp = fopen( fname, "r" ) ;
  1491. +    while ( fgets( tmp, BUFFER_SIZE, fp ) != NULL ) {
  1492. +    /* âRâüâôâgìsé═âXâLâbâv */
  1493. +    if ( *tmp == '#' )
  1494. +        continue ;
  1495. +
  1496. +    /* Éµô¬é╠ï≤öÆé≡Å┴é╡üAï≤ìsé╚éτâXâLâbâv */
  1497. +    pos = tmp ;
  1498. +    while ( isspace( *pos ) ) ++pos ;
  1499. +    if ( *pos == '\0' )
  1500. +        continue ;
  1501. +    strcpy( wbuf, pos ) ;
  1502. +
  1503. +    /* ÅIéφéΦé╠ï≤öÆéαìφÅ£é╖éΘ */
  1504. +    pos = strstr( wbuf, "\n" ) ;
  1505. +    while ( isspace( *pos ) ) --pos ;
  1506. +    *(++pos) = '\0' ;
  1507. +
  1508. +    /* âRâôâtâBâOÄ»ò╩Äqé≡É╪éΦÅoé╖ */
  1509. +    strcpy( tmp, wbuf ) ;
  1510. +    if ( ( pos = strstr( tmp, "=" ) ) == NULL )
  1511. +        continue ;
  1512. +    *pos = '\0' ;
  1513. +    strcpy( wbuf, wbuf + ( pos - tmp ) + 1 ) ;
  1514. +
  1515. +    /* âRâôâtâBâOÄ»ò╩Äqé≡żò╢ÄÜë╗é╖éΘ */
  1516. +    for ( pos = tmp ; *pos ; ++pos )
  1517. +        *pos = ( char )tolower( *pos ) ;
  1518. +
  1519. +    if ( strstr( tmp, "options" ) == tmp ) {
  1520. +        /* âIâvâVâçâôÄwÆΦÄ»ò╩Äqé≡żò╢ÄÜë╗é╖éΘ */
  1521. +        for ( pos = wbuf ; *pos ; ++pos )
  1522. +        *pos = ( char )tolower( *pos ) ;
  1523. +
  1524. +        /* òtë┴âtâ@âCâïé╠ùLû│â`âFâbâN */
  1525. +        if ( strstr( wbuf, "autosign" ) != NULL ) {
  1526. +        if ( strstr( wbuf, "noautosign" ) != NULL ) {
  1527. +            UupcAutoSign = 0 ; /* òtë┴âtâ@âCâïÄwÆΦé╚é╡ */
  1528. +        } else {
  1529. +            UupcAutoSign = 1 ; /* òtë┴âtâ@âCâïÄwÆΦéáéΦ */
  1530. +        }
  1531. +        }
  1532. +        continue ;
  1533. +    }
  1534. +    
  1535. +    lp = find = 0 ;
  1536. +    while ( Conf[lp].name != NULL ) {
  1537. +        if ( strstr( tmp, Conf[lp].name ) == tmp ) {
  1538. +        find = lp + 1 ;
  1539. +        break ;
  1540. +        }
  1541. +        ++lp ;
  1542. +    }
  1543. +    if ( !find )
  1544. +        continue ;
  1545. +    --find ;
  1546. +
  1547. +    if ( *Conf[find].value == NULL ) {
  1548. +        *Conf[find].value = malloc( strlen( wbuf ) + 1 ) ;
  1549. +    } else {
  1550. +        *Conf[find].value = realloc( *Conf[find].value,
  1551. +                    strlen( wbuf ) + 1 ) ;
  1552. +    }
  1553. +    strcpy( Conf[find].value[0], wbuf ) ;
  1554. +    }
  1555. +}
  1556. +
  1557. +
  1558. +/********************************************************/
  1559. +/*                            */
  1560. +/*    âüü[âïâwâbâ_ü[âLü[âÅü[âhÉ╪éΦÅoé╡Åêù¥        */
  1561. +/*                            */
  1562. +/* ôⁿù═âoâbâtâ@ôαé╔âLü[âÅü[âhé¬éáéΘÅΩìçé═âLü[âÅü[âhé≡    */
  1563. +/* É╪éΦĵéΦüAæσò╢ÄÜò╧è╖é╡é╜âoâbâtâ@é╠âAâhâîâXé≡ò╘é╖üB    */
  1564. +/*                            */
  1565. +/* ôⁿù═âoâbâtâ@é╠ɵô¬é¬âXâyü[âXé⌐â^âué╠ÅΩìçé═îpæ▒ìsé╞    */
  1566. +/* î⌐é╚é╡üAôⁿù═âoâbâtâ@é╠âAâhâîâXé≡é╗é╠é▄é▄ò╘é╖üB    */
  1567. +/*                            */
  1568. +/* ôⁿù═âoâbâtâ@é¬ï≤ìsé╠ÅΩìçâüü[âïâwâbâ_ÅIù╣é╞î⌐é╚é╡üA    */
  1569. +/* NULLâAâhâîâXé≡ò╘é╖üB                    */
  1570. +/*                            */
  1571. +/********************************************************/
  1572. +char *get_keyword ( char *field )
  1573. +{
  1574. +    static char keyword[BUFFER_SIZE];
  1575. +    register char *ptr;
  1576. +    register char c;
  1577. +
  1578. +    ptr = keyword ;
  1579. +    c = *field++;
  1580. +    if ( c == '\0' )
  1581. +    return ( (char *) NULL ) ;
  1582. +    if ( isspace( c ) )
  1583. +    return ( field-1 ) ;
  1584. +    *ptr++ = toupper( c ) ;
  1585. +    while ( ( ( c = *field++ ) != ':' ) && ( !( isspace( c ) ) ) )
  1586. +    *ptr++ = toupper( c ) ;
  1587. +    *ptr = '\0' ;
  1588. +    while ( isspace( c ) )
  1589. +    c = *field++ ;
  1590. +    if ( c != ':' )
  1591. +    return ( (char *) NULL ) ;
  1592. +    return keyword ;
  1593. +}
  1594. +
  1595. +/********************************************************/
  1596. +/*                            */
  1597. +/*     âüü[âïâAâhâîâXÉ╪éΦÅoé╡Åêù¥            */
  1598. +/*                            */
  1599. +/* buf ôαé╔éáéΘæSé─é╠âüü[âïâAâhâîâXé≡ Mailé╓æ½é╡ì₧é▐    */
  1600. +/*                            */
  1601. +/********************************************************/
  1602. +void AppendName( char *Mail, char *buf )
  1603. +{
  1604. +    char    tmp[BUFFER_SIZE] ;
  1605. +    char    *pos ;
  1606. +
  1607. +    for ( ;; ) {
  1608. +    if ( ( pos = strstr( buf, "<" ) ) != NULL ) {
  1609. +        /* VMé╠âèâvâëâCé╠ÅΩìç (vm-strip-reply-headers nil ) */
  1610. +        if ( pos != buf ) {
  1611. +        /* âAâhâîâXæOé╠âlü[âÇê╩Æué⌐éτâRâsü[ */
  1612. +        strcpy( tmp, buf ) ;
  1613. +        } else {
  1614. +        /* âAâhâîâXé╠é▌âRâsü[ */
  1615. +        strcpy( tmp, pos ) ;
  1616. +        }
  1617. +        buf = strstr( pos, ">" ) ;
  1618. +        while ( *buf == '>' || *buf == ',' || *buf == ' ' )
  1619. +        ++buf ;
  1620. +        pos = strstr( tmp, ">" ) ;
  1621. +        *(++pos) = '\0' ;
  1622. +    } else if ( ( pos = strstr( buf, "@" ) ) != NULL ) {
  1623. +        /* rmailéΓ VM(vm-strip-reply-headers t )é╚é╟é╠
  1624. +           <>é┼ê═éφéΩé─éóé╚éóâAâhâîâXé╠ÅΩìç */
  1625. +        buf = pos + 1 ;
  1626. +        for ( ; !(isspace( *pos ) || ( *pos == ',' )) ; --pos ) ;
  1627. +        ++pos ;
  1628. +        sscanf( pos, "%s", tmp ) ;
  1629. +    } else {
  1630. +        /* âtâïâüü[âïâAâhâîâXé¬û│éóò¿é╞é╡é─ÅIù╣é╖éΘ */
  1631. +        return ;
  1632. +    }
  1633. +    /* tmp é≡æ½é╡ì₧é▐ */
  1634. +    strcat( Mail, " " ) ;
  1635. +    strcat( Mail, tmp ) ;
  1636. +    strcat( Mail, "\n" ) ;
  1637. +    }
  1638. +}
  1639. +
  1640. +/********************************************************/
  1641. +/*                            */
  1642. +/*    âwâbâ_ü[âfü[â^ë≡É═Åêù¥                */
  1643. +/*                            */
  1644. +/********************************************************/
  1645. +void GetHeaderData( void )
  1646. +{
  1647. +    int        oldmode = 0 ;
  1648. +    char    *key ;
  1649. +
  1650. +    *ToMail = *CcMail = *BccMail = *Header = '\0' ;
  1651. +    while ( fgets( wbuf, BUFFER_SIZE, stdin ) != NULL ) {
  1652. +    wbuf[ strlen( wbuf ) -1] = '\0' ;
  1653. +    if ( ( key = get_keyword ( wbuf ) ) == NULL )
  1654. +        break ;
  1655. +
  1656. +    if ( key == wbuf ) {
  1657. +        /* îpæ▒ìsé╠ÅΩìç */
  1658. +        switch ( oldmode ) {
  1659. +        case 1: AppendName( ToMail, wbuf ) ; break ;
  1660. +        case 2: AppendName( CcMail, wbuf ) ; break ;
  1661. +        case 3: AppendName( BccMail, wbuf ) ; break ;
  1662. +        default:
  1663. +        strcat( Header, wbuf ) ;
  1664. +        strcat( Header, "\n" ) ;
  1665. +        break ;
  1666. +        }
  1667. +        continue ;
  1668. +    }
  1669. +    if ( strcmp( key, "TO" ) == 0 ) {
  1670. +        AppendName( ToMail, wbuf + 3 ) ;
  1671. +        oldmode = 1 ;
  1672. +    } else if ( strcmp( key, "CC"  ) == 0 ) {
  1673. +        AppendName( CcMail, wbuf + 3 ) ;
  1674. +        oldmode  = 2 ;
  1675. +    } else if ( strcmp( key, "BCC"  ) == 0 ) {
  1676. +        AppendName( BccMail, wbuf + 4 ) ;
  1677. +        oldmode  = 3 ;
  1678. +    } else if ( strcmp( key , "SUBJECT" ) == 0 ) {
  1679. +        strcpy( Subject, &wbuf[9] ) ;
  1680. +        oldmode = 0 ;
  1681. +    } else {
  1682. +        strcat( Header, wbuf ) ;
  1683. +        strcat( Header, "\n" ) ;
  1684. +        oldmode = 0 ;
  1685. +    }
  1686. +    }
  1687. +}
  1688. +
  1689. +/********************************************************/
  1690. +/*                            */
  1691. +/*    âtâ@âCâïâpâXû╝É╢ɼÅêù¥                */
  1692. +/*                            */
  1693. +/********************************************************/
  1694. +void MakeFilePath( char *buf, char *dir, char *name, char *ext )
  1695. +{
  1696. +    strcpy( buf, dir ) ;
  1697. +    if ( buf[strlen( buf ) -1] != '/' )
  1698. +    strcat( buf, "/" ) ;
  1699. +    strcat( buf, name ) ;
  1700. +    if ( ext ) {
  1701. +    strcat( buf, "." ) ;
  1702. +    strcat( buf, ext ) ;
  1703. +    }
  1704. +}
  1705. +
  1706. +/********************************************************/
  1707. +/*                            */
  1708. +/*    âfü[â^Åoù═Åêù¥                    */
  1709. +/*                            */
  1710. +/********************************************************/
  1711. +void PutData( char *format, char *buf, FILE *outfp, FILE *resent )
  1712. +{
  1713. +    fprintf( outfp, format, buf ) ;
  1714. +    if ( resent )
  1715. +    fprintf( resent, format, buf ) ;
  1716. +}
  1717. +
  1718. +/********************************************************/
  1719. +/*                            */
  1720. +/*    âwâbâ_ü[âfü[â^Åoù═Åêù¥                */
  1721. +/*                            */
  1722. +/********************************************************/
  1723. +void PutHeaderData( FILE *outfp, FILE *resent )
  1724. +{
  1725. +    time_t    tim ;
  1726. +
  1727. +    time( &tim );
  1728. +    strftime( wbuf, BUFFER_SIZE, "%a, %d %b %Y %H:%M:%S %Z", localtime(&tim)) ;
  1729. +    PutData( "Date: %s\n", wbuf, outfp, resent ) ;
  1730. +
  1731. +    sprintf( wbuf, "From: \"%s\" <%s@%s>",
  1732. +        UupcName, UupcMailbox, UupcFromDomain ) ;
  1733. +    PutData( "%s\n", wbuf, outfp, resent ) ;
  1734. +
  1735. +    PutData( "To:%s", ToMail, outfp, resent ) ;
  1736. +    if ( *CcMail  ) PutData( "Cc:%s", CcMail, outfp, resent ) ;
  1737. +    if ( *BccMail ) PutData( "Bcc:%s", BccMail, outfp, resent ) ;
  1738. +    if ( *Header  ) PutData( "%s", Header, outfp, resent ) ;
  1739. +
  1740. +    if ( UupcOrganization ) {
  1741. +    PutData( "Organization: %s\n", UupcOrganization, outfp, resent ) ;
  1742. +    }
  1743. +
  1744. +    if ( UupcReplyto ) {
  1745. +    if ( strpbrk( UupcReplyto, "!@" ) == NULL )
  1746. +        sprintf( wbuf, "\"%s\" <%s@%s>",
  1747. +            UupcName, UupcReplyto , UupcFromDomain ) ;
  1748. +    else
  1749. +        sprintf( wbuf, "\"%s\" <%s>", UupcName, UupcReplyto ) ;
  1750. +    PutData( "Reply-To: %s\n", wbuf, outfp, resent ) ;
  1751. +    }
  1752. +
  1753. +    PutData( "Subject: %s\n\n", Subject, outfp, resent ) ;
  1754. +}
  1755. +
  1756. +/********************************************************/
  1757. +/*                            */
  1758. +/*        âüâCâôÅêù¥é╛éµ                */
  1759. +/*                            */
  1760. +/********************************************************/
  1761. +main( int argc, char *argv[] )
  1762. +{
  1763. +    FILE    *outfp, *resent, *sign ;
  1764. +    int        lp ;
  1765. +
  1766. +    /* UUPCè┬ï½ÄµéΦì₧é▌ */
  1767. +    GetConfigData( "UUPCSYSRC" ) ;
  1768. +    GetConfigData( "UUPCUSRRC" ) ;
  1769. +    if ( UupcFromDomain == NULL ) {
  1770. +    UupcFromDomain = malloc( strlen( UupcDomain ) + 1 ) ;
  1771. +    strcpy( UupcFromDomain, UupcDomain ) ;
  1772. +    }
  1773. +
  1774. +    GetHeaderData( ) ;
  1775. +
  1776. +    /* æùÉMâìâOâtâ@âCâïâIü[âvâô */
  1777. +    if ( UupcFileSent ) {
  1778. +    MakeFilePath( wbuf, UupcHomeDir, UupcFileSent, UupcMailExt ) ;
  1779. +    resent = fopen( wbuf, "a" ) ;
  1780. +    fprintf( resent, "\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\n" ) ;
  1781. +    } else
  1782. +    resent = NULL ;
  1783. +
  1784. +    /* uupc mail é╠òWÅÇôⁿù═âoâCâvé≡âIü[âvâô */
  1785. +    if ( ( outfp = popen( "rmail -t", "w" ) ) == ((FILE *) NULL)) {
  1786. +    printf( "sendmailuupc: " ) ;
  1787. +    printf( "cannot open pipe to real mailer\n" ) ;
  1788. +    if ( resent )
  1789. +        fclose( resent ) ;
  1790. +    exit( 1 ) ;
  1791. +    }
  1792. +
  1793. +    PutHeaderData( outfp, resent ) ;
  1794. +
  1795. +    /* Ä└ì█é╔æùéΘâfü[â^é≡òíÄ╩é╖éΘ */
  1796. +    while ( fgets( wbuf, BUFFER_SIZE, stdin ) != NULL )
  1797. +    PutData( "%s", wbuf, outfp, resent ) ;
  1798. +
  1799. +    /* òtë┴âtâBâëâOé¬ùºé┐üAòtë┴âtâ@âCâïé¬æ╢ì▌é╖éΘÅΩìçé╠é▌âtâ@âCâïòtë┴ */
  1800. +    if ( UupcAutoSign && UupcSignature ) {
  1801. +    MakeFilePath( wbuf, UupcHomeDir, UupcSignature, NULL ) ;
  1802. +    if ( ( sign = fopen( wbuf, "r" ) ) != NULL ) {
  1803. +        PutData( "%s\n", "--", outfp, resent ) ;
  1804. +        while ( fgets( wbuf, BUFFER_SIZE, sign ) != NULL )
  1805. +        PutData( "%s", wbuf, outfp, resent ) ;
  1806. +        fclose( sign ) ;
  1807. +    }
  1808. +    }
  1809. +
  1810. +    pclose( outfp ) ;
  1811. +    if ( resent )
  1812. +    fclose( resent ) ;
  1813. +
  1814. +    /* UUPCè┬ï½ò█æ╢âGâèâAèJò· */
  1815. +    lp = 0 ;
  1816. +    while ( Conf[lp].name != NULL ) {
  1817. +    if ( *Conf[lp].value != NULL ) {
  1818. +        printf( "%08x\n", *Conf[lp].value ) ;
  1819. +        free( *Conf[lp].value ) ;
  1820. +    }
  1821. +    ++lp ;
  1822. +    }
  1823. +    return 0 ;
  1824. +}
  1825. diff -urP /mule-1.1/etc/server.c ./etc/server.c
  1826. --- /mule-1.1/etc/server.c    Mon Mar 14 14:45:32 1994
  1827. +++ ./etc/server.c    Tue Mar 15 06:41:32 1994
  1828. @@ -50,6 +50,86 @@
  1829.  #undef open
  1830.  #undef close
  1831.  
  1832. +/* 93.8.20 by O.Sasaki */
  1833. +#if defined (OS2)
  1834. +
  1835. +#define INCL_DOS
  1836. +#include <os2.h>
  1837. +#include <stdio.h>
  1838. +#include <process.h>
  1839. +
  1840. +static void error (ULONG rc, const char *fun)
  1841. +{
  1842. +    (void)fprintf (stderr, "%s failed, rc=%lu\n", fun, rc) ;
  1843. +    exit (1) ;
  1844. +}
  1845. +
  1846. +#define ERROR(fun) if (rc != 0) error (rc, fun)
  1847. +
  1848. +int main (int argc, char *argv[])
  1849. +{
  1850. +    HQUEUE    hq_server, hq_client ;
  1851. +    ULONG    rc, len ;
  1852. +    PID        owner_pid ;
  1853. +    PVOID    data ;
  1854. +    REQUESTDATA request ;
  1855. +    BYTE    priority ;
  1856. +    char    buffer[1024], name[512], *p ;
  1857. +    long    client_pid ;
  1858. +
  1859. +    if (argc == 1) {
  1860. +    if (spawnl (P_NOWAIT, argv[0], argv[0], "-r", NULL) < 0) {
  1861. +        perror ("spawn") ;
  1862. +        return 1 ;
  1863. +    }
  1864. +    for (;;) {
  1865. +        if (fgets (buffer, sizeof (buffer), stdin) == 0)
  1866. +        return 0 ;
  1867. +        p = buffer ;
  1868. +        while (*p != 0 && !(*p >= '0' && *p <= '9'))
  1869. +        ++p ;
  1870. +        client_pid = strtol (p, NULL, 10) ;
  1871. +        (void)sprintf (name, "/queues/emacs/clients/%ld", client_pid) ;
  1872. +        rc = DosOpenQueue (&owner_pid, &hq_client, name) ;
  1873. +        if (rc == 0) {
  1874. +        len = strlen (buffer) + 1 ;
  1875. +        rc = DosAllocSharedMem (&data, 0, len,
  1876. +                    PAG_COMMIT | OBJ_GIVEABLE | PAG_READ
  1877. +                    | PAG_WRITE) ;
  1878. +        ERROR ("DosAllocSharedMem") ;
  1879. +        rc = DosGiveSharedMem (data, client_pid, PAG_READ) ;
  1880. +        ERROR ("DosGiveSharedMem") ;
  1881. +        (void)memcpy (data, buffer, len) ;
  1882. +        rc = DosWriteQueue (hq_client, 0, len, data, 0) ;
  1883. +        ERROR ("DosWriteQueue") ;
  1884. +        rc = DosFreeMem (data) ;
  1885. +        ERROR ("DosFreeMem") ;
  1886. +        rc = DosCloseQueue (hq_client) ;
  1887. +        ERROR ("DosCloseQueue") ;
  1888. +        }
  1889. +    }
  1890. +    } else if (argc == 2 && strcmp (argv[1], "-r") == 0) {
  1891. +    rc = DosCreateQueue (&hq_server, QUE_FIFO | QUE_CONVERT_ADDRESS,
  1892. +                 "/queues/emacs/server") ;
  1893. +    ERROR ("DosCreateQueue") ;
  1894. +    for (;;) {
  1895. +        rc = DosReadQueue (hq_server, &request, &len, &data, 0,
  1896. +                   DCWW_WAIT, &priority, 0) ;
  1897. +        ERROR ("DosReadQueue") ;
  1898. +        (void)printf ("Client: %d ", (int)request.pid) ;
  1899. +        (void)fputs (data, stdout) ;
  1900. +        (void)fflush (stdout) ;
  1901. +        rc = DosFreeMem (data) ;
  1902. +        ERROR ("DosFreeMem") ;
  1903. +    }
  1904. +    } else {
  1905. +    (void)fprintf (stderr, "Usage: %s\n", argv[0]) ;
  1906. +    return 1 ;
  1907. +    }
  1908. +}
  1909. +
  1910. +#else /* not OS2 */
  1911. +
  1912.  #if !defined(BSD) && !defined(HAVE_SYSVIPC) && !defined(HAVE_SOCKETS)
  1913.  #include <stdio.h>
  1914.  
  1915. @@ -340,4 +420,4 @@
  1916.  
  1917.  #endif /* BSD && IPC */
  1918.  
  1919. -
  1920. +#endif /* OS2 */
  1921. diff -urP /mule-1.1/lisp/compile.el ./lisp/compile.el
  1922. --- /mule-1.1/lisp/compile.el    Thu Jun 03 19:20:04 1993
  1923. +++ ./lisp/compile.el    Thu Sep 30 08:35:48 1993
  1924. @@ -113,7 +113,7 @@
  1925.    (setq compilation-process
  1926.      (start-process "compilation" "*compilation*"
  1927.                 shell-file-name
  1928. -               "-c" (concat "exec " command)))
  1929. +               "/s" "/c" command))
  1930.    (with-output-to-temp-buffer "*compilation*"
  1931.      (princ "cd ")
  1932.      (princ default-directory)
  1933. @@ -184,13 +184,13 @@
  1934.    "Kill the process made by the \\[compile] command."
  1935.    (interactive)
  1936.    (if compilation-process
  1937. -      (interrupt-process compilation-process)))
  1938. +      (os2-kill-process compilation-process)))
  1939.  
  1940.  (defun kill-grep ()
  1941.    "Kill the process made by the \\[grep] command."
  1942.    (interactive)
  1943.    (if compilation-process
  1944. -      (interrupt-process compilation-process)))
  1945. +      (os2-kill-process compilation-process)))
  1946.  
  1947.  (defun next-error (&optional argp)
  1948.    "Visit next compilation error message and corresponding source code.
  1949. diff -urP /mule-1.1/lisp/gdb.el ./lisp/gdb.el
  1950. --- /mule-1.1/lisp/gdb.el    Mon Mar 14 14:43:54 1994
  1951. +++ ./lisp/gdb.el    Wed Mar 23 07:58:36 1994
  1952. @@ -41,7 +41,7 @@
  1953.  
  1954.  ;; You may easily create additional commands and bindings to interact
  1955.  ;; with the display.  For example to put the gdb command next on \M-n
  1956. -;; (def-gdb next "\M-n")
  1957. +;; (def-gdb next "\en")
  1958.  
  1959.  ;; This causes the emacs command gdb-next to be defined, and runs
  1960.  ;; gdb-display-frame after the command.
  1961. @@ -89,14 +89,14 @@
  1962.          (list 'gdb-call cstr))
  1963.        (list 'define-key 'gdb-mode-map key  (list 'quote fun)))))
  1964.  
  1965. -(def-gdb "step"   "\M-s" "Step one source line with display")
  1966. -(def-gdb "stepi"  "\M-i" "Step one instruction with display")
  1967. -(def-gdb "next"   "\M-n" "Step one source line (skip functions)")
  1968. -(def-gdb "cont"   "\M-c" "Continue with display")
  1969. +(def-gdb "step"   "\es" "Step one source line with display")
  1970. +(def-gdb "stepi"  "\ei" "Step one instruction with display")
  1971. +(def-gdb "next"   "\en" "Step one source line (skip functions)")
  1972. +(def-gdb "cont"   "\ec" "Continue with display")
  1973.  
  1974.  (def-gdb "finish" "\C-c\C-f" "Finish executing current function")
  1975. -(def-gdb "up"     "\M-u"   "Go up N stack frames (numeric arg) with display")
  1976. -(def-gdb "down"   "\M-d"   "Go down N stack frames (numeric arg) with display")
  1977. +(def-gdb "up"     "\eu"   "Go up N stack frames (numeric arg) with display")
  1978. +(def-gdb "down"   "\ed"   "Go down N stack frames (numeric arg) with display")
  1979.  
  1980.  (defun gdb-mode ()
  1981.    "Major mode for interacting with an inferior Gdb process.
  1982. @@ -193,9 +193,9 @@
  1983.        (let ((end (string-match "\n" string)))
  1984.          (if end
  1985.          (progn
  1986. -          (let* ((first-colon (string-match ":" string 2))
  1987. +          (let* ((first-colon (string-match ";" string 2))
  1988.               (second-colon
  1989. -              (string-match ":" string (1+ first-colon))))
  1990. +              (string-match ";" string (1+ first-colon))))
  1991.              (setq gdb-last-frame
  1992.                (cons (substring string 2 first-colon)
  1993.                  (string-to-int
  1994. diff -urP /mule-1.1/lisp/loadup.el ./lisp/loadup.el
  1995. --- /mule-1.1/lisp/loadup.el    Mon Mar 14 14:44:00 1994
  1996. +++ ./lisp/loadup.el    Tue Mar 15 11:02:06 1994
  1997. @@ -144,6 +144,15 @@
  1998.  (if (load "site-load" t)
  1999.      (garbage-collect))
  2000.  
  2001. +;; 93.8.24 by O.Sasaki
  2002. +(if (eq system-type 'OS/2)
  2003. +    (progn
  2004. +      (load "os2")
  2005. +      (garbage-collect)
  2006. +      (load "os2-keys")
  2007. +      (garbage-collect)))
  2008. +;; end of patch
  2009. +
  2010.  (load "version.el")  ;Don't get confused if someone compiled version.el by mistake.
  2011.  
  2012.  ;; Note: all compiled Lisp files loaded above this point
  2013. @@ -196,6 +205,11 @@
  2014.          (message "Dumping data as file xemacs")
  2015.          (dump-emacs "xemacs" "temacs")
  2016.          (kill-emacs))
  2017. +    (if (eq system-type 'OS/2)    ;93.8.17 by O.Sasaki
  2018. +        (progn
  2019. +          (message "Dumping data as file xemacs")
  2020. +          (dump-emacs "xemacs" "temacs")
  2021. +          (kill-emacs))
  2022.      (if (fboundp 'dump-emacs-data)
  2023.          ;; Handle the IBM RS/6000, and perhaps eventually other machines.
  2024.          (progn
  2025. @@ -221,7 +235,7 @@
  2026.                   "-"
  2027.                   (substring name (match-end 0)))))
  2028.          (add-name-to-file "xemacs" name t))
  2029. -      (kill-emacs)))))
  2030. +      (kill-emacs))))))
  2031.  
  2032.  ;; Avoid error if user loads some more libraries now.
  2033.  (setq purify-flag nil)
  2034. diff -urP /mule-1.1/lisp/os2-keys.el ./lisp/os2-keys.el
  2035. --- /mule-1.1/lisp/os2-keys.el
  2036. +++ ./lisp/os2-keys.el    Sun Dec 19 11:41:14 1993
  2037. @@ -0,0 +1,353 @@
  2038. +;
  2039. +; os2-keys.el
  2040. +;
  2041. +(provide 'os2-keys)
  2042. +
  2043. +(defvar ext-map nil
  2044. +  "Keymap used for extended scan codes.")
  2045. +(setq ext-map (make-keymap))
  2046. +
  2047. +(defvar os2-map nil
  2048. +  "Keymap used for os2 key definitions which are prefixed by F9.")
  2049. +(setq os2-map (make-sparse-keymap))
  2050. +
  2051. +(define-key ext-map "\002" 'set-mark-command)        ; C-SPC
  2052. +(define-key ext-map "\003" 'set-mark-command)        ; C-@
  2053. +(define-key ext-map "\040" 'os2-dup-line)        ; A-d
  2054. +(define-key ext-map "\041" 'find-file)            ; A-f
  2055. +(define-key ext-map "\042" 'goto-line)                ; A-g
  2056. +(define-key ext-map "\056" 'os2-copy-region)        ; A-c
  2057. +(define-key ext-map "\046" 'os2-copy-line-as-kill)  ; A-l
  2058. +(define-key ext-map "\062" 'os2-match-paren)        ; A-m
  2059. +(define-key ext-map "\030" 'open-rectangle)        ; A-o
  2060. +(define-key ext-map "\021" 'os2-kill-word)        ; A-w
  2061. +(define-key ext-map "\016" 'undo)            ; A-BS
  2062. +(define-key ext-map "<" 'os2-switch-to-nth-buffer)  ; F2
  2063. +(define-key ext-map "=" 'os2-search-forward)        ; F3
  2064. +(define-key ext-map ">" 'os2-search-backward)        ; F4
  2065. +(define-key ext-map "?" 'os2-fill-paragraph)        ; F5
  2066. +(define-key ext-map "@" 'other-window)            ; F6
  2067. +(define-key ext-map "A" 'undefined)            ; F7
  2068. +(define-key ext-map "B" 'undefined)            ; F8
  2069. +(define-key ext-map "C" os2-map)            ; F9
  2070. +(define-key ext-map "D" 'undefined)            ; F10
  2071. +(define-key ext-map "E" 'undefined)            ;
  2072. +(define-key ext-map "F" 'undefined)            ;
  2073. +(define-key ext-map "G" 'beginning-of-line)        ; HOME
  2074. +(define-key ext-map "H" 'previous-line)            ; UP
  2075. +(define-key ext-map "I" 'scroll-down)            ; PAGEUP
  2076. +(define-key ext-map "J" 'undefined)            ;
  2077. +(define-key ext-map "K" 'backward-char)            ; LEFT
  2078. +(define-key ext-map "L" 'goto-line)            ; CENTER
  2079. +(define-key ext-map "M" 'forward-char)            ; RIGHT
  2080. +(define-key ext-map "N" 'undefined)            ;
  2081. +(define-key ext-map "O" 'end-of-line)            ; END
  2082. +(define-key ext-map "P" 'next-line)            ; DOWN
  2083. +(define-key ext-map "Q" 'scroll-up)            ; PAGEDOWN
  2084. +(define-key ext-map "R" 'overwrite-mode)        ; INSERT
  2085. +(define-key ext-map "S" 'delete-char)            ; DELETE
  2086. +(define-key ext-map "T" 'describe-key)            ; S-F1
  2087. +(define-key ext-map "U" 'os2-buffer-list)        ; S-F2
  2088. +(define-key ext-map "V" 'next-error)            ; S-F3
  2089. +(define-key ext-map "W" 'undefined)            ; S-F4
  2090. +(define-key ext-map "X" 'undefined)            ; S-F5
  2091. +(define-key ext-map "Y" 'undefined)            ; S-F6
  2092. +(define-key ext-map "Z" 'undefined)            ; S-F7
  2093. +(define-key ext-map "_" 'os2-find-file-at-point)    ; C-F2
  2094. +(define-key ext-map "s" 'os2-backward-to-word)        ; C-LEFT
  2095. +(define-key ext-map "t" 'os2-forward-to-word)        ; C-RIGHT
  2096. +(define-key ext-map "u" 'kill-line)            ; C-END
  2097. +(define-key ext-map "v" 'os2-end-of-buffer)        ; C-PAGEDOWN
  2098. +(define-key ext-map "w" 'os2-kill-left-line)        ; C-HOME
  2099. +(define-key ext-map "\200" 'undefined)              ; A-9
  2100. +(define-key ext-map "\204" 'os2-beginning-of-buffer) ; C-PAGEUP
  2101. +(define-key ext-map "\205" 'call-last-kbd-macro)    ; F11
  2102. +(define-key ext-map "\206" 'set-mark-command)        ; F12
  2103. +(define-key ext-map "\207" 'expand-abbrev)          ; S-F11
  2104. +(define-key ext-map "\215" 'os2-scroll-line-down)   ; C-UP
  2105. +(define-key ext-map "\216" 'undefined)              ; C-NUM-
  2106. +(define-key ext-map "\217" 'undefined)              ; C-CENTER
  2107. +(define-key ext-map "\220" 'undefined)              ; C-NUM+
  2108. +(define-key ext-map "\221" 'os2-scroll-line-up)        ; C-DOWN
  2109. +(define-key ext-map "\222" 'undefined)              ; C-INSERT
  2110. +(define-key ext-map "\231" 'os2-scroll-other-window) ; A-PAGEUP
  2111. +(define-key ext-map "\233" 'scroll-right)        ; A-LEFT
  2112. +(define-key ext-map "\235" 'scroll-left)        ; A-RIGHT
  2113. +(define-key ext-map "\241" 'scroll-other-window)    ; A-PAGEDOWN
  2114. +(define-key ext-map "\245" 'undefined)              ; A-TAB
  2115. +
  2116. +(define-key os2-map "c" 'compile)                ; F9 c
  2117. +(define-key os2-map "i" 'os2-reinitialize)        ; F9 i
  2118. +(define-key os2-map "j" 'just-one-space)            ; F9 j
  2119. +(define-key os2-map "v" 'os2-buffer-file-name)      ; F9 v
  2120. +
  2121. +(global-set-key "\e " 'set-mark-command)
  2122. +(global-set-key "\0" ext-map)
  2123. +
  2124. +;
  2125. +; The following definitions avoid the insertion of unexpected
  2126. +; characters into the buffer if the scan code prefix (C-@) is not a
  2127. +; valid key. Otherwise, "C-X RIGHT", for instance, would be
  2128. +; interpreted as C-X C-@, which is undefined, followed by "M" which
  2129. +; would be inserted into the buffer.
  2130. +;
  2131. +(define-key ctl-x-map "\0" (make-sparse-keymap))
  2132. +(define-key ctl-x-4-map "\0" (make-sparse-keymap))
  2133. +(define-key esc-map "\0" (make-sparse-keymap))
  2134. +(define-key mode-specific-map "\0" (make-sparse-keymap))
  2135. +(define-key help-map "\0" (make-sparse-keymap))
  2136. +(define-key os2-map "\0" (make-sparse-keymap))
  2137. +
  2138. +(defun os2-forward-to-word (arg)
  2139. +  "Move forward until encountering the beginning of a word.
  2140. +With argument, do this that many times."
  2141. +  (interactive "p")
  2142. +  (or (re-search-forward "\\W\\b" nil t arg)
  2143. +      (goto-char (point-max))))
  2144. +
  2145. +(defun os2-backward-to-word (arg)
  2146. +  "Move backward until encountering the beginning of a word.
  2147. +With argument, do this that many times."
  2148. +  (interactive "p")
  2149. +  (backward-char)
  2150. +  (if (re-search-backward "\\W\\b" nil t arg) (goto-char (match-end 0))
  2151. +      (goto-char (point-min))))
  2152. +
  2153. +(defun os2-kill-left-line nil
  2154. +  "Kill from the beginning of the line to point."
  2155. +  (interactive "*")
  2156. +  (kill-line 0))
  2157. +
  2158. +(defun os2-end-of-buffer nil
  2159. +  "Move to end of the buffer without setting mark."
  2160. +  (interactive)
  2161. +  (goto-char (point-max)))
  2162. +
  2163. +(defun os2-beginning-of-buffer nil
  2164. +  "Move to the beginning of the buffer without setting mark."
  2165. +  (interactive)
  2166. +  (goto-char (point-min)))
  2167. +
  2168. +(defun os2-reinitialize ()
  2169. +  "Load \"~/.emacs, os2-keys.el and os2-misc.el\".
  2170. +This is used to load new versions of these files while debugging."
  2171. +  (interactive)
  2172. +  (load "~/.emacs")
  2173. +  (load "os2-keys")
  2174. +  (load "os2-misc" t))
  2175. +
  2176. +(defun os2-scroll-line-up (arg)
  2177. +  "Scroll up by one line.
  2178. +With argument, do this that many times."
  2179. +  (interactive "p")
  2180. +  (scroll-up arg))
  2181. +
  2182. +(defun os2-scroll-line-down (arg)
  2183. +  "Scroll down by one line.
  2184. +With argument, do this that many times."
  2185. +  (interactive "p")
  2186. +  (scroll-down arg))
  2187. +
  2188. +(defun os2-buffer-file-name ()
  2189. +  "Display the name of the file visited in current buffer."
  2190. +  (interactive)
  2191. +  (message "%s" (cond (buffer-file-name) (t "Not visiting a file"))))
  2192. +
  2193. +(defun os2-copy-line-as-kill (arg)
  2194. +  "Copy line as kill.
  2195. +With argument, copy that many lines."
  2196. +  (interactive "p")
  2197. +  (let ((s (point)))
  2198. +    (beginning-of-line)
  2199. +    (let ((b (point)))
  2200. +      (forward-line arg)
  2201. +      (copy-region-as-kill b (point)))
  2202. +    (goto-char s)))
  2203. +
  2204. +(defun os2-dup-line (arg)
  2205. +  "Duplicate current line.
  2206. +Set mark to the beginning of the new line.
  2207. +With argument, do this that many times."
  2208. +  (interactive "*p")
  2209. +  (setq last-command 'identity) ; Don't append to kill ring
  2210. +  (let ((s (point)))
  2211. +    (beginning-of-line)
  2212. +    (let ((b (point)))
  2213. +      (forward-line)
  2214. +      (if (not (eq (preceding-char) ?\n)) (insert ?\n))
  2215. +      (copy-region-as-kill b (point))
  2216. +    (while (> arg 0)
  2217. +      (yank)
  2218. +      (setq arg (1- arg)))
  2219. +    (goto-char s))))
  2220. +
  2221. +(defun os2-kill-word (arg)
  2222. +  "Delete characters until encountering the beginning of a word.
  2223. +With argument, do this that many times."
  2224. +  (interactive "*p")
  2225. +  (let ((b (point)))
  2226. +     (os2-forward-to-word arg)
  2227. +     (kill-region b (point))))
  2228. +
  2229. +(defvar os2-search-string nil
  2230. +  "Search string for os2-search-forward and os2-search-backward.")
  2231. +
  2232. +(defvar os2-search-re nil
  2233. +  "Non-nil means use regular expression for os2-search-forward and -backward.")
  2234. +
  2235. +(defun os2-search-forward (&optional arg)
  2236. +  "Search forward for a string.
  2237. +If prefixed by \\[universal-argument], ask for search string.
  2238. +If prefixed by \\[universal-argument] \\[universal-argument], use regular expression."
  2239. +  (interactive "P")
  2240. +  (os2-search-fb arg 'search-forward 're-search-forward))
  2241. +
  2242. +(defun os2-search-backward (&optional arg)
  2243. +  "Search backward for a string.
  2244. +If prefixed by \\[universal-argument], ask for search string.
  2245. +If prefixed by \\[universal-argument] \\[universal-argument], use
  2246. +regular expression."
  2247. +  (interactive "P")
  2248. +  (os2-search-fb arg 'search-backward 're-search-backward))
  2249. +
  2250. +(defun os2-search-fb (arg fun re-fun)
  2251. +  "Search forward or backward for a string.
  2252. +If the first argument is nil, ask for the string.
  2253. +The second argument is search-forward or search-backward.
  2254. +The third argument is re-search-forward or re-search-backward."
  2255. +  (if (or arg (not os2-search-string))
  2256. +     (progn
  2257. +       (setq os2-search-re 
  2258. +         (and (listp arg) (numberp (car arg)) (>= (car arg) 16)))
  2259. +       (setq os2-search-string
  2260. +          (read-from-minibuffer
  2261. +             (if os2-search-re "Re-Search forward: " "Search forward: ")
  2262. +             os2-search-string))))
  2263. +  (funcall (if os2-search-re re-fun fun) os2-search-string))
  2264. +
  2265. +(defun os2-switch-to-nth-buffer (arg)
  2266. +  "Switch to the ARG'th buffer.
  2267. +If a numeric prefix argument is not given, the next buffer is
  2268. +selected. When using this function successively, the top ARG+1 buffers
  2269. +are rotated."
  2270. +  (interactive "p")
  2271. +  (let* ((bufs (buffer-list))
  2272. +         (len (length bufs))
  2273. +         (idx 0) buffer name (more t))
  2274. +    (while (and (>= arg 0) (< idx len) more)
  2275. +      (setq buffer (nth idx bufs))
  2276. +      (setq name (buffer-name buffer))
  2277. +      (if (/= (string-to-char name) ? )
  2278. +          (if (zerop arg)
  2279. +              (setq more nil)
  2280. +            (setq arg (1- arg))))
  2281. +      (setq idx (1+ idx)))
  2282. +    (if more
  2283. +        (error "Invalid buffer number"))
  2284. +    (switch-to-buffer buffer)))
  2285. +
  2286. +(defun os2-match-paren (arg)
  2287. +  "Go to the matching parenthesis if on parenthesis.
  2288. +This function uses the syntax table."
  2289. +  (interactive "p")
  2290. +  (cond ((looking-at "\\s\(") (forward-list 1) (backward-char 1))
  2291. +    ((looking-at "\\s\)") (forward-char 1) (backward-list 1))))
  2292. +
  2293. +(defun os2-buffer-list ()
  2294. +  "Display a list of names of existing buffers.
  2295. +Inserts it in buffer *Buffer List* and selects that.
  2296. +Note that buffers with names starting with spaces are omitted."
  2297. +  (interactive)
  2298. +  (list-buffers)
  2299. +  (select-window (get-buffer-window "*Buffer List*"))
  2300. +  (list-buffers))                                   ; update for *Buffer List*
  2301. +
  2302. +(defun os2-copy-region ()
  2303. +  "Copy region to point."
  2304. +  (interactive)
  2305. +  (copy-region-as-kill (point) (mark))
  2306. +  (yank))
  2307. +
  2308. +
  2309. +(defun os2-fill-paragraph (arg)
  2310. +  "Fill paragraph at or before point using em's notion of a paragraph.
  2311. +Prefix arg means justify as well.
  2312. +Paragraphs are separated by blank lines. The indentation of the first line
  2313. +is used for indenting the entire paragraph. If there are two consecutive
  2314. +blanks in the first line of the paragraphs, everything to the left of these
  2315. +blanks is left as-is and the paragraph is indented to the first non-blank
  2316. +character after the first two consecutive blanks of the first line."
  2317. +  (interactive "P")
  2318. +  (save-excursion
  2319. +    (let (fill-prefix start end join column)
  2320. +      (while (looking-at "^$")
  2321. +          (forward-line -1))
  2322. +      (re-search-backward "^$" (point-min) 0)
  2323. +      (if (looking-at "^$")
  2324. +          (forward-char))
  2325. +      (setq start (point))
  2326. +      (re-search-forward "^$" (point-max) 0)
  2327. +      (or (bolp) (newline 1))
  2328. +      (setq end (point-marker))
  2329. +      (goto-char start)
  2330. +      (if (looking-at "^ *[^ \n]*  ")
  2331. +          (progn (re-search-forward "^ *[^ \n]*   *")
  2332. +                 (setq column (current-column))
  2333. +                 (split-line)
  2334. +                 (setq join (point))
  2335. +                 (forward-line 1)
  2336. +                 (setq start (point))
  2337. +                 (forward-char column)
  2338. +                 (setq fill-prefix
  2339. +                       (if (zerop column) nil
  2340. +                         (make-string column ? )))
  2341. +                 (while (and (zerop (forward-line 1))
  2342. +                             (< (point) (marker-position end)))
  2343. +                   (backward-to-indentation 0)
  2344. +                   (cond ((> (current-column) column)
  2345. +                          (delete-region (+ (point) column
  2346. +                                            (- (current-column))) (point)))
  2347. +                         ((< (current-column) column)
  2348. +                          (insert-char ?  (- column (current-column))))))
  2349. +                 (fill-region-as-paragraph start
  2350. +                                           (marker-position end) arg)
  2351. +                 (delete-region join (+ start column)))
  2352. +        (fill-region-as-paragraph (point) (marker-position end) arg)))))
  2353. +
  2354. +
  2355. +(defun os2-extract-file-name (at-point)
  2356. +  "Return the file name around or before point.
  2357. +If AT-POINT is not nil, the file names starts at point, that is, characters
  2358. +before point are ignored."
  2359. +  (let (start end)
  2360. +    (save-excursion
  2361. +      (if at-point
  2362. +          (setq start (point))
  2363. +        (if (looking-at "[][\0- ()<>\\\"|;=*?]")
  2364. +            (re-search-backward "[^][\0- :()<>\\\"|;=*?]" (point-min) 0))
  2365. +        (cond ((bobp) (setq start (point-min)))
  2366. +              (t (re-search-backward "[][\0- :()<>\\\"|;=*?]" (point-min) 0)
  2367. +                 (if (and (looking-at ":") (not (bobp)))
  2368. +                     (progn
  2369. +                       (goto-char (1- (point)))
  2370. +                       (if (looking-at "[A-Za-z]:")
  2371. +                           (setq start (point))
  2372. +                         (setq start (+ 2 (point)))))
  2373. +                   (if (bobp)
  2374. +                       (setq start (point))
  2375. +                     (setq start (1+ (point))))))))
  2376. +      (goto-char start)
  2377. +      (if (looking-at "\\([A-Za-z]:\\|\\)[^][\0- :()<>\\\"|;=*?]*")
  2378. +          (setq end (match-end 0)))
  2379. +      (and start end  (> end start) (buffer-substring start end)))))
  2380. +
  2381. +(defun os2-find-file-at-point (arg)
  2382. +  "Find file whose name is around or before point.
  2383. +With prefix argument find file whose name starts at point."
  2384. +  (interactive "P")
  2385. +  (find-file (os2-extract-file-name arg)))
  2386. +
  2387. +(defun os2-scroll-other-window (arg)
  2388. +  "Scroll up other page."
  2389. +  (interactive "p")
  2390. +  (scroll-other-window '-))
  2391. diff -urP /mule-1.1/lisp/os2.el ./lisp/os2.el
  2392. --- /mule-1.1/lisp/os2.el
  2393. +++ ./lisp/os2.el    Wed Mar 16 13:37:16 1994
  2394. @@ -0,0 +1,283 @@
  2395. +;;
  2396. +;; os2.el -- Patches for OS/2
  2397. +;;
  2398. +(provide 'os2)
  2399. +
  2400. +(defun replace-char-in-string (str c1 c2)
  2401. +  "Replace character C1 in string STR with character C2 and return STR.
  2402. +This function does *not* copy the string."
  2403. +  (let ((indx 0) (len (length str)) chr)
  2404. +    (while (< indx len)
  2405. +      (setq chr (aref str indx))
  2406. +      (if (eq chr c1)
  2407. +          (aset str indx c2))
  2408. +      (setq indx (1+ indx)))
  2409. +    str))
  2410. +
  2411. +(defun make-legal-file-name (fn)
  2412. +  "Turn FN into a legal file name and return the modified copy of the string.
  2413. +The characters * and ? will be replaced with _."
  2414. +  (setq fn (copy-sequence fn))
  2415. +  (replace-char-in-string fn ?* ?_)
  2416. +  (replace-char-in-string fn ?? ?_))
  2417. +
  2418. +;;
  2419. +;; Changes:
  2420. +;; - replace * and ? with _
  2421. +;; - on FAT file system, append # to extension
  2422. +;;
  2423. +(defun make-auto-save-file-name ()
  2424. +  "Return file name to use for auto-saves of current buffer.
  2425. +Does not consider auto-save-visited-file-name; that is checked
  2426. +before calling this function.
  2427. +This has been redefined for customization.
  2428. +See also auto-save-file-name-p."
  2429. +  (let ((tem
  2430. +     (if buffer-file-name
  2431. +         (concat (file-name-directory buffer-file-name)
  2432. +             "#"
  2433. +             (file-name-nondirectory buffer-file-name)
  2434. +             "#")
  2435. +       (expand-file-name (concat "#%" (make-legal-file-name 
  2436. +                       (buffer-name)) "#")))))
  2437. +    (cond ((valid-file-name-p tem) tem)
  2438. +      (buffer-file-name
  2439. +       (add-to-fat-file-name "#" buffer-file-name "#"))
  2440. +      (t (expand-file-name (add-to-fat-file-name "#%"
  2441. +                (make-legal-file-name (buffer-name)) "#"))))))
  2442. +
  2443. +
  2444. +;;
  2445. +;; Requires patched Emacs: valid-file-name-p
  2446. +;;
  2447. +(defun make-backup-file-name (file)
  2448. +  "Create the non-numeric backup file name for FILE.
  2449. +This is a separate function so you can redefine it for customization."
  2450. +  (let (backup)
  2451. +    (or
  2452. +     (progn (setq backup (concat file "~")) (valid-file-name-p backup))
  2453. +     (setq backup (add-to-fat-file-name nil file "~")))
  2454. +    backup))
  2455. +
  2456. +(defun split-file-name (name)
  2457. +  "Split NAME into directory part, base name part and extension.
  2458. +Return a list containing three elements. If a part is empty, the list element
  2459. +is nil."
  2460. +  (let* ((dir (file-name-directory name))
  2461. +     (file (file-name-nondirectory name))
  2462. +     (pos (string-match "\\.[^.]*$" file))
  2463. +     (base (if pos (substring file 0 pos) file))
  2464. +     (ext (if pos (substring file pos) nil)))
  2465. +    (list dir base ext)))
  2466. +
  2467. +(defun add-to-fat-file-name (prefix file suffix)
  2468. +  "Concatenate PREFIX, FILE and SUFFIX, then make it FAT compatible.
  2469. +It is assumed that FILE is already compatible with the FAT file system."
  2470. +  (let* ((split (split-file-name file))
  2471. +     (base (concat prefix (nth 1 split)))
  2472. +     (ext (nth 2 split))
  2473. +     (ext-len (length ext))
  2474. +     (suffix-len (length suffix)))
  2475. +    (if (> (length base) 8)
  2476. +    (setq base (substring base 0 8)))
  2477. +    (while (and (> suffix-len 0) (eq (elt suffix 0) ?.))
  2478. +      (setq suffix-len (1- suffix-len))
  2479. +      (setq suffix (substring suffix 1)))
  2480. +    (if (> suffix-len 3) (progn (setq suffix-len 3) (setq suffix (substring suffix 0 3))))
  2481. +    (if (zerop suffix-len)
  2482. +    file
  2483. +      (cond ((null ext) (setq ext (concat "." suffix)))
  2484. +        ((<= (+ ext-len suffix-len) 4)
  2485. +         (setq ext (concat ext suffix)))
  2486. +        (t (setq ext (concat "." (substring ext 1
  2487. +                        (- 4 suffix-len)) suffix))))
  2488. +      (concat (car split) base ext))))
  2489. +
  2490. +(setq completion-ignored-extensions
  2491. +      (append completion-ignored-extensions
  2492. +          (list ".com" ".exe" ".dll" ".obj" ".bak" ".zip" ".arj" ".lzh"
  2493. +            ".ico" ".zoo" ".Z" ".gz")))
  2494. +
  2495. +(setq meta-flag t)
  2496. +(setq default-ctl-arrow 1)
  2497. +
  2498. +
  2499. +;
  2500. +; Display names of special keys -- requires patched GNU Emacs
  2501. +;
  2502. +(defun key-description (keys)
  2503. +  "Return a pretty description of key-sequence KEYS.
  2504. +Control characters turn into \"C-foo\" sequences, meta into \"M-foo\"
  2505. +the names of PC function keys are inserted,
  2506. +spaces are put between sequence elements, etc."
  2507. +  (let ((result "") (add "") (index 0) (len (length keys)) char new)
  2508. +    (while (< index len)
  2509. +      (setq char (elt keys index))
  2510. +      (setq index (1+ index))
  2511. +      (cond
  2512. +       ;;--------required for Emacs without 8-bit keymaps---------
  2513. +       ;; ((and (zerop char) (< (1+ index) len)
  2514. +       ;; (= (elt keys index) 27)
  2515. +       ;;      (setq new (aref pc-function-keys
  2516. +       ;;              (+ (elt keys (1+ index)) 128))))
  2517. +       ;;   (setq index (+ index 2)))
  2518. +       ((and (zerop char) (< index len)
  2519. +             (setq new (aref pc-function-keys (elt keys index))))
  2520. +        (setq index (1+ index)))
  2521. +       (t (setq new (single-key-description char))))
  2522. +      (setq result (concat result add new))
  2523. +      (setq add " "))
  2524. +    result))
  2525. +
  2526. +(defvar pc-function-keys (make-vector 256 nil)
  2527. +  "Array containing descriptions of the PC function keys.")
  2528. +
  2529. +(aset pc-function-keys     1 "A-ESC")
  2530. +(aset pc-function-keys   3 "C-2")
  2531. +(aset pc-function-keys    14 "A-BS")
  2532. +(aset pc-function-keys    15 "BTAB")
  2533. +(aset pc-function-keys    16 "A-q")
  2534. +(aset pc-function-keys    17 "A-w")
  2535. +(aset pc-function-keys    18 "A-e")
  2536. +(aset pc-function-keys    19 "A-r")
  2537. +(aset pc-function-keys    20 "A-t")
  2538. +(aset pc-function-keys    21 "A-y")
  2539. +(aset pc-function-keys    22 "A-u")
  2540. +(aset pc-function-keys    23 "A-i")
  2541. +(aset pc-function-keys    24 "A-o")
  2542. +(aset pc-function-keys    25 "A-p")
  2543. +(aset pc-function-keys    27 "A-[")
  2544. +(aset pc-function-keys    28 "A-]")
  2545. +(aset pc-function-keys    29 "A-RET")
  2546. +(aset pc-function-keys    30 "A-a")
  2547. +(aset pc-function-keys    31 "A-s")
  2548. +(aset pc-function-keys    32 "A-d")
  2549. +(aset pc-function-keys    33 "A-f")
  2550. +(aset pc-function-keys    34 "A-g")
  2551. +(aset pc-function-keys    35 "A-h")
  2552. +(aset pc-function-keys    36 "A-j")
  2553. +(aset pc-function-keys    37 "A-k")
  2554. +(aset pc-function-keys    38 "A-l")
  2555. +(aset pc-function-keys    39 "A-;")
  2556. +(aset pc-function-keys    40 "A-`")
  2557. +(aset pc-function-keys    43 "A-\\")
  2558. +(aset pc-function-keys    44 "A-z")
  2559. +(aset pc-function-keys    45 "A-x")
  2560. +(aset pc-function-keys    46 "A-c")
  2561. +(aset pc-function-keys    47 "A-v")
  2562. +(aset pc-function-keys    48 "A-b")
  2563. +(aset pc-function-keys    49 "A-n")
  2564. +(aset pc-function-keys    50 "A-m")
  2565. +(aset pc-function-keys    51 "A-,")
  2566. +(aset pc-function-keys    52 "A-.")
  2567. +(aset pc-function-keys    53 "A-/")
  2568. +(aset pc-function-keys    55 "A-NUM*")
  2569. +(aset pc-function-keys    59 "F1")
  2570. +(aset pc-function-keys    60 "F2")
  2571. +(aset pc-function-keys    61 "F3")
  2572. +(aset pc-function-keys    62 "F4")
  2573. +(aset pc-function-keys    63 "F5")
  2574. +(aset pc-function-keys    64 "F6")
  2575. +(aset pc-function-keys    65 "F7")
  2576. +(aset pc-function-keys    66 "F8")
  2577. +(aset pc-function-keys    67 "F9")
  2578. +(aset pc-function-keys    68 "F10")
  2579. +(aset pc-function-keys    71 "HOME")
  2580. +(aset pc-function-keys    72 "UP")
  2581. +(aset pc-function-keys    73 "PAGEUP")
  2582. +(aset pc-function-keys    74 "A-NUM-")
  2583. +(aset pc-function-keys    75 "LEFT")
  2584. +(aset pc-function-keys    76 "CENTER")
  2585. +(aset pc-function-keys    77 "RIGHT")
  2586. +(aset pc-function-keys    78 "A-NUM+")
  2587. +(aset pc-function-keys    79 "END")
  2588. +(aset pc-function-keys    80 "DOWN")
  2589. +(aset pc-function-keys    81 "PAGEDOWN")
  2590. +(aset pc-function-keys    82 "INSERT")
  2591. +(aset pc-function-keys    83 "DELETE")
  2592. +(aset pc-function-keys    84 "S-F1")
  2593. +(aset pc-function-keys    85 "S-F2")
  2594. +(aset pc-function-keys    86 "S-F3")
  2595. +(aset pc-function-keys    87 "S-F4")
  2596. +(aset pc-function-keys    88 "S-F5")
  2597. +(aset pc-function-keys    89 "S-F6")
  2598. +(aset pc-function-keys    90 "S-F7")
  2599. +(aset pc-function-keys    91 "S-F8")
  2600. +(aset pc-function-keys    92 "S-F9")
  2601. +(aset pc-function-keys    93 "S-F10")
  2602. +(aset pc-function-keys    94 "C-F1")
  2603. +(aset pc-function-keys    95 "C-F2")
  2604. +(aset pc-function-keys    96 "C-F3")
  2605. +(aset pc-function-keys    97 "C-F4")
  2606. +(aset pc-function-keys    98 "C-F5")
  2607. +(aset pc-function-keys    99 "C-F6")
  2608. +(aset pc-function-keys 100 "C-F7")
  2609. +(aset pc-function-keys 101 "C-F8")
  2610. +(aset pc-function-keys 102 "C-F9")
  2611. +(aset pc-function-keys 103 "C-F10")
  2612. +(aset pc-function-keys 104 "A-F1")
  2613. +(aset pc-function-keys 105 "A-F2")
  2614. +(aset pc-function-keys 106 "A-F3")
  2615. +(aset pc-function-keys 107 "A-F4")
  2616. +(aset pc-function-keys 108 "A-F5")
  2617. +(aset pc-function-keys 109 "A-F6")
  2618. +(aset pc-function-keys 110 "A-F7")
  2619. +(aset pc-function-keys 111 "A-F8")
  2620. +(aset pc-function-keys 112 "A-F9")
  2621. +(aset pc-function-keys 113 "A-F10")
  2622. +(aset pc-function-keys 114 "C-PRTSC")
  2623. +(aset pc-function-keys 115 "C-LEFT")
  2624. +(aset pc-function-keys 116 "C-RIGHT")
  2625. +(aset pc-function-keys 117 "C-END")
  2626. +(aset pc-function-keys 118 "C-PAGEDOWN")
  2627. +(aset pc-function-keys 119 "C-HOME")
  2628. +(aset pc-function-keys 120 "A-1")
  2629. +(aset pc-function-keys 121 "A-2")
  2630. +(aset pc-function-keys 122 "A-3")
  2631. +(aset pc-function-keys 123 "A-4")
  2632. +(aset pc-function-keys 124 "A-5")
  2633. +(aset pc-function-keys 125 "A-6")
  2634. +(aset pc-function-keys 126 "A-7")
  2635. +(aset pc-function-keys 127 "A-8")
  2636. +(aset pc-function-keys 128 "A-9")
  2637. +(aset pc-function-keys 132 "C-PAGEUP")
  2638. +(aset pc-function-keys 133 "F11")
  2639. +(aset pc-function-keys 134 "F12")
  2640. +(aset pc-function-keys 135 "S-F11")
  2641. +(aset pc-function-keys 136 "S-F12")
  2642. +(aset pc-function-keys 137 "C-F11")
  2643. +(aset pc-function-keys 138 "C-F12")
  2644. +(aset pc-function-keys 139 "A-F11")
  2645. +(aset pc-function-keys 140 "A-F12")
  2646. +(aset pc-function-keys 141 "C-UP")
  2647. +(aset pc-function-keys 142 "C-NUM-")
  2648. +(aset pc-function-keys 143 "C-CENTER")
  2649. +(aset pc-function-keys 144 "C-NUM+")
  2650. +(aset pc-function-keys 145 "C-DOWN")
  2651. +(aset pc-function-keys 146 "C-INSERT")
  2652. +(aset pc-function-keys 147 "C-DELETE")
  2653. +(aset pc-function-keys 148 "C-TAB")
  2654. +(aset pc-function-keys 149 "C-NUM/")
  2655. +(aset pc-function-keys 150 "C-NUM*")
  2656. +(aset pc-function-keys 151 "A-HOME")
  2657. +(aset pc-function-keys 152 "A-UP")
  2658. +(aset pc-function-keys 153 "A-PAGEUP")
  2659. +(aset pc-function-keys 155 "A-LEFT")
  2660. +(aset pc-function-keys 157 "A-RIGHT")
  2661. +(aset pc-function-keys 159 "A-END")
  2662. +(aset pc-function-keys 160 "A-DOWN")
  2663. +(aset pc-function-keys 161 "A-PAGEDOWN")
  2664. +(aset pc-function-keys 162 "A-INSERT")
  2665. +(aset pc-function-keys 163 "A-DELETE")
  2666. +(aset pc-function-keys 164 "A-NUM/")
  2667. +(aset pc-function-keys 165 "A-TAB")
  2668. +(aset pc-function-keys 166 "A-ENTER")
  2669. +;;
  2670. +
  2671. +(setq shell-prompt-pattern "^\\[.*\\] *")
  2672. +(setq shell-file-name "cmd")
  2673. +(setq null-filename "nul")
  2674. +(setq shell-command-option "\/c")
  2675. +(set-default-file-coding-system *sjis*dos)
  2676. +(set-display-coding-system *sjis*)
  2677. +(set-keyboard-coding-system *sjis*)
  2678. diff -urP /mule-1.1/lisp/picture.el ./lisp/picture.el
  2679. --- /mule-1.1/lisp/picture.el    Mon Mar 14 14:44:08 1994
  2680. +++ ./lisp/picture.el    Wed Mar 23 17:23:18 1994
  2681. @@ -211,7 +211,8 @@
  2682.  Do \\[command-apropos]  picture-movement  to see those commands."
  2683.    (interactive "p")
  2684.    (while (> arg 0)            ; 89.9.7 by K.Handa
  2685. -    (picture-insert-string (make-string arg last-input-char))))
  2686. +    (picture-insert-string (make-string arg last-input-char))
  2687. +    (setq arg 0)))            ; 94.3.23 by O.Sasaki
  2688.  
  2689.  ;;; 89.9.7  by K.Handa
  2690.  (defun picture-insert-after-hook (begin end)
  2691. diff -urP /mule-1.1/lisp/shell.el ./lisp/shell.el
  2692. --- /mule-1.1/lisp/shell.el    Tue May 25 22:42:42 1993
  2693. +++ ./lisp/shell.el    Mon Sep 27 16:47:06 1993
  2694. @@ -132,7 +132,7 @@
  2695.    (let* ((prog (or explicit-shell-file-name
  2696.             (getenv "ESHELL")
  2697.             (getenv "SHELL")
  2698. -           "/bin/sh"))             
  2699. +           "cmd"))             
  2700.       (name (file-name-nondirectory prog)))
  2701.      (switch-to-buffer
  2702.       (apply 'make-shell "shell" prog
  2703. @@ -141,7 +141,7 @@
  2704.          (let ((symbol (intern-soft (concat "explicit-" name "-args"))))
  2705.            (if (and symbol (boundp symbol))
  2706.            (symbol-value symbol)
  2707. -        '("-i")))))))
  2708. +        '("/q" "/s")))))))
  2709.  
  2710.  (defun make-shell (name program &optional startfile &rest switches)
  2711.    (let ((buffer (get-buffer-create (concat "*" name "*")))
  2712. @@ -156,15 +156,16 @@
  2713.      (if proc (delete-process proc))
  2714.      (setq proc (apply 'start-process name buffer
  2715.                (concat exec-directory "env")
  2716. -              (format "TERMCAP=emacs:co#%d:tc=unknown:"
  2717. +              (format "TERMCAP=/emx/etc/termcap.dat"
  2718.                    (screen-width))
  2719. -              "TERM=emacs"
  2720. +              "TERM=mono"
  2721.                "EMACS=t"
  2722. +                          "PROMPT=[$p]"
  2723.                "-"
  2724.                (or program explicit-shell-file-name
  2725.                    (getenv "ESHELL")
  2726.                    (getenv "SHELL")
  2727. -                  "/bin/sh")
  2728. +                  "cmd")
  2729.                switches))
  2730.      (cond (startfile
  2731.             ;;This is guaranteed to wait long enough
  2732. @@ -237,13 +238,13 @@
  2733.  
  2734.  (defun shell-set-directory ()
  2735.    (cond ((and (looking-at shell-popd-regexp)
  2736. -          (memq (char-after (match-end 0)) '(?\; ?\n)))
  2737. +          (memq (char-after (match-end 0)) '(?\& ?\n)))
  2738.       (if shell-directory-stack
  2739.           (progn
  2740.             (cd (car shell-directory-stack))
  2741.             (setq shell-directory-stack (cdr shell-directory-stack)))))
  2742.      ((looking-at shell-pushd-regexp)
  2743. -     (cond ((memq (char-after (match-end 0)) '(?\; ?\n))
  2744. +     (cond ((memq (char-after (match-end 0)) '(?\& ?\n))
  2745.          (if shell-directory-stack
  2746.              (let ((old default-directory))
  2747.                (cd (car shell-directory-stack))
  2748. @@ -260,14 +261,14 @@
  2749.                    (buffer-substring
  2750.                      (point)
  2751.                      (progn
  2752. -                      (skip-chars-forward "^\n \t;")
  2753. +                      (skip-chars-forward "^\n \t&")
  2754.                        (point)))))))
  2755.                (progn
  2756.              (setq shell-directory-stack
  2757.                    (cons default-directory shell-directory-stack))
  2758.              (cd dir)))))))
  2759.      ((looking-at shell-cd-regexp)
  2760. -     (cond ((memq (char-after (match-end 0)) '(?\; ?\n))
  2761. +     (cond ((memq (char-after (match-end 0)) '(?\& ?\n))
  2762.          (cd (getenv "HOME")))
  2763.             ((memq (char-after (match-end 0)) '(?\  ?\t))
  2764.          (let (dir)
  2765. @@ -280,7 +281,7 @@
  2766.                    (buffer-substring
  2767.                      (point)
  2768.                      (progn
  2769. -                      (skip-chars-forward "^\n \t;")
  2770. +                      (skip-chars-forward "^\n \t&")
  2771.                        (point)))))))
  2772.                (cd dir))))))))
  2773.    
  2774. diff -urP /mule-1.1/lisp/x-mouse.el ./lisp/x-mouse.el
  2775. --- /mule-1.1/lisp/x-mouse.el    Thu May 27 03:21:30 1993
  2776. +++ ./lisp/x-mouse.el    Mon Mar 28 19:35:16 1994
  2777. @@ -1,4 +1,4 @@
  2778. -;; Mouse support for X window system.
  2779. +;; Mouse support for OS/2 PM window system.
  2780.  ;; Copyright (C) 1985, 1987 Free Software Foundation, Inc.
  2781.  
  2782.  ;; This file is part of GNU Emacs.
  2783. @@ -32,69 +32,69 @@
  2784.  (defvar x-cut-text-attribute 'inverse
  2785.    "*Charcater attribute to show the region of cut text.") ;92.10.19 by K.Handa
  2786.  
  2787. -(defconst x-button-right (char-to-string 0))
  2788. -(defconst x-button-middle (char-to-string 1))
  2789. -(defconst x-button-left (char-to-string 2))
  2790. -
  2791. -(defconst x-button-right-up (char-to-string 4))
  2792. -(defconst x-button-middle-up (char-to-string 5))
  2793. -(defconst x-button-left-up (char-to-string 6))
  2794. -
  2795. -(defconst x-button-s-right (char-to-string 16))
  2796. -(defconst x-button-s-middle (char-to-string 17))
  2797. -(defconst x-button-s-left (char-to-string 18))
  2798. -
  2799. -(defconst x-button-s-right-up (char-to-string 20))
  2800. -(defconst x-button-s-middle-up (char-to-string 21))
  2801. -(defconst x-button-s-left-up (char-to-string 22))
  2802. -
  2803. -(defconst x-button-m-right (char-to-string 32))
  2804. -(defconst x-button-m-middle (char-to-string 33))
  2805. -(defconst x-button-m-left (char-to-string 34))
  2806. -
  2807. -(defconst x-button-m-right-up (char-to-string 36))
  2808. -(defconst x-button-m-middle-up (char-to-string 37))
  2809. -(defconst x-button-m-left-up (char-to-string 38))
  2810. -
  2811. -(defconst x-button-c-right (char-to-string 64))
  2812. -(defconst x-button-c-middle (char-to-string 65))
  2813. -(defconst x-button-c-left (char-to-string 66))
  2814. -
  2815. -(defconst x-button-c-right-up (char-to-string 68))
  2816. -(defconst x-button-c-middle-up (char-to-string 69))
  2817. -(defconst x-button-c-left-up (char-to-string 70))
  2818. -
  2819. -(defconst x-button-m-s-right (char-to-string 48))
  2820. -(defconst x-button-m-s-middle (char-to-string 49))
  2821. -(defconst x-button-m-s-left (char-to-string 50))
  2822. -
  2823. -(defconst x-button-m-s-right-up (char-to-string 52))
  2824. -(defconst x-button-m-s-middle-up (char-to-string 53))
  2825. -(defconst x-button-m-s-left-up (char-to-string 54))
  2826. -
  2827. -(defconst x-button-c-s-right (char-to-string 80))
  2828. -(defconst x-button-c-s-middle (char-to-string 81))
  2829. -(defconst x-button-c-s-left (char-to-string 82))
  2830. -
  2831. -(defconst x-button-c-s-right-up (char-to-string 84))
  2832. -(defconst x-button-c-s-middle-up (char-to-string 85))
  2833. -(defconst x-button-c-s-left-up (char-to-string 86))
  2834. -
  2835. -(defconst x-button-c-m-right (char-to-string 96))
  2836. -(defconst x-button-c-m-middle (char-to-string 97))
  2837. -(defconst x-button-c-m-left (char-to-string 98))
  2838. -
  2839. -(defconst x-button-c-m-right-up (char-to-string 100))
  2840. -(defconst x-button-c-m-middle-up (char-to-string 101))
  2841. -(defconst x-button-c-m-left-up (char-to-string 102))
  2842. -
  2843. -(defconst x-button-c-m-s-right (char-to-string 112))
  2844. -(defconst x-button-c-m-s-middle (char-to-string 113))
  2845. -(defconst x-button-c-m-s-left (char-to-string 114))
  2846. -
  2847. -(defconst x-button-c-m-s-right-up (char-to-string 116))
  2848. -(defconst x-button-c-m-s-middle-up (char-to-string 117))
  2849. -(defconst x-button-c-m-s-left-up (char-to-string 118))
  2850. +(defconst x-button-left (char-to-string 1))
  2851. +(defconst x-button-middle (char-to-string 2))
  2852. +(defconst x-button-right (char-to-string 3))
  2853. +
  2854. +(defconst x-button-left-up (char-to-string 5))
  2855. +(defconst x-button-middle-up (char-to-string 6))
  2856. +(defconst x-button-right-up (char-to-string 7))
  2857. +
  2858. +(defconst x-button-s-left (char-to-string 33))
  2859. +(defconst x-button-s-middle (char-to-string 34))
  2860. +(defconst x-button-s-right (char-to-string 35))
  2861. +
  2862. +(defconst x-button-s-left-up (char-to-string 37))
  2863. +(defconst x-button-s-middle-up (char-to-string 38))
  2864. +(defconst x-button-s-right-up (char-to-string 39))
  2865. +
  2866. +(defconst x-button-m-left (char-to-string 129))
  2867. +(defconst x-button-m-middle (char-to-string 130))
  2868. +(defconst x-button-m-right (char-to-string 131))
  2869. +
  2870. +(defconst x-button-m-left-up (char-to-string 133))
  2871. +(defconst x-button-m-middle-up (char-to-string 134))
  2872. +(defconst x-button-m-right-up (char-to-string 135))
  2873. +
  2874. +(defconst x-button-c-left (char-to-string 65))
  2875. +(defconst x-button-c-middle (char-to-string 66))
  2876. +(defconst x-button-c-right (char-to-string 67))
  2877. +
  2878. +(defconst x-button-c-left-up (char-to-string 69))
  2879. +(defconst x-button-c-middle-up (char-to-string 70))
  2880. +(defconst x-button-c-right-up (char-to-string 71))
  2881. +
  2882. +(defconst x-button-m-s-left (char-to-string 161))
  2883. +(defconst x-button-m-s-middle (char-to-string 162))
  2884. +(defconst x-button-m-s-right (char-to-string 163))
  2885. +
  2886. +(defconst x-button-m-s-left-up (char-to-string 165))
  2887. +(defconst x-button-m-s-middle-up (char-to-string 166))
  2888. +(defconst x-button-m-s-right-up (char-to-string 167))
  2889. +
  2890. +(defconst x-button-c-s-left (char-to-string 97))
  2891. +(defconst x-button-c-s-middle (char-to-string 98))
  2892. +(defconst x-button-c-s-right (char-to-string 99))
  2893. +
  2894. +(defconst x-button-c-s-left-up (char-to-string 101))
  2895. +(defconst x-button-c-s-middle-up (char-to-string 102))
  2896. +(defconst x-button-c-s-right-up (char-to-string 103))
  2897. +
  2898. +(defconst x-button-c-m-left (char-to-string 193))
  2899. +(defconst x-button-c-m-middle (char-to-string 194))
  2900. +(defconst x-button-c-m-right (char-to-string 195))
  2901. +
  2902. +(defconst x-button-c-m-left-up (char-to-string 197))
  2903. +(defconst x-button-c-m-middle-up (char-to-string 198))
  2904. +(defconst x-button-c-m-right-up (char-to-string 199))
  2905. +
  2906. +(defconst x-button-c-m-s-left (char-to-string 225))
  2907. +(defconst x-button-c-m-s-middle (char-to-string 226))
  2908. +(defconst x-button-c-m-s-right (char-to-string 227))
  2909. +
  2910. +(defconst x-button-c-m-s-left-up (char-to-string 229))
  2911. +(defconst x-button-c-m-s-middle-up (char-to-string 230))
  2912. +(defconst x-button-c-m-s-right-up (char-to-string 231))
  2913.  
  2914.  (defvar x-process-mouse-hook nil
  2915.    "Hook to run after each mouse event is processed.  Should take two
  2916. @@ -161,6 +161,11 @@
  2917.    (if (x-mouse-select arg)
  2918.        (split-window-vertically nil)))
  2919.  
  2920. +(defun pm-mouse-select-and-split-h (arg)
  2921. +  "Select Emacs window mouse is on, then split it horizontally in half."
  2922. +  (if (x-mouse-select arg)
  2923. +      (split-window-horizontally nil)))
  2924. +
  2925.  (defun x-mouse-set-point (arg)
  2926.    "Select Emacs window mouse is on, and move point to mouse position."
  2927.    (let* ((relative-coordinate (x-mouse-select arg))
  2928. @@ -245,19 +250,33 @@
  2929.  (defun x-buffer-menu (arg)
  2930.    "Pop up a menu of buffers for selection with the mouse."
  2931.    (let ((menu
  2932. -     (list "Buffer Menu"
  2933. +     (list "âoâbâtâ@ âüâjâàü["
  2934.             (cons "Select Buffer"
  2935.               (let ((tail (buffer-list))
  2936. +               (maxbuf 0)
  2937.                 head)
  2938.                 (while tail
  2939. +             (or (eq ?\ (aref (buffer-name (car tail)) 0))
  2940. +                 (setq maxbuf
  2941. +                   (max maxbuf
  2942. +                    (length (buffer-name (car tail))))))
  2943. +             (setq tail (cdr tail)))
  2944. +               (setq tail (buffer-list))
  2945. +               (while tail
  2946.               (let ((elt (car tail)))
  2947.                 (if (not (string-match "^ "
  2948.                            (buffer-name elt)))
  2949.                     (setq head (cons
  2950.                         (cons
  2951.                          (format
  2952. -                         "%14s   %s"
  2953. +                         (format "%%%ds %%s%%s %%s"
  2954. +                             maxbuf)
  2955.                           (buffer-name elt)
  2956. +                         (if (buffer-modified-p elt)
  2957. +                         "*" " ")
  2958. +                         (save-excursion
  2959. +                           (set-buffer elt)
  2960. +                           (if buffer-read-only "%" " "))
  2961.                           (or (buffer-file-name elt) ""))
  2962.                          elt)
  2963.                         head))))
  2964. @@ -270,71 +289,180 @@
  2965.    (let ((selection
  2966.       (x-popup-menu
  2967.        arg
  2968. -      '("Help" ("Is there a command that..."
  2969. -            ("Command apropos" . command-apropos)
  2970. -            ("Apropos" . apropos))
  2971. -           ("Key Commands <==> Functions"
  2972. -            ("List all keystroke commands" . describe-bindings)
  2973. -            ("Describe key briefly" . describe-key-briefly)
  2974. -            ("Describe key verbose" . describe-key)
  2975. -            ("Describe Lisp function" . describe-function)
  2976. -            ("Where is this command" . where-is))
  2977. -           ("Manual and tutorial"
  2978. -            ("Info system" . info)
  2979. -            ("Invoke Emacs tutorial" . help-with-tutorial))
  2980. -           ("Odds and ends"
  2981. -            ("Last 100 Keystrokes" . view-lossage)
  2982. -            ("Describe syntax table" . describe-syntax))
  2983. -           ("Modes"
  2984. -            ("Describe current major mode" . describe-mode)
  2985. -            ("List all keystroke commands" . describe-bindings))
  2986. -           ("Administrivia"
  2987. -            ("View Emacs news" . view-emacs-news)
  2988. -            ("View the GNU Emacs license" . describe-copying)
  2989. -            ("Describe distribution" . describe-distribution)
  2990. -            ("Describe (non)warranty" . describe-no-warranty))))))
  2991. +      '("âwâïâv"
  2992. +        ("îƒì⌡"
  2993. +         ("ò╢ÄÜù±îƒì⌡(âRâ}âôâhé╠é▌)" . command-apropos)
  2994. +         ("ò╢ÄÜù±îƒì⌡" . apropos))
  2995. +        ("âLü[ÆΦï`üAè╓Éö"
  2996. +         ("æSâLü[üEâRâ}âôâhò\Ī" . describe-bindings)
  2997. +         ("âLü[ÆΦï`ü╦è╓Éöû╝ò\Ī" . describe-key-briefly)
  2998. +         ("âLü[ÆΦï`ü╦Éαû╛é╞è╓Éöò\Ī" . describe-key)
  2999. +         ("è╓Éöü╦Éαû╛ò\Ī" . describe-function)
  3000. +         ("è╓Éöü╦âLü[ÆΦï`" . where-is))
  3001. +        ("â}âjâàâAâïù▐"
  3002. +         ("InfoâvâìâOâëâÇ" . info)
  3003. +         ("Muleâ`âàü[âgâèâAâï" . help-with-tutorial-for-mule)
  3004. +         ("Emacsâ`âàü[âgâèâAâï" . help-with-tutorial))
  3005. +        ("Odds and ends"
  3006. +         ("ôⁿù═ùÜù≡" . view-lossage)
  3007. +         ("ì\ò╢âeü[âuâï" . describe-syntax))
  3008. +        ("âéü[âh"
  3009. +         ("î╗âéü[âhÅεò±" . describe-mode)
  3010. +         ("æSâLü[üEâRâ}âôâh" . describe-bindings))
  3011. +        ("ë^ëcÅεò±"
  3012. +         ("âjâàü[âX" . view-emacs-news)
  3013. +         ("Æÿì∞îá" . describe-copying)
  3014. +         ("özòz" . describe-distribution)
  3015. +         ("ò█Å╪" . describe-no-warranty))))))
  3016.      (and selection (call-interactively selection))))
  3017.  
  3018. +(defun pm-select-font (arg)
  3019. +  "PMö┼MuleÅπé╠âtâHâôâgé≡É╪éΦè╖éªéΘ"
  3020. +  (let ((selection
  3021. +     (x-popup-menu
  3022. +      arg
  3023. +      '("âtâHâôâgæIæ≡"
  3024. +        ("MINCHO"
  3025. +         ("6pt"    "6.MINCHO")
  3026. +         ("8pt"    "8.MINCHO")
  3027. +         ("10pt"    "10.MINCHO")
  3028. +         ("11pt"    "11.MINCHO")
  3029. +         ("12pt"    "12.MINCHO")
  3030. +         ("14pt"    "14.MINCHO")
  3031. +;         ("17pt"    "17.MINCHO")
  3032. +;         ("18pt"    "18.MINCHO")
  3033. +;         ("19pt"    "19.MINCHO")
  3034. +         )
  3035. +        ("MINCHO System"
  3036. +         ("6pt"    "6.MINCHO System")
  3037. +         ("8pt"    "8.MINCHO System")
  3038. +         ("10pt"    "10.MINCHO System")
  3039. +         ("11pt"    "11.MINCHO System")
  3040. +         ("12pt"    "12.MINCHO System")
  3041. +         ("14pt"    "14.MINCHO System")
  3042. +;         ("17pt"    "17.MINCHO System")
  3043. +;         ("18pt"    "18.MINCHO System")
  3044. +;         ("19pt"    "19.MINCHO System")
  3045. +         )
  3046. +        ("MINCHO Terminal"
  3047. +         ("6pt"    "6.MINCHO Terminal")
  3048. +         ("8pt"    "8.MINCHO Terminal"))
  3049. +        ("GOTHIC"
  3050. +         ("6pt"    "6.GOTHIC")
  3051. +         ("8pt"    "8.GOTHIC")
  3052. +         ("10pt"    "10.GOTHIC")
  3053. +         ("11pt"    "11.GOTHIC")
  3054. +         ("12pt"    "12.GOTHIC")
  3055. +         ("14pt"    "14.GOTHIC")
  3056. +;         ("17pt"    "17.GOTHIC")
  3057. +;         ("18pt"    "18.GOTHIC")
  3058. +;         ("19pt"    "19.GOTHIC")
  3059. +         )
  3060. +        ("GOTHIC System"
  3061. +         ("6pt"    "6.GOTHIC System")
  3062. +         ("8pt"    "8.GOTHIC System")
  3063. +         ("10pt"    "10.GOTHIC System")
  3064. +         ("11pt"    "11.GOTHIC System")
  3065. +         ("12pt"    "12.GOTHIC System")
  3066. +         ("14pt"    "14.GOTHIC System")
  3067. +;         ("17pt"    "17.GOTHIC System")
  3068. +;         ("18pt"    "18.GOTHIC System")
  3069. +;         ("19pt"    "19.GOTHIC System")
  3070. +         )
  3071. +        ("GOTHIC Terminal"
  3072. +         ("6pt"    "6.GOTHIC Terminal")
  3073. +         ("8pt"    "8.GOTHIC Terminal"))
  3074. +        ("Courier"
  3075. +         ("8pt"    "8.Courier")
  3076. +         ("10pt"    "10.Courier")
  3077. +         ("12pt"    "12.Courier"))
  3078. +        ("System Monospaced"
  3079. +         ("8pt"    "8.System Monospaced")
  3080. +         ("10pt"    "10.System Monospaced"))
  3081. +;        ("outline test font"
  3082. +;         ("24pt"    "24.GOTHIC HeiseiKakuGothic-W5-H-78")
  3083. +;         ("48pt"    "48.GOTHIC HeiseiKakuGothic-W5-H-78"))
  3084. +        ))))
  3085. +    (and selection (pm-set-font (car selection)))))
  3086. +
  3087.  ; Prevent beeps on button-up.  If the button isn't bound to anything, it
  3088.  ; will beep on button-down.
  3089. -(define-key mouse-map x-button-right-up 'x-mouse-ignore)
  3090. -(define-key mouse-map x-button-middle-up 'x-mouse-ignore)
  3091.  (define-key mouse-map x-button-left-up 'x-mouse-ignore)
  3092. -(define-key mouse-map x-button-s-right-up 'x-mouse-ignore)
  3093. -(define-key mouse-map x-button-s-middle-up 'x-mouse-ignore)
  3094. +(define-key mouse-map x-button-middle-up 'x-mouse-ignore)
  3095. +(define-key mouse-map x-button-right-up 'x-mouse-ignore)
  3096.  (define-key mouse-map x-button-s-left-up 'x-mouse-ignore)
  3097. -(define-key mouse-map x-button-m-right-up 'x-mouse-ignore)
  3098. -(define-key mouse-map x-button-m-middle-up 'x-mouse-ignore)
  3099. +(define-key mouse-map x-button-s-middle-up 'x-mouse-ignore)
  3100. +(define-key mouse-map x-button-s-right-up 'x-mouse-ignore)
  3101.  (define-key mouse-map x-button-m-left-up 'x-mouse-ignore)
  3102. -(define-key mouse-map x-button-c-right-up 'x-mouse-ignore)
  3103. -(define-key mouse-map x-button-c-middle-up 'x-mouse-ignore)
  3104. +(define-key mouse-map x-button-m-middle-up 'x-mouse-ignore)
  3105. +(define-key mouse-map x-button-m-right-up 'x-mouse-ignore)
  3106.  (define-key mouse-map x-button-c-left-up 'x-mouse-ignore)
  3107. -(define-key mouse-map x-button-m-s-right-up 'x-mouse-ignore)
  3108. -(define-key mouse-map x-button-m-s-middle-up 'x-mouse-ignore)
  3109. +(define-key mouse-map x-button-c-middle-up 'x-mouse-ignore)
  3110. +(define-key mouse-map x-button-c-right-up 'x-mouse-ignore)
  3111.  (define-key mouse-map x-button-m-s-left-up 'x-mouse-ignore)
  3112. -(define-key mouse-map x-button-c-s-right-up 'x-mouse-ignore)
  3113. -(define-key mouse-map x-button-c-s-middle-up 'x-mouse-ignore)
  3114. +(define-key mouse-map x-button-m-s-middle-up 'x-mouse-ignore)
  3115. +(define-key mouse-map x-button-m-s-right-up 'x-mouse-ignore)
  3116.  (define-key mouse-map x-button-c-s-left-up 'x-mouse-ignore)
  3117. -(define-key mouse-map x-button-c-m-right-up 'x-mouse-ignore)
  3118. -(define-key mouse-map x-button-c-m-middle-up 'x-mouse-ignore)
  3119. +(define-key mouse-map x-button-c-s-middle-up 'x-mouse-ignore)
  3120. +(define-key mouse-map x-button-c-s-right-up 'x-mouse-ignore)
  3121.  (define-key mouse-map x-button-c-m-left-up 'x-mouse-ignore)
  3122. -(define-key mouse-map x-button-c-m-s-right-up 'x-mouse-ignore)
  3123. -(define-key mouse-map x-button-c-m-s-middle-up 'x-mouse-ignore)
  3124. +(define-key mouse-map x-button-c-m-middle-up 'x-mouse-ignore)
  3125. +(define-key mouse-map x-button-c-m-right-up 'x-mouse-ignore)
  3126.  (define-key mouse-map x-button-c-m-s-left-up 'x-mouse-ignore)
  3127. +(define-key mouse-map x-button-c-m-s-middle-up 'x-mouse-ignore)
  3128. +(define-key mouse-map x-button-c-m-s-right-up 'x-mouse-ignore)
  3129. +
  3130. +(define-key mouse-map x-button-c-left 'x-buffer-menu)
  3131. +(define-key mouse-map x-button-c-middle 'x-help)
  3132. +(define-key mouse-map x-button-c-right 'pm-select-font)
  3133.  
  3134. -(define-key mouse-map x-button-c-s-left 'x-buffer-menu)
  3135. -(define-key mouse-map x-button-c-s-middle 'x-help)
  3136. -(define-key mouse-map x-button-c-s-right 'x-mouse-keep-one-window)
  3137. +(define-key mouse-map x-button-s-left 'x-cut-and-wipe-text)
  3138.  (define-key mouse-map x-button-s-middle 'x-cut-text)
  3139.  (define-key mouse-map x-button-s-right 'x-paste-text)
  3140. -(define-key mouse-map x-button-c-middle 'x-cut-and-wipe-text)
  3141. -(define-key mouse-map x-button-c-right 'x-mouse-select-and-split)
  3142.  
  3143. -(if (= window-system-version 10)
  3144. -    (progn
  3145. -      (define-key mouse-map x-button-right 'x-mouse-select)
  3146. -      (define-key mouse-map x-button-left 'x-mouse-set-mark)
  3147. -      (define-key mouse-map x-button-middle 'x-mouse-set-point))
  3148. -  (define-key mouse-map x-button-right 'x-cut-text)
  3149. -  (define-key mouse-map x-button-left 'x-mouse-set-point)
  3150. -  (define-key mouse-map x-button-middle 'x-paste-text))
  3151. +(define-key mouse-map x-button-m-left 'x-mouse-select-and-split)
  3152. +(define-key mouse-map x-button-m-middle 'pm-mouse-select-and-split-h)
  3153. +(define-key mouse-map x-button-m-right 'x-mouse-keep-one-window)
  3154. +
  3155. +(define-key mouse-map x-button-left 'x-mouse-set-point)
  3156. +(define-key mouse-map x-button-middle 'x-mouse-set-mark)
  3157. +(define-key mouse-map x-button-right 'x-mouse-select)
  3158. +
  3159. +;(define-key mouse-map x-button-c-s-left 'x-buffer-menu)
  3160. +;(define-key mouse-map x-button-c-s-middle 'x-help)
  3161. +;(define-key mouse-map x-button-c-s-right 'x-mouse-keep-one-window)
  3162. +;(define-key mouse-map x-button-s-middle 'x-cut-text)
  3163. +;(define-key mouse-map x-button-s-right 'x-paste-text)
  3164. +;(define-key mouse-map x-button-c-middle 'x-cut-and-wipe-text)
  3165. +;(define-key mouse-map x-button-c-right 'x-mouse-select-and-split)
  3166. +
  3167. +;(if (= window-system-version 10)
  3168. +;    (progn
  3169. +;      (define-key mouse-map x-button-right 'x-mouse-select)
  3170. +;      (define-key mouse-map x-button-left 'x-mouse-set-mark)
  3171. +;      (define-key mouse-map x-button-middle 'x-mouse-set-point))
  3172. +;  (define-key mouse-map x-button-right 'x-cut-text)
  3173. +;  (define-key mouse-map x-button-left 'x-mouse-set-point)
  3174. +;  (define-key mouse-map x-button-middle 'x-paste-text))
  3175. +
  3176. +;;;;; test
  3177. +(defun pm-test-font-list (arg)
  3178. +  "list font test"
  3179. +  ( let ((font (pm-list-fonts "*")))
  3180. +  (with-output-to-temp-buffer "*Font Table*"
  3181. +    (while font
  3182. +      (princ (car font))
  3183. +      (princ "\n")
  3184. +      (setq font (cdr font))))))
  3185. +
  3186. +(defun pm-test-get-config (arg)
  3187. +  "list config test"
  3188. +  ( let ((conf (pm-get-config)))
  3189. +  (with-output-to-temp-buffer "*Config Table*"
  3190. +    (while conf
  3191. +      (princ (car conf))
  3192. +      (princ "\n")
  3193. +      (setq conf (cdr conf))))))
  3194. +
  3195. +(define-key mouse-map x-button-c-s-left 'pm-test-font-list)
  3196. +(define-key mouse-map x-button-c-s-middle 'pm-test-get-config)
  3197. diff -urP /mule-1.1/src/buffer.c ./src/buffer.c
  3198. --- /mule-1.1/src/buffer.c    Mon Mar 14 14:45:58 1994
  3199. +++ ./src/buffer.c    Tue Mar 15 01:30:02 1994
  3200. @@ -1254,7 +1254,11 @@
  3201.    char buf[MAXPATHLEN+1];
  3202.  
  3203.    Fset_buffer (Fget_buffer_create (build_string ("*scratch*")));
  3204. +#ifdef OS2    /* 93.8.20 O.Sasaki */
  3205. +  if (_getcwd2(buf, MAXPATHLEN) == 0 || strlwr (buf) == 0)
  3206. +#else
  3207.    if (getwd (buf) == 0)
  3208. +#endif
  3209.      fatal ("`getwd' failed: %s.\n", buf);
  3210.  
  3211.  #ifndef VMS
  3212. diff -urP /mule-1.1/src/callint.c ./src/callint.c
  3213. --- /mule-1.1/src/callint.c    Wed May 26 23:02:16 1993
  3214. +++ ./src/callint.c    Tue Mar 15 01:32:26 1994
  3215. @@ -361,8 +361,12 @@
  3216.  
  3217.      case 'k':        /* Key sequence (string) */
  3218.        args[i] = Fread_key_sequence (build_string (prompt));
  3219. +#ifdef OS2 /* 93.8.20 by O.Sasaki */
  3220. +          visargs[i] = call1 (Qkey_description, args[i]);
  3221. +#else
  3222.        teml = args[i];
  3223.        visargs[i] = Fkey_description (teml);
  3224. +#endif
  3225.        break;
  3226.  
  3227.      case 'm':        /* Value of mark.  Does not do I/O.  */
  3228. diff -urP /mule-1.1/src/callproc.c ./src/callproc.c
  3229. --- /mule-1.1/src/callproc.c    Mon Mar 14 14:45:58 1994
  3230. +++ ./src/callproc.c    Tue Mar 15 05:44:22 1994
  3231. @@ -54,6 +54,14 @@
  3232.  
  3233.  #include "config.h"
  3234.  
  3235. +/* 93.8.20 by O.Sasaki */
  3236. +#ifdef OS2
  3237. +#include <stdio.h>
  3238. +#include <process.h>
  3239. +extern char *_getcwd2();
  3240. +#endif
  3241. +/* end of patch */
  3242. +
  3243.  #define PRIO_PROCESS 0
  3244.  #include <sys/file.h>
  3245.  #ifdef USG5
  3246. @@ -199,8 +207,8 @@
  3247.  #ifdef VMS
  3248.      args[1] = build_string ("NLA0:");
  3249.  #else
  3250. -/* 91.10.16 by S.Hirano, 93.2.17 by M.Higashida */
  3251. -#if defined(MSDOS) || defined(WIN32)
  3252. +/* 91.10.16 by S.Hirano, 93.2.17 by M.Higashida, 93.8.20 O.Sasaki */
  3253. +#if defined(MSDOS) || defined(WIN32) || defined(OS2)
  3254.      args[1] = build_string ("nul");
  3255.  #else
  3256.      args[1] = build_string ("/dev/null");
  3257. @@ -249,8 +257,12 @@
  3258.  #if defined(MSDOS) || defined(WIN32)
  3259.    openp (Vexec_path, args[0], ".exe:.com:.bat:", &path, 1);
  3260.  #else
  3261. +#ifdef OS2 /* 91.8.20 by O.Sasaki */
  3262. +  openp (Vexec_path, args[0], ".exe:.com:.bat:.cmd:", &path, 1);
  3263. +#else
  3264.    openp (Vexec_path, args[0], "", &path, 1);
  3265.  #endif
  3266. +#endif /* OS2 */
  3267.  /* end of patch */
  3268.    if (NULL (path))
  3269.      {
  3270. @@ -268,7 +280,11 @@
  3271.  #ifdef WIN32 /* 93.2.17 by M.Higashida */
  3272.      fd[1] = open ("nul", O_WRONLY), fd[0] = -1;
  3273.  #else /* not WIN32 */
  3274. +#ifdef OS2 /* 93.8.20 by O.Sasaki */
  3275. +    fd[1] = open ("nul", 0), fd[0] = -1;
  3276. +#else /* not OS2 */
  3277.      fd[1] = open ("/dev/null", O_WRONLY), fd[0] = -1;
  3278. +#endif /* not OS2 */
  3279.  #endif /* not WIN32 */
  3280.  #endif /* not VMS */
  3281.    else
  3282. @@ -357,12 +373,19 @@
  3283.      if (pid == 0)
  3284.        {
  3285.      if (fd[0] >= 0)
  3286. +#ifdef OS2 /* 93.8.20 by O.Sasaki */
  3287. +      setmode (fd[0], O_TEXT);
  3288. +#else
  3289.        close (fd[0]);
  3290. +#endif
  3291.  #ifdef USG
  3292.  #ifdef HAVE_PTYS
  3293.      setpgrp ();
  3294.  #endif
  3295.  #endif
  3296. +#ifdef OS2 /* 93.8.20 By O.Sasaki */
  3297. +        pid =
  3298. +#endif
  3299.      child_setup (filefd, fd1, fd1, new_argv, env);
  3300.        }
  3301.  #endif /* not WIN32 */
  3302. @@ -391,6 +414,9 @@
  3303.  #ifndef subprocesses
  3304.        wait_without_blocking ();
  3305.  #endif subprocesses
  3306. +#ifdef OS2 /* 93.11.13 by O.Sasaki */
  3307. +      wait_for_termination (pid);
  3308. +#endif
  3309.        return Qnil;
  3310.      }
  3311.  
  3312. @@ -786,14 +812,23 @@
  3313.       register char **new_argv;
  3314.       char **env;
  3315.  {
  3316. +/* 93.8.20 by O.Sasaki */
  3317. +#ifdef OS2
  3318. +  int saved_in, saved_out, saved_err;
  3319. +  char *org_cwd = 0;
  3320. +  char org_cwd_buf[512];
  3321. +#endif
  3322. +/* end of patch */
  3323.    register int pid = getpid();
  3324.  
  3325.    setpriority (PRIO_PROCESS, pid, 0);
  3326.  
  3327. +#ifndef OS2 /* 93.8.20 by O.Sasaki */
  3328.  #ifdef subprocesses
  3329.    /* Close Emacs's descriptors that this process should not have.  */
  3330.    close_process_descs ();
  3331.  #endif
  3332. +#endif
  3333.  
  3334.    /* Note that use of alloca is always safe here.  It's obvious for systems
  3335.       that do not have true vfork or that have true (stack) alloca.
  3336. @@ -809,9 +844,19 @@
  3337.        i = XSTRING (current_buffer->directory)->size;
  3338.        temp = (unsigned char *) alloca (i + 2);
  3339.        bcopy (XSTRING (current_buffer->directory)->data, temp, i);
  3340. +/* 93.8.20 by O.Sasaki */
  3341. +#ifdef OS2
  3342. +      if (i > 1 && (temp[i-1] == '/' || temp[i-1] == '\\') && temp[i-2] != ':')
  3343. +        --i;
  3344. +      temp[i] = 0;
  3345. +      org_cwd = _getcwd2 (org_cwd_buf, sizeof (org_cwd_buf));
  3346. +      _chdir2 (temp);
  3347. +#else
  3348.        if (temp[i - 1] != '/') temp[i++] = '/';
  3349.        temp[i] = 0;
  3350.        chdir (temp);
  3351. +#endif
  3352. +/* end of patch */
  3353.      }
  3354.  
  3355.  #ifndef MAINTAIN_ENVIRONMENT
  3356. @@ -840,6 +885,13 @@
  3357.      *new_env = 0;
  3358.    }
  3359.  #endif /* Not MAINTAIN_ENVIRONMENT */
  3360. +/* 93.8.20 by O.Sasaki */
  3361. +#ifdef OS2
  3362. +  saved_in = dup (0); fcntl (saved_in, F_SETFD, 1);
  3363. +  saved_out = dup (1); fcntl (saved_out, F_SETFD, 1);
  3364. +  saved_err = dup (2); fcntl (saved_err, F_SETFD, 1);
  3365. +#endif
  3366. +/* end of patch */
  3367.  
  3368.    close (0);
  3369.    close (1);
  3370. @@ -852,6 +904,13 @@
  3371.    close (out);
  3372.    close (err);
  3373.  
  3374. +/* 93.8.20 by O.Sasaki */
  3375. +#ifdef OS2
  3376. +  /* Close Emacs's descriptors that this process should not have.  */
  3377. +  close_process_descs ();
  3378. +#endif
  3379. +/* end of patch */
  3380. +
  3381.  #ifdef USG
  3382.  #ifndef HAVE_PTYS
  3383.    setpgrp ();            /* No arguments but equivalent in this case */
  3384. @@ -868,12 +927,26 @@
  3385.    /* execvp does not accept an environment arg so the only way
  3386.       to pass this environment is to set environ.  Our caller
  3387.       is responsible for restoring the ambient value of environ.  */
  3388. +/* 93.8.20 by O.Sasaki */
  3389. +#ifndef OS2
  3390.    environ = env;
  3391.    execvp (new_argv[0], new_argv);
  3392.  
  3393.    write (1, "Couldn't exec the program ", 26);
  3394.    write (1, new_argv[0], strlen (new_argv[0]));
  3395.    _exit (1);
  3396. +#else
  3397. +  pid = spawnvpe (P_SESSION | P_MINIMIZE | P_BACKGROUND,
  3398. +                  new_argv[0], (const char * const *)new_argv,
  3399. +                  (const char * const *)env);
  3400. +  dup2 (saved_in, 0); close (saved_in);
  3401. +  dup2 (saved_out, 1); close (saved_out);
  3402. +  dup2 (saved_err, 2); close (saved_err);
  3403. +  if (org_cwd != 0)
  3404. +    _chdir2 (org_cwd);
  3405. +  return pid;
  3406. +#endif
  3407. +/* end of patch */
  3408.  }
  3409.  
  3410.  #endif /* not WIN32 */
  3411. @@ -888,8 +961,8 @@
  3412.    Lisp_Object execdir;
  3413.  
  3414.    /* Turn PATH_EXEC into a path.  Don't look at environment.  */
  3415. -/* 91.11.13 by M.Higashida */
  3416. -#if defined(MSDOS) || defined(WIN32)
  3417. +/* 91.11.13 by M.Higashida, 93.8.20 by O.Sasaki */
  3418. +#if defined(MSDOS) || defined(WIN32) || defined(OS2)
  3419.    Vexec_path = decode_env_path ("EMACSEXECPATH", PATH_EXEC);
  3420.  #else
  3421.    Vexec_path = decode_env_path (0, PATH_EXEC);
  3422. @@ -907,22 +980,30 @@
  3423.      }
  3424.  
  3425.    sh = (char *) egetenv ("SHELL");
  3426. -/* 91.10.16 by S.Hirano, 93.6.1 by M.Higashida */
  3427. -#if defined(MSDOS) || defined(WIN32)
  3428. +/* 91.10.16 by S.Hirano, 93.6.1 by M.Higashida, 93.8.23 by O.Sasaki */
  3429. +#if defined(MSDOS) || defined(WIN32) || defined(OS2)
  3430.    if (!sh) sh = egetenv("COMSPEC");
  3431.    {
  3432.      char *tem;
  3433.      if (sh)
  3434.        {
  3435.      tem = (char *) alloca (strlen (sh) + 1);
  3436. +#ifdef OS2
  3437. +    sh = (char *)dostounix_filename (strcpy (tem, sh));
  3438. +#else
  3439.      sh = dostounix_filename (strcpy (tem, sh));
  3440. +#endif
  3441.        }
  3442.    }
  3443. +#ifdef OS2
  3444. +  Vshell_file_name = build_string (sh ? sh : "/os2/cmd.exe");
  3445. +#else /* not OS2 */
  3446.  #ifdef WIN32
  3447.    Vshell_file_name = build_string (sh ? sh : "/winnt/system32/cmd.exe");
  3448.  #else /* MSDOS */
  3449.    Vshell_file_name = build_string (sh ? sh : "/command.com");
  3450.  #endif /* MSDOS */
  3451. +#endif /* OS2 */
  3452.  #else
  3453.    Vshell_file_name = build_string (sh ? sh : "/bin/sh");
  3454.  #endif
  3455. diff -urP /mule-1.1/src/dired.c ./src/dired.c
  3456. --- /mule-1.1/src/dired.c    Mon Mar 14 14:46:02 1994
  3457. +++ ./src/dired.c    Tue Mar 15 02:22:52 1994
  3458. @@ -463,14 +463,15 @@
  3459.    if (lstat (XSTRING (filename)->data, &s) < 0)
  3460.      return Qnil;
  3461.  
  3462. -/* 91.10.20, 93.2.17 by M.Higashida */
  3463. -#if defined(MSDOS) || defined(WIN32)
  3464. +/* 91.10.20, 93.2.17 by M.Higashida, 93.8.23 by O.Sasaki */
  3465. +#if defined(MSDOS) || defined(WIN32) || defined(OS2)
  3466.    {
  3467.      char *tmpnam = XSTRING (Ffile_name_nondirectory (filename))->data;
  3468.      int l = strlen(tmpnam)+1;
  3469.      
  3470.      if (l > 5 && (strcmp (&tmpnam[l-5], ".com") == 0 ||
  3471.            strcmp (&tmpnam[l-5], ".exe") == 0 ||
  3472. +                  strcmp (&tmpnam[l-5], ".cmd") == 0 || /* 93.8.23 O.Sasaki */
  3473.            strcmp (&tmpnam[l-5], ".bat") == 0))
  3474.        {
  3475.      s.st_mode |= S_IEXEC;
  3476. diff -urP /mule-1.1/src/dispnew.c ./src/dispnew.c
  3477. --- /mule-1.1/src/dispnew.c    Mon Mar 14 14:44:32 1994
  3478. +++ ./src/dispnew.c    Tue Mar 15 02:27:14 1994
  3479. @@ -809,7 +809,11 @@
  3480.    register struct display_line *l, *lnew;
  3481.    register int i;
  3482.    int pause;
  3483. +#ifdef OS2 /* 93.8.20 by O.Sasaki */
  3484. +  int preempt_count = 20;
  3485. +#else
  3486.    int preempt_count = baud_rate / 2400 + 1;
  3487. +#endif
  3488.    extern input_pending;
  3489.  
  3490.    if (screen_height == 0) abort (); /* Some bug zeros some core */
  3491. @@ -1790,6 +1794,9 @@
  3492.  #ifdef WIN32
  3493.    extern Lisp_Object Vwin32term;
  3494.  #endif
  3495. +#ifdef OS2PM /* 93.12.14 by O.Sasaki */
  3496. +  extern Lisp_Object Vos2pmterm;
  3497. +#endif
  3498.  #ifdef HAVE_X_WINDOWS
  3499.    Vxterm = Qnil;
  3500.  #endif
  3501. @@ -1802,6 +1809,9 @@
  3502.  #ifdef WIN32
  3503.    Vwin32term = Qnil;
  3504.  #endif
  3505. +#ifdef OS2PM /* 93.12.14 by O.Sasaki */
  3506. +  Vos2pmterm = Qnil;
  3507. +#endif
  3508.  /* end of patch */
  3509.  
  3510.    Vwindow_system = Qnil;
  3511. @@ -1857,6 +1867,13 @@
  3512.        Vwindow_system = intern ("win32");
  3513.        goto term_init_done;
  3514.  #endif /* WIN32 */
  3515. +#ifdef OS2PM /* 93.12.14 by O.Sasaki */
  3516. +      os2pm_term_init ();
  3517. +      Vos2pmterm = Qt;
  3518. +      Vwindow_system = intern ("os2pm");
  3519. +      Vwindow_system_version = intern ("2X"); /* 93.12.16 by O.Sasaki */
  3520. +      goto term_init_done;
  3521. +#endif /* OS2PM */
  3522.        ;
  3523.      }
  3524.  /* end of patch */
  3525. diff -urP /mule-1.1/src/doc.c ./src/doc.c
  3526. --- /mule-1.1/src/doc.c    Wed Jun 02 09:33:24 1993
  3527. +++ ./src/doc.c    Tue Mar 15 02:38:18 1994
  3528. @@ -37,7 +37,7 @@
  3529.  #define NULL(x)  (XFASTINT (x) == XFASTINT (Qnil))
  3530.  #endif
  3531.  
  3532. -#ifdef USG5
  3533. +#if defined(USG5) || defined(OS2) /* 93.8.20 by O.Sasaki */
  3534.  #include <fcntl.h>
  3535.  #endif
  3536.  
  3537. @@ -308,17 +308,29 @@
  3538.    int idx;
  3539.    int bsize;
  3540.    unsigned char *new;
  3541. +#ifdef OS2 /* 93.8.20 by O.Sasaki */
  3542. +  Lisp_Object tem;
  3543. +#else
  3544.    register Lisp_Object tem;
  3545. +#endif
  3546.    Lisp_Object keymap;
  3547.    unsigned char *start;
  3548.    int length;
  3549.    struct gcpro gcpro1; 
  3550. +#ifdef OS2 /* 93.8.20 by O.Sasaki */
  3551. +  struct gcpro gcpro2;
  3552. +  struct gcpro gcpro3;
  3553. +#endif /* not OS2 */
  3554.  
  3555.    if (NULL (str))
  3556.      return Qnil;
  3557.  
  3558.    CHECK_STRING (str, 0);
  3559. +#ifdef OS2 /* 93.8.20 by O.Sasaki */
  3560. +  GCPRO3 (str, tem, keymap)
  3561. +#else
  3562.    GCPRO1 (str);
  3563. +#endif
  3564.  
  3565.    keymap = current_buffer->keymap;
  3566.  
  3567. @@ -364,7 +376,13 @@
  3568.          }
  3569.        else
  3570.          {            /* function is on a key */
  3571. -          tem = Fkey_description (tem);
  3572. +/* 93.8.20 by O.Sasaki */
  3573. +#ifdef OS2
  3574. +              tem = call1 (Qkey_description, tem);
  3575. +#else
  3576. +              tem = Fkey_description (tem);
  3577. +#endif
  3578. +/* end of patch */
  3579.            goto subst_string;
  3580.          }
  3581.      }
  3582. diff -urP /mule-1.1/src/editfns.c ./src/editfns.c
  3583. --- /mule-1.1/src/editfns.c    Mon Mar 14 14:46:02 1994
  3584. +++ ./src/editfns.c    Tue Mar 15 02:38:52 1994
  3585. @@ -116,6 +116,9 @@
  3586.        user_name = pw ? pw->pw_name : "unknown";
  3587.      }
  3588.    Vuser_name = build_string (user_name);
  3589. +#ifdef OS2 /* 93.8.20 by O.Sasaki */
  3590. +  Vuser_real_name = build_string (user_name);
  3591. +#endif
  3592.  
  3593.    /* If the user name claimed in the environment vars differs from
  3594.       the real uid, use the claimed name to find the full name.  */
  3595. diff -urP /mule-1.1/src/emacs.c ./src/emacs.c
  3596. --- /mule-1.1/src/emacs.c    Mon Mar 14 14:44:32 1994
  3597. +++ ./src/emacs.c    Tue Mar 15 03:08:50 1994
  3598. @@ -131,6 +131,9 @@
  3599.  #endif
  3600.  #endif
  3601.  #endif
  3602. +#ifdef OS2 /* 93.8.20 by O.Sasaki */
  3603. +#include <sys/stat.h>
  3604. +#endif
  3605.  /* end of patch */
  3606.  
  3607.  #ifndef O_RDWR
  3608. @@ -190,6 +193,10 @@
  3609.  /* Nonzero if handling a fatal error already */
  3610.  int fatal_error_in_progress;
  3611.  
  3612. +#ifdef OS2 /* 93.8.20 by O.Sasaki */
  3613. +void ctrl_break_signal();
  3614. +#endif
  3615. +
  3616.  /* Handle bus errors, illegal instruction, etc. */
  3617.  fatal_error_signal (sig)
  3618.       int sig;
  3619. @@ -276,10 +283,13 @@
  3620.  #ifdef WIN32
  3621.  char **environ;
  3622.  #endif
  3623. +#ifdef OS2 /* 93.8.20 by O.Sasaki */
  3624. +extern char **environ;
  3625. +#endif
  3626.  /* end of patch */
  3627.  
  3628. -/* 92.11.4 by M.Higashida */
  3629. -#if defined(MSDOS) && defined(EMX)
  3630. +/* 92.11.4 by M.Higashida, 93.8.17 by O.Sasaki */
  3631. +#if (defined(MSDOS) && defined(EMX)) || defined(OS2)
  3632.  /* Setup all of files be input/output'ed with binary translation mdoe. */
  3633.  asm ("    .text");
  3634.  asm ("L_setbinmode:");
  3635. @@ -289,6 +299,7 @@
  3636.  #endif
  3637.  /* end of patch */
  3638.  
  3639. +#ifndef OS2     /* 93.8.17 O.Sasaki */
  3640.  /* We don't include crtbegin.o and crtend.o in the link,
  3641.     so these functions and variables might be missed.
  3642.     Provide dummy definitions to avoid error.
  3643. @@ -307,6 +318,7 @@
  3644.  {}
  3645.  #endif /* not ORDINARY_LINK */
  3646.  #endif /* __GNUC__ */
  3647. +#endif /* OS2 */
  3648.  
  3649.  #ifdef NeXT
  3650.  #include <mach/mach.h>
  3651. @@ -368,6 +380,9 @@
  3652.  #ifdef WIN32
  3653.    environ = envp;
  3654.  #endif
  3655. +#ifdef OS2 /* 93.8.20 by O.Sasaki */
  3656. +  environ = envp;
  3657. +#endif
  3658.  /* end of patch */
  3659.  
  3660.  #ifdef USG_SHARED_LIBRARIES
  3661. @@ -436,8 +451,8 @@
  3662.        open (argv[skip_args], O_RDWR, 2 );
  3663.        dup (0);
  3664.        fprintf (stderr, "Using %s\n", argv[skip_args]);
  3665. -/* 92.3.31 by K.Handa, 92.10.21 by M.Higashida */
  3666. -#if defined (HAVE_X_WINDOWS) || defined (HAVE_SUN_CONSOLE) || (defined(MSDOS) && defined(HAVE_VGA_ADAPTER)) || defined (WIN32)
  3667. +/* 92.3.31 by K.Handa, 92.10.21 by M.Higashida, 93.12.14 by O.Sasaki */
  3668. +#if defined (HAVE_X_WINDOWS) || defined (HAVE_SUN_CONSOLE) || (defined(MSDOS) && defined(HAVE_VGA_ADAPTER)) || defined (WIN32) || defined (OS2PM)
  3669.        inhibit_window_system = 1;    /* -t => -nw */
  3670.  #endif
  3671.      }
  3672. @@ -481,6 +496,12 @@
  3673.  #ifdef WIN32
  3674.    inhibit_window_system = -1;
  3675.  #endif
  3676. +#ifdef OS2PM                    /* 93.12.14 by O.Sasaki */
  3677. +  if (skip_args + 1 < argc && (!strcmp (argv[skip_args + 1], "-w"))) {
  3678. +      inhibit_window_system = -1;
  3679. +      skip_args++;
  3680. +  }
  3681. +#endif
  3682.  /* end of patch */
  3683.    if (skip_args + 1 < argc
  3684.        && (!strcmp (argv[skip_args + 1], "-nw")))
  3685. @@ -510,6 +531,14 @@
  3686.    _tzset ();
  3687.  #endif
  3688.  
  3689. +/* 93.8.20 by O.Sasaki */
  3690. +#ifdef OS2
  3691. +/* In batch mode, screen output should be normal, else binary */
  3692. +  if (! noninteractive)
  3693. +    setmode(1, O_BINARY);
  3694. +#endif
  3695. +/* end of patch */
  3696. +
  3697.    if (
  3698.  #ifndef CANNOT_DUMP
  3699.        ! noninteractive || initialized
  3700. @@ -536,7 +565,9 @@
  3701.        signal (SIGQUIT, fatal_error_signal);
  3702.        signal (SIGILL, fatal_error_signal);
  3703.        signal (SIGTRAP, fatal_error_signal);
  3704. +#ifndef OS2 /* 93.8.17 by O.Sasaki */
  3705.        signal (SIGIOT, fatal_error_signal);
  3706. +#endif
  3707.  #ifdef SIGEMT
  3708.        signal (SIGEMT, fatal_error_signal);
  3709.  #endif
  3710. @@ -552,6 +583,9 @@
  3711.        signal (SIGXFSZ, fatal_error_signal);
  3712.  #endif SIGXFSZ
  3713.  #endif /* not MSDOS and GO32 */
  3714. +#ifdef OS2 /* 93.8.20 by O.Sasaki */
  3715. +      signal (SIGBREAK, ctrl_break_signal);
  3716. +#endif /* OS2 */
  3717.  /* end of patch */
  3718.  
  3719.  #ifdef AIX
  3720. @@ -716,6 +750,9 @@
  3721.  #ifdef WIN32
  3722.        syms_of_win32term ();
  3723.  #endif
  3724. +#ifdef OS2PM            /* 93.12.14 by O.Sasaki */
  3725. +      syms_of_os2pmterm ();
  3726. +#endif
  3727.        syms_of_mc ();
  3728.        syms_of_ccl ();        /* 93.5.14 by K.Handa */
  3729.  #ifdef WNN4
  3730. @@ -898,8 +935,8 @@
  3731.  #ifndef SYSTEM_MALLOC
  3732.    malloc_init (&my_edata, malloc_warning);
  3733.  #endif
  3734. -/* 92.11.4 by M.Higashida */
  3735. -#if defined(MSDOS) && defined(EMX)
  3736. +/* 92.11.4 by M.Higashida, 93.8.20 O.Sasaki */
  3737. +#if (defined(MSDOS) && defined(EMX)) || defined(OS2)
  3738.    {
  3739.      int fd = open (XSTRING (intoname)->data,
  3740.                     O_WRONLY|O_CREAT|O_TRUNC, S_IREAD|S_IWRITE);
  3741. @@ -910,10 +947,10 @@
  3742.        close (fd);
  3743.      }
  3744.    }
  3745. -#else /* not MSDOS and EMX */
  3746. +#else /* not MSDOS and EMX or not OS2 */
  3747.    unexec (XSTRING (intoname)->data,
  3748.        !EQ (symname, Qnil) ? XSTRING (symname)->data : 0, &my_edata, 0, 0);
  3749. -#endif /* not MSDOS and EMX */
  3750. +#endif /* not MSDOS and EMX or not OS2 */
  3751.  /* end of patch */
  3752.  #endif /* not VMS */
  3753.  
  3754. @@ -929,12 +966,12 @@
  3755.  #ifdef VMS
  3756.  #define SEPCHAR ','
  3757.  #else
  3758. -/* 91.10.16 by S.Hirano, 93.2.17 by M.Higashida */
  3759. -#if defined(MSDOS) || defined(WIN32)
  3760. +/* 91.10.16 by S.Hirano, 93.2.17 by M.Higashida, 93.8.20 by O.Sasaki */
  3761. +#if defined(MSDOS) || defined(WIN32) || defined(OS2)
  3762.  #define SEPCHAR ';'
  3763.  #else
  3764.  #define SEPCHAR ':'
  3765. -#endif /* MSDOS or WIN32 */
  3766. +#endif /* MSDOS or WIN32 or OS2 */
  3767.  /* end of patch */
  3768.  #endif
  3769.  
  3770. @@ -953,8 +990,8 @@
  3771.      path = 0;
  3772.    if (!path)
  3773.      path = defalt;
  3774. -/* 91.10.16 by S.Hirano, 93.2.17 by M.Higashida */
  3775. -#if defined(MSDOS) || defined(WIN32)
  3776. +/* 91.10.16 by S.Hirano, 93.2.17 by M.Higashida, 93.8.20 by O.Sasaki */
  3777. +#if defined(MSDOS) || defined(WIN32) || defined(OS2)
  3778.    dostounix_filename(path);
  3779.  #endif
  3780.  /* end of patch */
  3781. diff -urP /mule-1.1/src/fileio.c ./src/fileio.c
  3782. --- /mule-1.1/src/fileio.c    Mon Mar 14 14:46:04 1994
  3783. +++ ./src/fileio.c    Tue Mar 15 09:19:46 1994
  3784. @@ -167,6 +167,10 @@
  3785.  #ifdef WIN32
  3786.  #include <sys/param.h>
  3787.  #endif
  3788. +#ifdef OS2 /* 93.8.20 O.Sasaki */
  3789. +#include <fcntl.h>
  3790. +#include <sys/param.h>
  3791. +#endif
  3792.  /* end of patch */
  3793.  
  3794.  #ifndef O_WRONLY
  3795. @@ -232,10 +236,10 @@
  3796.  #ifdef VMS
  3797.       && p[-1] != ':' && p[-1] != ']' && p[-1] != '>'
  3798.  #endif /* VMS */
  3799. -/* 91.10.16 by S.Hirano, 93.2.17 by M.Higashida */
  3800. -#if defined(MSDOS) || defined(WIN32)
  3801. +/* 91.10.16 by S.Hirano, 93.2.17 by M.Higashida, 93.8.20 by O.Sasaki */
  3802. +#if defined(MSDOS) || defined(WIN32) || defined(OS2)
  3803.         && p[-1] != ':'
  3804. -#endif /* MSDOS or WIN32 */
  3805. +#endif /* MSDOS or WIN32 or OS2 */
  3806.  /* end of patch */
  3807.       ) p--;
  3808.  
  3809. @@ -264,10 +268,10 @@
  3810.  #ifdef VMS
  3811.       && p[-1] != ':' && p[-1] != ']' && p[-1] != '>'
  3812.  #endif /* VMS */
  3813. -/* 91.10.16 by S.Hirano, 93.2.17 by M.Higashida */
  3814. -#if defined(MSDOS) || defined(WIN32)
  3815. +/* 91.10.16 by S.Hirano, 93.2.17 by M.Higashida, 93.8.20 by O.Sasaki */
  3816. +#if defined(MSDOS) || defined(WIN32) || defined(OS2)
  3817.         && p[-1] != ':'
  3818. -#endif /* MSDOS or WIN32 */
  3819. +#endif /* MSDOS or WIN32 or OS2 */
  3820.  /* end of patch */
  3821.       ) p--;
  3822.  
  3823. @@ -341,10 +345,10 @@
  3824.      }
  3825.  #else /* not VMS */
  3826.    /* For Unix syntax, Append a slash if necessary */
  3827. -/* 91.10.20, 93.2.17 by M.Higashida */
  3828. -#if defined(MSDOS) || defined(WIN32)
  3829. +/* 91.10.20, 93.2.17 by M.Higashida, 93.8.20 by O.Sasaki */
  3830. +#if defined(MSDOS) || defined(WIN32) || defined(OS2)
  3831.      if (out[size] != ':')
  3832. -#endif /* MSDOS or WIN32 */
  3833. +#endif /* MSDOS or WIN32 or OS2 */
  3834.    if (out[size] != '/')
  3835.      strcat (out, "/");
  3836.  #endif /* not VMS */
  3837. @@ -507,12 +511,12 @@
  3838.    /* Process as Unix format: just remove any final slash.
  3839.       But leave "/" unchanged; do not change it to "".  */
  3840.    strcpy (dst, src);
  3841. -/* 91.10.20, 93.2.17 by M.Higashida */
  3842. -#if defined(MSDOS) || defined(WIN32)
  3843. +/* 91.10.20, 93.2.17 by M.Higashida, 93.8.20 O.Sasaki */
  3844. +#if defined(MSDOS) || defined(WIN32) || defined(OS2)
  3845.      if (slen > 1 && dst[slen] == '/' && dst[slen - 1] != ':')
  3846. -#else /* not MSDOS nor WIN32 */
  3847. +#else /* not MSDOS nor WIN32 nor OS2 */
  3848.      if (dst[slen] == '/' && slen > 0)
  3849. -#endif /* not MSDOS nor WIN32 */
  3850. +#endif /* not MSDOS nor WIN32 nor OS2 */
  3851.  /* end of patch */
  3852.      dst[slen] = 0;
  3853.    return 1;
  3854. @@ -552,6 +556,25 @@
  3855.       Lisp_Object prefix;
  3856.  {
  3857.    Lisp_Object val;
  3858. +/* 93.8.20 by O.Sasaki */
  3859. +#ifdef OS2
  3860. +  char *p, *q;
  3861. +  int i;
  3862. +
  3863. +  CHECK_STRING (prefix, 0);
  3864. +  p = q = XSTRING (prefix)->data;
  3865. +  while (*p != 0)
  3866. +      {
  3867. +      if (*p == '/' || *p == ':' || *p == '\\')
  3868. +          q = p+1;
  3869. +      ++p;
  3870. +      }
  3871. +  p = XSTRING (prefix)->data;
  3872. +  i = q - p;
  3873. +  if (XSTRING (prefix)->size - i > 2)
  3874. +      prefix = make_string (XSTRING (prefix)->data, i + 2);
  3875. +#endif
  3876. +/* end of patch */
  3877.    val = concat2 (prefix, build_string ("XXXXXX"));
  3878.    mktemp (XSTRING (val)->data);
  3879.    return val;
  3880. @@ -582,8 +605,8 @@
  3881.    int lbrack = 0, rbrack = 0;
  3882.    int dots = 0;
  3883.  #endif /* VMS */
  3884. -/* 91.10.20, 93.2.17 by M.Higashida */
  3885. -#if defined(MSDOS) || defined(WIN32)
  3886. +/* 91.10.20, 93.2.17 by M.Higashida, 93.8.20 by O.Sasaki */
  3887. +#if defined(MSDOS) || defined(WIN32) || defined(OS2)
  3888.    int drive = -1;
  3889.  #endif
  3890.  /* end of patch */
  3891. @@ -597,8 +620,8 @@
  3892.  
  3893.    nm = XSTRING (name)->data;
  3894.    
  3895. -/* 91.10.20, 93.2.17 by M.Higashida */
  3896. -#if defined(MSDOS) || defined(WIN32)
  3897. +/* 91.10.20, 93.2.17 by M.Higashida, 93.8.20 by O.Sasaki */
  3898. +#if defined(MSDOS) || defined(WIN32) || defined(OS2)
  3899.    /* first of all, strip dirive name. */
  3900.    if (nm[1] == ':')
  3901.      {
  3902. @@ -607,6 +630,11 @@
  3903.      }
  3904.  #endif
  3905.  /* end of patch */
  3906. +/* 93.10.15 by O.Sasaki */
  3907. +#ifdef OS2
  3908. +  dostounix_filename (nm);
  3909. +#endif
  3910. +/* end of patch */
  3911.  
  3912.    /* If nm is absolute, flush ...// and detect /./ and /../.
  3913.       If no /./ or /../ we can return right away. */
  3914. @@ -715,12 +743,12 @@
  3915.        if (index (nm, '/'))
  3916.          return build_string (sys_translate_unix (nm));
  3917.  #endif /* VMS */
  3918. -/* 91.10.20, 93.2.17 by M.Higashida */
  3919. -#if !(defined(MSDOS) || defined(WIN32))
  3920. +/* 91.10.20, 93.2.17 by M.Higashida, 93.8.20 by O.Sasaki */
  3921. +#if !(defined(MSDOS) || defined(WIN32) || defined(OS2))
  3922.        if (nm == XSTRING (name)->data)
  3923.          return name;
  3924.        return build_string (nm);
  3925. -#endif /* not MSDOS nor WIN32 */
  3926. +#endif /* not MSDOS nor WIN32 nor OS2 */
  3927.  /* end of patch */
  3928.      }
  3929.      }
  3930. @@ -739,8 +767,8 @@
  3931.      {
  3932.        /* Handle ~ on its own.  */
  3933.        newdir = (unsigned char *) egetenv ("HOME");
  3934. -/* 91.10.16 by S.Hirano, 93.2.25 by M.Higashida */
  3935. -#if defined(MSDOS) || defined(WIN32)
  3936. +/* 91.10.16 by S.Hirano, 93.2.25 by M.Higashida, 93.8.20 by O.Sasaki */
  3937. +#if defined(MSDOS) || defined(WIN32) || defined(OS2)
  3938.        if (newdir)
  3939.          dostounix_filename (newdir);
  3940.  #endif
  3941. @@ -748,8 +776,8 @@
  3942.      }
  3943.        else
  3944.      {
  3945. -/* 91.10.16 by S.Hirano, 93.2.17 by M.Higashida */
  3946. -#if !(defined(MSDOS) || defined(WIN32))
  3947. +/* 91.10.16 by S.Hirano, 93.2.17 by M.Higashida, 93.8.20 by O.Sasaki */
  3948. +#if !(defined(MSDOS) || defined(WIN32) || defined(OS2))
  3949.        /* Handle ~ followed by user name.  */
  3950.        unsigned char *user = nm + 1;
  3951.        /* Find end of name.  */
  3952. @@ -773,7 +801,7 @@
  3953.  
  3954.        /* Discard the user name from NM.  */
  3955.        nm += len;
  3956. -#endif /* not MSDOS nor WIN32 */
  3957. +#endif /* not MSDOS nor WIN32 nor OS2 */
  3958.  /* end of patch */
  3959.      }
  3960.  
  3961. @@ -797,8 +825,8 @@
  3962.        if (NULL (defalt))
  3963.      defalt = current_buffer->directory;
  3964.        CHECK_STRING (defalt, 1);
  3965. -/* 91.11.22, 93.2.17 by M.Higashida */
  3966. -#if defined(MSDOS) || defined(WIN32)
  3967. +/* 91.11.22, 93.2.17 by M.Higashida, 93.8.20 by O.Sasaki */
  3968. +#if defined(MSDOS) || defined(WIN32) || defined(OS2)
  3969.        if (drive < 0)
  3970.      {
  3971.        if (XSTRING (defalt)->data[1] == ':')
  3972. @@ -828,17 +856,18 @@
  3973.          setdisk (cur_drive);
  3974.            }
  3975.  #else
  3976. -#ifdef EMX
  3977. +#if defined(EMX) || defined (OS2) /* 93.8.20 by O.Sasaki */
  3978.          {
  3979.                char *tmp = (char *) alloca (MAXPATHLEN + 1);
  3980.                char target_drive[] = "X:";
  3981.  
  3982.                *target_drive = drive + 'a';
  3983. -              newdir = _fullpath (tmp, target_drive, MAXPATHLEN);
  3984. +              newdir = (unsigned char *)_fullpath (tmp,
  3985. +                           target_drive, MAXPATHLEN);
  3986.              }
  3987.  #else
  3988.  you lose!
  3989. -#endif /* not EMX */
  3990. +#endif /* not EMX nor OS2 */
  3991.  #endif /* not GO32 nor WIN32 */
  3992.  /* end of patch */
  3993.      }
  3994. @@ -848,8 +877,8 @@
  3995.  /* end of patch */
  3996.      }
  3997.  
  3998. -/* 91.10.22, 93.2.17 by M.Higashida */
  3999. -#if defined(MSDOS) || defined(WIN32)
  4000. +/* 91.10.22, 93.2.17 by M.Higashida, 93.8.20 by O.Sasaki */
  4001. +#if defined(MSDOS) || defined(WIN32) || defined(OS2)
  4002.    /* ..., and again strip drive name. */
  4003.    if (newdir && newdir[1] == ':')
  4004.      {
  4005. @@ -878,14 +907,14 @@
  4006.    /* Now concatenate the directory and name to new space in the stack frame */
  4007.  
  4008.    tlen += strlen (nm) + 1;
  4009. -/* 91.10.20, 93.2.17 by M.Higashida */
  4010. -#if defined(MSDOS) || defined(WIN32)
  4011. +/* 91.10.20, 93.2.17 by M.Higashida, 93.8.20 by O.Sasaki */
  4012. +#if defined(MSDOS) || defined(WIN32) || defined(OS2)
  4013.    /* These codes are scouted from Human68k version. Thanks. */
  4014.    target = (unsigned char *) alloca (tlen + 2);  /* add reserved space for drive name. */
  4015.    target += 2;
  4016. -#else /* not MSDOS nor WIN32 */
  4017. +#else /* not MSDOS nor WIN32 nor OS2 */
  4018.    target = (unsigned char *) alloca (tlen);
  4019. -#endif /* not MSDOS nor WIN32 */
  4020. +#endif /* not MSDOS nor WIN32 nor OS2 */
  4021.  /* end of patch */
  4022.    *target = 0;
  4023.  
  4024. @@ -994,8 +1023,8 @@
  4025.  #endif /* not VMS */
  4026.      }
  4027.  
  4028. -/* 91.10.20, 93.2.17 by M.Higashida */
  4029. -#if defined(MSDOS) || defined(WIN32)
  4030. +/* 91.10.20, 93.2.17 by M.Higashida, 93.8.20 by O,Sasaki */
  4031. +#if defined(MSDOS) || defined(WIN32) || defined(OS2)
  4032.    /* at last, set drive name. */
  4033.    if (target[1] != ':')
  4034.      {
  4035. @@ -1057,8 +1086,9 @@
  4036.        nm = p;
  4037.        substituted = 1;
  4038.      }
  4039. -/* 91.10.16 by S.Hirano, 93.2.17, 93.5.30 by M.Higashida */
  4040. -#if defined(MSDOS) || defined(WIN32)
  4041. +/* 91.10.16 by S.Hirano, 93.2.17, 93.5.30 by M.Higashida,
  4042. +   93.8.20 by O.Sasaki */
  4043. +#if defined(MSDOS) || defined(WIN32) || defined(OS2)
  4044.        if (p != nm && p[-1] == '/' && p[0] && p[1] == ':') {
  4045.      nm = p;
  4046.      substituted = 1;
  4047. @@ -1195,8 +1225,9 @@
  4048.       )
  4049.      && p != nm && p[-1] == '/')
  4050.        xnm = p;
  4051. -/* 91.10.16 by S.Hirano, 93.2.17, 93.5.30 by M.Higashida */
  4052. -#if defined(MSDOS) || defined(WIN32)
  4053. +/* 91.10.16 by S.Hirano, 93.2.17, 93.5.30 by M.Higashida
  4054. +   93.8.20 by O.Sasaki */
  4055. +#if defined(MSDOS) || defined(WIN32) || defined(OS2)
  4056.      else if (p != xnm && p[-1] == '/' && p[0] && p[1] == ':')
  4057.        xnm = p;
  4058.  #endif
  4059. @@ -1234,19 +1265,19 @@
  4060.    if (XSTRING (abspath)->size > 1
  4061.        && XSTRING (abspath)->data[XSTRING (abspath)->size - 1] == '/')
  4062.      {
  4063. -/* 91.10.20, 93.2.17 by M.Higashida */
  4064. -#if defined(MSDOS) || defined(WIN32)
  4065. +/* 91.10.20, 93.2.17 by M.Higashida, 93.8.20 by O.Sasaki */
  4066. +#if defined(MSDOS) || defined(WIN32) || defined(OS2)
  4067.        if (strcmp (XSTRING (abspath)->data + 1, ":/") != 0)
  4068.      {
  4069.        if (EQ (abspath, filename))
  4070.          abspath = Fcopy_sequence (abspath);
  4071.        XSTRING (abspath)->data[XSTRING (abspath)->size - 1] = 0;
  4072.      }
  4073. -#else /* not MSDOS nor WIN32 */
  4074. +#else /* not MSDOS nor WIN32 nor OS2 */
  4075.        if (EQ (abspath, filename))
  4076.      abspath = Fcopy_sequence (abspath);
  4077.        XSTRING (abspath)->data[XSTRING (abspath)->size - 1] = 0;
  4078. -#endif /* not MSDOS nor WIN32 */
  4079. +#endif /* not MSDOS nor WIN32 nor OS2 */
  4080.  /* end of patch */
  4081.      }
  4082.  #endif
  4083. @@ -1365,8 +1396,8 @@
  4084.  #ifdef APOLLO
  4085.        if (!egetenv ("USE_DOMAIN_ACLS"))
  4086.  #endif
  4087. -/* 92.10.5, 93.2.17 by M.Higashida */
  4088. -#if !(defined(MSDOS) || defined(WIN32))
  4089. +/* 92.10.5, 93.2.17 by M.Higashida, 93.8.20 by O.Sasaki */
  4090. +#if !(defined(MSDOS) || defined(WIN32) || defined(OS2))
  4091.        chmod (XSTRING (newname)->data, st.st_mode & 07777);
  4092.  #endif
  4093.  /* end of patch */
  4094. @@ -1470,8 +1501,8 @@
  4095.      barf_or_query_if_file_exists (newname, "make it a new name",
  4096.                    XTYPE (ok_if_already_exists) == Lisp_Int);
  4097.    unlink (XSTRING (newname)->data);
  4098. -/* 92.11.4, 93.2.25 by M.Higashida */
  4099. -#if defined(MSDOS) && defined(EMX) /* not correct! */
  4100. +/* 92.11.4, 93.2.25 by M.Higashida,93.8.20 by O.Sasaki */
  4101. +#if (defined(MSDOS) && defined(EMX)) || defined(OS2) /* not correct! */
  4102.    if (0 > rename (XSTRING (filename)->data, XSTRING (newname)->data))
  4103.  #else
  4104.  #ifdef WIN32
  4105. @@ -1619,10 +1650,10 @@
  4106.        || (*ptr == '[' && (ptr[1] != '-' || (ptr[2] != '.' && ptr[2] != ']'))
  4107.        && ptr[1] != '.')
  4108.  #endif /* VMS */
  4109. -/* 91.10.16 by S.Hirano, 93.2.17 by M.Higashida */
  4110. -#if defined(MSDOS) || defined(WIN32)
  4111. +/* 91.10.16 by S.Hirano, 93.2.17 by M.Higashida 93.8.20 by O.Sasaki */
  4112. +#if defined(MSDOS) || defined(WIN32) || defined(OS2)
  4113.        || (ptr[1] == ':' && ptr[2] == '/')
  4114. -#endif /* MSDOS or WIN32 */
  4115. +#endif /* MSDOS or WIN32 or OS2 */
  4116.  /* end of patch */
  4117.        )
  4118.      return Qt;
  4119. @@ -1658,6 +1689,21 @@
  4120.  
  4121.    CHECK_STRING (filename, 0);
  4122.    abspath = Fexpand_file_name (filename, Qnil);
  4123. +/* 93.8.23 by O.Sasaki */
  4124. +#ifdef OS2
  4125. +    {
  4126. +        int             len = XSTRING (abspath)->size - 1 ;
  4127. +        unsigned char   *name, *pnt ;
  4128. +
  4129. +        pnt = XSTRING (abspath)->data ;
  4130. +        if ( pnt[len] == '/' || pnt[len] =='\\' ) {
  4131. +            name = ( unsigned char *)alloca( len + 2 ) ;
  4132. +            strcpy( name, pnt ) ;
  4133. +            name[len] = 0 ;
  4134. +            return (access (name, 4) >= 0) ? Qt : Qnil;
  4135. +        }
  4136. +    }
  4137. +#endif
  4138.    return (access (XSTRING (abspath)->data, 4) >= 0) ? Qt : Qnil;
  4139.  }
  4140.  
  4141. @@ -1719,11 +1765,11 @@
  4142.    if (!NULL (dir))
  4143.      dir = Fdirectory_file_name (dir);
  4144.  #endif /* VMS */
  4145. -/* 91.10.16 by S.Hirano, 93.2.17 by M.Higashida */
  4146. -#if defined(MSDOS) || defined(WIN32)
  4147. +/* 91.10.16 by S.Hirano, 93.2.17 by M.Higashida,93.8.20 by O.Sasaki */
  4148. +#if defined(MSDOS) || defined(WIN32) || defined(OS2)
  4149.    if (!NULL (dir))
  4150.      dir = Fdirectory_file_name (dir);
  4151. -#endif /* MSDOS or WIN32 */
  4152. +#endif /* MSDOS or WIN32 or OS2 */
  4153.  /* end of patch */
  4154.    return (access (!NULL (dir) ? (char *) XSTRING (dir)->data : "", 2) >= 0
  4155.        ? Qt : Qnil);
  4156. @@ -1773,11 +1819,11 @@
  4157.    CHECK_NUMBER (mode, 1);
  4158.  
  4159.  #ifndef APOLLO
  4160. -/* 92.10.5, 93.2.17 by M.Higashida */
  4161. -#if !defined(MSDOS) && !defined(WIN32)
  4162. +/* 92.10.5, 93.2.17 by M.Higashida, 93.8.20 by O.Sasaki */
  4163. +#if !defined(MSDOS) && !defined(WIN32) && !defined(OS2)
  4164.    if (chmod (XSTRING (abspath)->data, XINT (mode)) < 0)
  4165.      report_file_error ("Doing chmod", Fcons (abspath, Qnil));
  4166. -#endif /* not MSDOS nor WIN32 */
  4167. +#endif /* not MSDOS nor WIN32 nor OS2 */
  4168.  /* end of patch */
  4169.  #else /* APOLLO */
  4170.    if (!egetenv ("USE_DOMAIN_ACLS"))
  4171. @@ -2193,12 +2239,13 @@
  4172.        desc = creat (fn, 0666);
  4173.        }
  4174.  #else /* not VMS */
  4175. -/* 91.10.16 by S.Hirano, 92.11.1, 93.2.17 by M.Higashida */
  4176. -#if defined(MSDOS) || defined(WIN32)
  4177. +/* 91.10.16 by S.Hirano, 92.11.1, 93.2.17 by M.Higashida
  4178. +   93.8.20 by O.Sasaki */
  4179. +#if defined(MSDOS) || defined(WIN32) || defined(OS2)
  4180.    desc = creat (fn, S_IREAD|S_IWRITE);
  4181. -#else /* not MSDOS nor WIN32 */
  4182. +#else /* not MSDOS nor WIN32 nor OS2 */
  4183.    desc = creat (fn, 0666);
  4184. -#endif /* not MSDOS nor MSDOS */
  4185. +#endif /* not MSDOS nor WIN32 nor OS2 */
  4186.  /* end of patch */
  4187.  #endif /* not VMS */
  4188.  
  4189. @@ -2270,7 +2317,8 @@
  4190.      }
  4191.      }
  4192.  
  4193. -/* 91.10.20, 93.2.17 by M.Higashida */
  4194. +/* 91.10.20, 93.2.17 by M.Higashida, 93.8.20 by O.Sasaki */
  4195. +#ifndef OS2
  4196.  #ifndef WIN32
  4197.  #ifndef MSDOS
  4198.  #ifndef USG
  4199. @@ -2285,6 +2333,7 @@
  4200.  #endif
  4201.  #endif
  4202.  #endif
  4203. +#endif
  4204.  /* end of patch */
  4205.  
  4206.  #if 0
  4207. @@ -2705,8 +2754,8 @@
  4208.  
  4209.    /* If dir starts with user's homedir, change that to ~. */
  4210.    homedir = (char *) egetenv ("HOME");
  4211. -/* 91.10.16 by S.Hirano, 93.2.17 by M.Higashida */
  4212. -#if defined(MSDOS) || defined(WIN32)
  4213. +/* 91.10.16 by S.Hirano, 93.2.17 by M.Higashida, 93.8.20 by O.Sasaki */
  4214. +#if defined(MSDOS) || defined(WIN32) || defined(OS2)
  4215.    if (homedir != 0)
  4216.      dostounix_filename (homedir);
  4217.  #endif
  4218. diff -urP /mule-1.1/src/keyboard.c ./src/keyboard.c
  4219. --- /mule-1.1/src/keyboard.c    Mon Mar 14 14:46:08 1994
  4220. +++ ./src/keyboard.c    Thu Mar 17 11:19:24 1994
  4221. @@ -898,6 +898,9 @@
  4222.  #ifdef BSD4_1
  4223.    sigunhold (SIGALRM);
  4224.  #endif
  4225. +#ifdef OS2 /* 93.8.20 by O.Sasaki */
  4226. +  signal(SIGALRM, SIG_ACK);
  4227. +#endif
  4228.  
  4229.    errno = old_errno;
  4230.  }
  4231. @@ -2216,8 +2219,8 @@
  4232.    signal (SIGINT, interrupt_signal);
  4233.    signal (SIGQUIT, interrupt_signal);
  4234.  #endif /* USG */
  4235. -/* 92.11.4 by M.Higashida */
  4236. -#if defined(MSDOS) && defined(EMX)
  4237. +/* 92.11.4 by M.Higashida, 93.8.20 by O.Sasaki */
  4238. +#if (defined(MSDOS) && defined(EMX)) || defined(OS2)
  4239.    signal (SIGINT, SIG_ACK);
  4240.  #endif
  4241.  /* end of patch */
  4242. @@ -2249,8 +2252,13 @@
  4243.        /* Perhaps should really fork an inferior shell?
  4244.       But that would not provide any way to get back
  4245.       to the original shell, ever.  */
  4246. +#ifdef OS2 /* 93.8.25 by O.Sasaki */
  4247. +      printf ("No support for stopping a process on this operating system;\r\n");
  4248. +      printf ("you can continue or abort.\r\n");
  4249. +#else /* not OS2 */
  4250.        printf ("No support for stopping a process on this operating system;\n");
  4251.        printf ("you can continue or abort.\n");
  4252. +#endif /* not OS2 */
  4253.  #endif /* not VMS */
  4254.  #endif /* not SIGTSTP */
  4255.        printf ("Auto-save? (y or n) ");
  4256. @@ -2267,7 +2275,11 @@
  4257.        if (((c = getchar ()) & ~040) == 'Y')
  4258.      abort ();
  4259.        while (c != '\n') c = getchar ();
  4260. +#ifdef OS2 /* 93.8.25 by O.Sasaki */
  4261. +      printf ("Continuing...\r\n");
  4262. +#else
  4263.        printf ("Continuing...\n");
  4264. +#endif
  4265.        fflush (stdout);
  4266.        init_sys_modes ();
  4267.      }
  4268. diff -urP /mule-1.1/src/keymap.c ./src/keymap.c
  4269. --- /mule-1.1/src/keymap.c    Thu Jul 08 17:23:56 1993
  4270. +++ ./src/keymap.c    Tue Mar 15 04:35:24 1994
  4271. @@ -44,6 +44,11 @@
  4272.  #ifdef HAVE_X_WINDOWS
  4273.  Lisp_Object MouseMap;        /* Keymap for mouse commands */
  4274.  #endif /* HAVE_X_WINDOWS */
  4275. +/* 93.12.20 by O.Sasaki */
  4276. +#ifdef OS2PM
  4277. +Lisp_Object MouseMap;        /* Keymap for mouse commands */
  4278. +#endif /* OS2PM */
  4279. +/* end of patch */
  4280.  
  4281.  Lisp_Object global_map;
  4282.  
  4283. @@ -306,7 +311,9 @@
  4284.    register int c;
  4285.    register Lisp_Object tem;
  4286.    register Lisp_Object cmd;
  4287. +#ifndef OS2 /* 93.8.27 by O.Sasaki */
  4288.    int metized = 0;
  4289. +#endif
  4290.  
  4291.    keymap = get_keymap (keymap);
  4292.  
  4293. @@ -318,6 +325,9 @@
  4294.    while (1)
  4295.      {
  4296.        c = XSTRING (key)->data[idx];
  4297. +#ifdef OS2    /* 93.8.27 by O.Sasaki */
  4298. +      idx++;
  4299. +#else /* not OS2 */
  4300.        /* 91.10.29, 92.3.23 by K.Handa */
  4301.        if (c >= 0200 && !metized && NULL (nonmeta))
  4302.      {
  4303. @@ -330,6 +340,7 @@
  4304.        metized = 0;
  4305.        idx++;
  4306.      }
  4307. +#endif /* not OS2 */
  4308.  
  4309.        if (idx == XSTRING (key)->size)
  4310.      return store_in_keymap (keymap, c, def);
  4311. @@ -367,7 +378,9 @@
  4312.    register Lisp_Object tem;
  4313.    register Lisp_Object cmd;
  4314.    register int c;
  4315. +#ifndef OS2 /* 93.8.27 by O.Sasaki */
  4316.    int metized = 0;
  4317. +#endif
  4318.  
  4319.    keymap = get_keymap (keymap);
  4320.  
  4321. @@ -700,12 +713,14 @@
  4322.       register unsigned int c;
  4323.       register char *p;
  4324.  {
  4325. +#ifndef OS2    /* 93.8.27 by O.Sasaki */
  4326.    if (c >= 0200)
  4327.      {
  4328.        *p++ = 'M';
  4329.        *p++ = '-';
  4330.        c -= 0200;
  4331.      }
  4332. +#endif
  4333.    if (c < 040)
  4334.      {
  4335.        if (c == 033)
  4336. @@ -784,12 +799,14 @@
  4337.    if (MC_CHAR_P(c)) {        /* 88.5.28, 91.10.29 by K.Handa */
  4338.      p += CHARtoSTR (c, p);
  4339.    } else {            /* 91.11.17 by K.Handa */
  4340. +#ifndef OS2    /* 93.8.27 by O.Sasaki */
  4341.    if (c >= 0200)
  4342.      {
  4343.        *p++ = 'M';
  4344.        *p++ = '-';
  4345.        c -= 0200;
  4346.      }
  4347. +#endif
  4348.    if (c < 040)
  4349.      {
  4350.        *p++ = '^';
  4351. @@ -857,7 +874,11 @@
  4352.        /* If the MAP is a vector, I increments and eventually reaches 0200.
  4353.       Otherwise I remains 0; MAP is cdr'd and eventually becomes nil.  */
  4354.  
  4355. +#ifdef OS2    /* 93.8.27 by O.Sasaki */
  4356. +      while (!NULL (map) && i < 0400)
  4357. +#else
  4358.        while (!NULL (map) && i < 0200)
  4359. +#endif
  4360.      {
  4361.        register Lisp_Object elt, dummy;
  4362.  
  4363. @@ -1080,7 +1101,12 @@
  4364.    register Lisp_Object keysdesc;
  4365.  
  4366.    if (!NULL (string) && XSTRING (string)->size > 0)
  4367. +/* 93.8.20 by O.Sasaki */
  4368. +#ifdef OS2
  4369. +    keysdesc = string;
  4370. +#else
  4371.      keysdesc = concat2 (Fkey_description (string), build_string (" "));
  4372. +#endif
  4373.    else
  4374.      keysdesc = Qnil;
  4375.  
  4376. @@ -1138,10 +1164,16 @@
  4377.      }
  4378.  
  4379.        GCPRO2 (elt_prefix, tem2);
  4380. +#ifdef OS2 /* 93.8.20 by O.Sasaki */
  4381. +      insert1 (call1 (Qkey_description,
  4382. +              concat2 (elt_prefix, Fchar_to_string (tem1))));
  4383. +#else /* not OS2 */
  4384.        if (!NULL (elt_prefix))
  4385.      insert1 (elt_prefix);
  4386.  
  4387.        insert1 (Fsingle_key_description (tem1));
  4388. +#endif /* not OS2 */
  4389. +/* end of patch */
  4390.  
  4391.        (*elt_describer) (tem2);
  4392.        UNGCPRO;
  4393. @@ -1198,11 +1230,19 @@
  4394.        first = 0;
  4395.      }
  4396.  
  4397. +/* 93.8.20 by O.Sasaki */
  4398. +#ifdef OS2
  4399. +      XFASTINT (dummy) = i;
  4400. +      insert1 (call1 (Qkey_description,
  4401. +              concat2 (elt_prefix, Fchar_to_string (dummy))));
  4402. +#else /* not OS2 */
  4403.        if (!NULL (elt_prefix))
  4404.      insert1 (elt_prefix);
  4405.  
  4406.        XFASTINT (dummy) = i;
  4407.        insert1 (Fsingle_key_description (dummy));
  4408. +#endif /* not OS2 */
  4409. +/* end of patch */
  4410.  
  4411.        while (i + 1 < size
  4412.           && (tem2 = get_keyelt (XVECTOR (vector)->contents[i+1]),
  4413. @@ -1212,11 +1252,19 @@
  4414.        if (i != XINT (dummy))
  4415.      {
  4416.        insert (" .. ", 4);
  4417. +/* 93.8.20 by O.Sasaki */
  4418. +#ifdef OS2
  4419. +      XFASTINT (dummy) = i;
  4420. +      insert1 (call1 (Qkey_description,
  4421. +              concat2 (elt_prefix, Fchar_to_string (dummy))));
  4422. +#else /* not OS2 */
  4423.        if (!NULL (elt_prefix))
  4424.          insert1 (elt_prefix);
  4425.  
  4426.        XFASTINT (dummy) = i;
  4427.        insert1 (Fsingle_key_description (dummy));
  4428. +#endif /* not OS2 */
  4429. +/* end of patch */
  4430.      }
  4431.  
  4432.        (*elt_describer) (tem1);
  4433. @@ -1350,6 +1398,13 @@
  4434.    MouseMap = tem;
  4435.    Fset (intern ("mouse-map"), tem);
  4436.  #endif /* HAVE_X_WINDOWS */
  4437. +/* 93.12.20 by O.Sasaki */
  4438. +#ifdef OS2PM
  4439. +  tem = Fmake_keymap ();
  4440. +  MouseMap = tem;
  4441. +  Fset (intern ("mouse-map"), tem);
  4442. +#endif /* OS2PM */
  4443. +/* end of patch */
  4444.  
  4445.    tem = Fmake_keymap ();
  4446.    Vglobal_map = tem;
  4447. diff -urP /mule-1.1/src/linkos2.rf ./src/linkos2.rf
  4448. --- /mule-1.1/src/linkos2.rf
  4449. +++ ./src/linkos2.rf    Tue Mar 22 11:26:30 1994
  4450. @@ -0,0 +1,51 @@
  4451. +abbrev.o
  4452. +alloc.o
  4453. +buffer.o
  4454. +bytecode.o
  4455. +callint.o
  4456. +callproc.o
  4457. +casefiddle.o
  4458. +category.o
  4459. +ccl.o
  4460. +cm.o
  4461. +cmds.o
  4462. +codeconv.o
  4463. +data.o
  4464. +dired.o
  4465. +dispnew.o
  4466. +doc.o
  4467. +doprnt.o
  4468. +editfns.o
  4469. +emacs.o
  4470. +eval.o
  4471. +fileio.o
  4472. +filelock.o
  4473. +filemode.o
  4474. +fns.o
  4475. +indent.o
  4476. +insdel.o
  4477. +keyboard.o
  4478. +keymap.o
  4479. +lastfile.o
  4480. +lread.o
  4481. +macros.o
  4482. +marker.o
  4483. +minibuf.o
  4484. +mocklisp.o
  4485. +mule.o
  4486. +os2.o
  4487. +pmterm.o
  4488. +print.o
  4489. +process.o
  4490. +regex.o
  4491. +scroll.o
  4492. +search.o
  4493. +syntax.o
  4494. +sysdep.o
  4495. +term.o
  4496. +termcap.o
  4497. +tparam.o
  4498. +undo.o
  4499. +unexec.o
  4500. +window.o
  4501. +xdisp.o
  4502. diff -urP /mule-1.1/src/lisp.h ./src/lisp.h
  4503. --- /mule-1.1/src/lisp.h    Mon Mar 14 14:46:08 1994
  4504. +++ ./src/lisp.h    Tue Mar 15 04:37:16 1994
  4505. @@ -996,6 +996,9 @@
  4506.  extern Lisp_Object Fwhere_is_internal ();
  4507.  extern Lisp_Object access_keymap (), store_in_keymap ();
  4508.  extern Lisp_Object get_keyelt (), get_keymap();
  4509. +#ifdef OS2 /* 93.8.20 by O.Sasaki */
  4510. +extern Lisp_Object Qkey_description;
  4511. +#endif
  4512.  
  4513.  /* defined in indent.c */
  4514.  extern Lisp_Object Fvertical_motion (), Findent_to (), Fcurrent_column ();
  4515. diff -urP /mule-1.1/src/lread.c ./src/lread.c
  4516. --- /mule-1.1/src/lread.c    Mon Mar 14 14:46:10 1994
  4517. +++ ./src/lread.c    Tue Mar 15 04:40:16 1994
  4518. @@ -293,8 +293,8 @@
  4519.  #ifdef VMS
  4520.        || index (s, ':')
  4521.  #endif /* VMS */
  4522. -/* 91.10.16 by S.Hirano, 93.2.17 by M.Higashida */
  4523. -#if defined(MSDOS) || defined(WIN32)
  4524. +/* 91.10.16 by S.Hirano, 93.2.17 by M.Higashida, 93.8.20 by O.Sasaki */
  4525. +#if defined(MSDOS) || defined(WIN32) || defined(OS2)
  4526.        || (s[1] == ':' && s[2] == '/')
  4527.  #endif
  4528.  /* end of patch */
  4529. @@ -1334,8 +1334,8 @@
  4530.      normal_path = Vload_path;
  4531.    else
  4532.  #endif
  4533. -/* 91.11.12, 93.2.17 M.Higashida */
  4534. -#if defined(MSDOS) || defined(WIN32)
  4535. +/* 91.11.12, 93.2.17 M.Higashida, 93.8.20 by O.Sasaki */
  4536. +#if defined(MSDOS) || defined(WIN32) || defined(OS2)
  4537.      normal_path = decode_env_path ("EMACSLOADPATH", normal);
  4538.  #else
  4539.      normal_path = decode_env_path (0, normal);
  4540. diff -urP /mule-1.1/src/m-os2.h ./src/m-os2.h
  4541. --- /mule-1.1/src/m-os2.h
  4542. +++ ./src/m-os2.h    Sat Apr 04 12:50:08 1992
  4543. @@ -0,0 +1,173 @@
  4544. +/* m- file for intel 386.
  4545. +   Copyright (C) 1987 Free Software Foundation, Inc.
  4546. +
  4547. +This file is part of GNU Emacs.
  4548. +
  4549. +GNU Emacs is free software; you can redistribute it and/or modify
  4550. +it under the terms of the GNU General Public License as published by
  4551. +the Free Software Foundation; either version 1, or (at your option)
  4552. +any later version.
  4553. +
  4554. +GNU Emacs is distributed in the hope that it will be useful,
  4555. +but WITHOUT ANY WARRANTY; without even the implied warranty of
  4556. +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  4557. +GNU General Public License for more details.
  4558. +
  4559. +You should have received a copy of the GNU General Public License
  4560. +along with GNU Emacs; see the file COPYING.  If not, write to
  4561. +the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  4562. +
  4563. +
  4564. +/* The following three symbols give information on
  4565. + the size of various data types.  */
  4566. +
  4567. +#define SHORTBITS 16        /* Number of bits in a short */
  4568. +
  4569. +#define INTBITS 32        /* Number of bits in an int */
  4570. +
  4571. +#define LONGBITS 32        /* Number of bits in a long */
  4572. +
  4573. +/* i386 is not big-endian: lowest numbered byte is least significant. */
  4574. +
  4575. +/* #undef BIG_ENDIAN */
  4576. +
  4577. +/* Define NO_ARG_ARRAY if you cannot take the address of the first of a
  4578. + * group of arguments and treat it as an array of the arguments.  */
  4579. +
  4580. +/* #define NO_ARG_ARRAY */
  4581. +
  4582. +/* Define WORD_MACHINE if addresses and such have
  4583. + * to be corrected before they can be used as byte counts.  */
  4584. +
  4585. +/* #define WORD_MACHINE */
  4586. +
  4587. +/* Define how to take a char and sign-extend into an int.
  4588. +   On machines where char is signed, this is a no-op.  */
  4589. +
  4590. +#define SIGN_EXTEND_CHAR(c) (c)
  4591. +
  4592. +/* Now define a symbol for the cpu type, if your compiler
  4593. +   does not define it automatically:
  4594. +   Ones defined so far include vax, m68000, ns16000, pyramid,
  4595. +   orion, tahoe, APOLLO and many others */
  4596. +
  4597. +#define INTEL386
  4598. +
  4599. +/* Use type int rather than a union, to represent Lisp_Object */
  4600. +
  4601. +#define NO_UNION_TYPE
  4602. +
  4603. +/* crt0.c, if it is used, should use the i386-bsd style of entry.
  4604. +   with no extra dummy args.  On USG and XENIX,
  4605. +   NO_REMAP says this isn't used. */
  4606. +
  4607. +#define CRT0_DUMMIES bogus_fp,
  4608. +
  4609. +/* crt0.c should define a symbol `start' and do .globl with a dot.  */
  4610. +
  4611. +#define DOT_GLOBAL_START
  4612. +
  4613. +#ifdef XENIX
  4614. +/* Data type of load average, as read out of kmem.  */
  4615. +#define LOAD_AVE_TYPE short
  4616. +
  4617. +/* Convert that into an integer that is 100 for a load average of 1.0  */
  4618. +#define LOAD_AVE_CVT(x) (((double) (x)) * 100.0 / FSCALE)
  4619. +  
  4620. +#define FSCALE 256.0         /* determined by experimentation...  */
  4621. +#endif
  4622. +
  4623. +#ifdef USG5_4 /* Older USG systems do not support the load average.  */
  4624. +/* Data type of load average, as read out of kmem.  */
  4625. +
  4626. +#define LOAD_AVE_TYPE long
  4627. +
  4628. +/* Convert that into an integer that is 100 for a load average of 1.0  */
  4629. +/* This is totally uncalibrated. */
  4630. +
  4631. +#define LOAD_AVE_CVT(x) ((int) (((double) (x)) * 100.0 / FSCALE))
  4632. +#define FSCALE 256.0
  4633. +#endif
  4634. +
  4635. +/* Define CANNOT_DUMP on machines where unexec does not work.
  4636. +   Then the function dump-emacs will not be defined
  4637. +   and temacs will do (load "loadup") automatically unless told otherwise.  */
  4638. +
  4639. +/* #define CANNOT_DUMP */
  4640. +
  4641. +/* Define VIRT_ADDR_VARIES if the virtual addresses of
  4642. +   pure and impure space as loaded can vary, and even their
  4643. +   relative order cannot be relied on.
  4644. +
  4645. +   Otherwise Emacs assumes that text space precedes data space,
  4646. +   numerically.  */
  4647. +
  4648. +/* #define VIRT_ADDR_VARIES */
  4649. +
  4650. +#ifdef XENIX
  4651. +#define VALBITS 26
  4652. +#define GCTYPEBITS 5
  4653. +
  4654. +/* Define NO_REMAP if memory segmentation makes it not work well
  4655. +   to change the boundary between the text section and data section
  4656. +   when Emacs is dumped.  If you define this, the preloaded Lisp
  4657. +   code will not be sharable; but that's better than failing completely.  */
  4658. +
  4659. +#define NO_REMAP
  4660. +
  4661. +#define STACK_DIRECTION -1
  4662. +
  4663. +/* Since cannot purify, use standard Xenix 386 startup code. */
  4664. +
  4665. +#define START_FILES    /lib/386/Sseg.o pre-crt0.o /lib/386/Scrt0.o
  4666. +
  4667. +/* These really use terminfo.  */
  4668. +
  4669. +/* #define LIBS_TERMCAP /lib/386/Slibcurses.a  \
  4670. +   /lib/386/Slibtinfo.a /lib/386/Slibx.a
  4671. +*/
  4672. +/* Standard libraries for this machine.  Since `-l' doesn't work in `ld'.  */
  4673. +/* '__fltused' is unresolved w/o Slibcfp.a */
  4674. +#define LIB_STANDARD /lib/386/Slibcfp.a /lib/386/Slibc.a
  4675. +#else /* not XENIX */
  4676. +
  4677. +#ifdef USG
  4678. +#ifndef LIB_STANDARD
  4679. +#if defined (__GNUC__) || defined (C_ALLOCA)
  4680. +#define    LIB_STANDARD -lc
  4681. +#else
  4682. +#define LIB_STANDARD -lPW -lc
  4683. +#endif
  4684. +#endif /* no LIB_STANDARD */
  4685. +#ifndef C_ALLOCA
  4686. +#define HAVE_ALLOCA
  4687. +#endif
  4688. +#define NO_REMAP 
  4689. +#define TEXT_START 0
  4690. +#endif /* USG */
  4691. +#endif /* not XENIX */
  4692. +
  4693. +#ifdef BSD
  4694. +#define HAVE_ALLOCA
  4695. +#endif /* BSD */
  4696. +
  4697. +/* If compiling with GCC, let GCC implement alloca.  */
  4698. +#if defined(__GNUC__) && !defined(alloca)
  4699. +#define alloca(n) __builtin_alloca(n)
  4700. +#define HAVE_ALLOCA
  4701. +#endif
  4702. +
  4703. +#ifdef __STDC__
  4704. +#ifndef DONT_DEFINE_SIGNAL
  4705. +/* Cast the function argument to avoid warnings.  */
  4706. +#define signal(sig, func) (signal (sig, (void (*) (int)) (func)))
  4707. +#endif
  4708. +#endif
  4709. +
  4710. +#ifdef USG5_4
  4711. +#define DATA_SEG_BITS 0x08000000
  4712. +#endif
  4713. +
  4714. +#ifdef OS2
  4715. +#define START_FILES /emx/lib/crt0.o
  4716. +#endif
  4717. diff -urP /mule-1.1/src/Makefile.os2 ./src/Makefile.os2
  4718. --- /mule-1.1/src/Makefile.os2
  4719. +++ ./src/Makefile.os2    Wed Mar 23 07:17:06 1994
  4720. @@ -0,0 +1,166 @@
  4721. +dot = .
  4722. +lispdir = $(dot)$(dot)/lisp/
  4723. +etcdir = $(dot)$(dot)/etc/
  4724. +emxbindir = e:/emx/bin/
  4725. +.SUFFIXES: .c .o .s
  4726. +.c.o:
  4727. +    $(CC) $(CFLAGS) -c $<
  4728. +CD=cd
  4729. +MAKE=make
  4730. +CC = gcc
  4731. +STARTFILES = 
  4732. +LD = ld
  4733. +CFLAGS= -g -Demacs  $(MCPATH_FLAGS)
  4734. +GNULIB_VAR = 
  4735. +MULE_H = mule.h
  4736. +CC_H = codeconv.h
  4737. +MULE_OBJ_BASE = mule.o codeconv.o category.o ccl.o
  4738. +MULE_ELC_BASE = \
  4739. +    ${lispdir}mule.elc ${lispdir}mule-util.elc ${lispdir}attribute.elc \
  4740. +    ${lispdir}kinsoku.elc ${lispdir}quail.elc ${lispdir}regexp.elc \
  4741. +    ${lispdir}keyboard.elc ${lispdir}ccl.elc ${lispdir}worddef.elc
  4742. +MULE_LIB_BASE =
  4743. +#MCPATH_FLAGS =
  4744. +#MCPATH_H = mcpath.h
  4745. +#MCPATH_OBJ = mcpath.o
  4746. +MULE_ELC_EXT = ${lispdir}os2.elc ${lispdir}os2-keys.elc
  4747. +MULE_OBJ = $(MULE_OBJ_BASE) $(MULE_OBJ_EXT)
  4748. +MULE_ELC  = $(MULE_ELC_BASE) $(MULE_ELC_EXT)
  4749. +MULE_LIB = $(MULE_LIB_BASE) $(MULE_LIB_EXT)
  4750. +MULE_ELC_PATCHED = $(MULE_ELC) \
  4751. +    ${lispdir}bytecomp.elc ${lispdir}debug.elc ${lispdir}files.elc \
  4752. +    ${lispdir}fill.elc ${lispdir}info.elc ${lispdir}isearch.elc \
  4753. +    ${lispdir}picture.elc ${lispdir}startup.elc ${lispdir}replace.elc \
  4754. +    ${lispdir}rmail.elc ${lispdir}simple.elc ${lispdir}texinfmt.elc \
  4755. +    ${lispdir}dired.elc ${lispdir}macros.elc ${lispdir}man.elc \
  4756. +    ${lispdir}sendmail.elc ${lispdir}dabbrev.elc \
  4757. +    ${lispdir}prolog.elc ${lispdir}compile.elc
  4758. +obj=    dispnew.o scroll.o xdisp.o window.o \
  4759. +    term.o cm.o \
  4760. +    emacs.o keyboard.o macros.o keymap.o sysdep.o \
  4761. +    buffer.o filelock.o insdel.o marker.o \
  4762. +    minibuf.o fileio.o dired.o filemode.o \
  4763. +    cmds.o casefiddle.o indent.o search.o regex.o undo.o \
  4764. +    alloc.o data.o doc.o editfns.o callint.o \
  4765. +    eval.o fns.o print.o lread.o \
  4766. +    abbrev.o syntax.o unexec.o mocklisp.o bytecode.o \
  4767. +    process.o callproc.o $(environobj) \
  4768. +    doprnt.o \
  4769. +    os2.o pmterm.o \
  4770. +    $(MULE_OBJ) $(MCPATH_OBJ)
  4771. +termcapobj = termcap.o tparam.o
  4772. +otherobj= $(termcapobj) lastfile.o
  4773. +lisp=    ${lispdir}simple.elc ${lispdir}help.elc \
  4774. +    ${lispdir}files.elc ${lispdir}window.elc \
  4775. +    ${lispdir}indent.elc ${lispdir}loaddefs.el ${lispdir}paths.el \
  4776. +    ${lispdir}startup.elc ${lispdir}lisp.elc \
  4777. +    ${lispdir}page.elc ${lispdir}register.elc \
  4778. +    ${lispdir}paragraphs.elc ${lispdir}lisp-mode.elc \
  4779. +    ${lispdir}text-mode.elc ${lispdir}fill.elc \
  4780. +    ${lispdir}c-mode.elc ${lispdir}isearch.elc \
  4781. +    ${lispdir}replace.elc ${lispdir}abbrev.elc \
  4782. +    ${lispdir}buff-menu.elc ${lispdir}subr.elc \
  4783. +    ${lispdir}mule-conf.el ${lispdir}mule-init.el \
  4784. +    $(MULE_ELC)
  4785. +#all: xemacs.exe  ${etcdir}CHARSETS
  4786. +all: xemacs.exe pmmule.exe
  4787. +execprefix=
  4788. +.SUFFIXES: .elc .el
  4789. +.el.elc:
  4790. +    $(execprefix)temacs.exe -batch -l ${lispdir}mule-inst.el ${lispdir} ${lisp} ${MUEL_ELC_PATCHD}
  4791. +xemacs.exe: temacs.exe ${etcdir}DOC ${lisp}
  4792. +#    $(execprefix)temacs -batch -l inc-vers
  4793. +    emxbind -x temacs.exe temacs
  4794. +    $(execprefix)temacs.exe -batch -l loadup.el dump
  4795. +    emxbind -cxemacs ${emxbindir}emxl temacs xemacs
  4796. +    - del temacs
  4797. +    - del xemacs
  4798. +${etcdir}DOC: ${etcdir}make-docfile.exe ${obj} ${lisp}
  4799. +    rm -f ${etcdir}DOC
  4800. +    ${etcdir}make-docfile -o ${etcdir}DOC ${obj} 
  4801. +    ${etcdir}make-docfile -a ${etcdir}DOC ${lisp} ${lispdir}version.el
  4802. +${etcdir}make-docfile.exe:
  4803. +#    ${CD} ${etcdir};${MAKE} ${MFLAGS} make-docfile.exe
  4804. +    ${CD} ..\\etc & ${MAKE} CC=$(CC) ${MFLAGS} make-docfile.exe
  4805. +temacs.exe: $(SUPPORTDOS) ${obj} ${otherobj} os2.o pmterm.o
  4806. +#    ls -1 *.o >linkos2.rf
  4807. +    $(CC) -o temacs.exe @linkos2.rf
  4808. +CPP = $(CC) -E
  4809. +paths.h: paths.h-dist
  4810. +    echo paths.h needs to be set up from paths.h-dist
  4811. +    exit 1
  4812. +config.h: config.h-dist
  4813. +    echo config.h needs to be set up from config.h-dist
  4814. +    exit 1
  4815. +mconfig.h: mconfig.h-dist
  4816. +    echo mconfig.h needs to be set up from mconfig.h-dist
  4817. +    exit 1
  4818. +abbrev.o : abbrev.c buffer.h commands.h config.h 
  4819. +buffer.o : buffer.c syntax.h buffer.h commands.h window.h config.h $(MULE_H)
  4820. +callint.o : callint.c window.h commands.h buffer.h config.h 
  4821. +callproc.o : callproc.c paths.h buffer.h commands.h config.h $(MULE_H) \
  4822. +           $(CC_H) $(MCPATH_H)
  4823. +casefiddle.o : casefiddle.c syntax.h commands.h buffer.h config.h 
  4824. +category.o : category.h category.c $(MULE_H)
  4825. +ccl.o : ccl.c codeconv.h
  4826. +cm.o : cm.c cm.h termhooks.h config.h
  4827. +cmds.o : cmds.c syntax.h buffer.h commands.h config.h $(MULE_H)
  4828. +codeconv.o: codeconv.c $(MULE_H) $(CC_H)
  4829. +dired.o : dired.c commands.h buffer.h config.h regex.h $(MCPATH_H)
  4830. +dispnew.o : dispnew.c commands.h window.h buffer.h dispextern.h termchar.h \
  4831. +    termopts.h cm.h config.h lisp.h $(MULE_H)
  4832. +doc.o : doc.c buffer.h config.h paths.h
  4833. +doprnt.o : doprnt.c
  4834. +editfns.o : editfns.c window.h buffer.h config.h $(MULE_H)
  4835. +emacs.o : emacs.c commands.h config.h $(MULE_H) mconfig.h
  4836. +fileio.o : fileio.c window.h buffer.h config.h $(MULE_H) $(CC_H) $(MCPATH_H)
  4837. +filelock.o : filelock.c buffer.h paths.h config.h  $(MCPATH_H)
  4838. +filemode.o : filemode.c 
  4839. +indent.o : indent.c window.h indent.h buffer.h config.h termchar.h termopts.h $(MULE_H)
  4840. +insdel.o : insdel.c window.h buffer.h config.h 
  4841. +keyboard.o : keyboard.c termchar.h termhooks.h termopts.h buffer.h commands.h window.h macros.h config.h $(MULE_H)
  4842. +keymap.o : keymap.c buffer.h commands.h config.h $(MULE_H)
  4843. +lastfile.o : lastfile.c 
  4844. +macros.o : macros.c window.h buffer.h commands.h macros.h config.h
  4845. +malloc.o : malloc.c config.h
  4846. +marker.o : marker.c buffer.h config.h 
  4847. +minibuf.o : minibuf.c syntax.h window.h buffer.h commands.h config.h 
  4848. +mocklisp.o : mocklisp.c buffer.h config.h
  4849. +mule.o : mule.c mule.h config.h mconfig.h $(MULE_H) $(CC_H)
  4850. +process.o : process.c process.h buffer.h window.h termhooks.h termopts.h commands.h dispextern.h config.h $(MULE_H) $(CC_H) $(MCPATH_H)
  4851. +regex.o : regex.c syntax.h buffer.h config.h regex.h $(MULE_H)
  4852. +scroll.o : scroll.c termchar.h config.h dispextern.h termhooks.h
  4853. +search.o : search.c regex.h commands.h buffer.h syntax.h config.h $(MULE_H)
  4854. +syntax.o : syntax.c syntax.h buffer.h commands.h config.h $(MULE_H)
  4855. +sysdep.o : sysdep.c config.h dispextern.h termhooks.h termchar.h termopts.h window.h $(MCPATH_H)
  4856. +term.o : term.c termchar.h termhooks.h termopts.h config.h cm.h $(MULE_H) $(CC_H)
  4857. +termcap.o : termcap.c config.h
  4858. +terminfo.o : terminfo.c config.h
  4859. +tparam.o : tparam.c config.h
  4860. +undo.o : undo.c buffer.h commands.h config.h 
  4861. +unexec.o : config.h getpagesize.h mconfig.h puresize.h $(MCPATH_H)
  4862. +window.o : window.c indent.h commands.h window.h buffer.h config.h termchar.h
  4863. +xdisp.o : xdisp.c macros.h commands.h indent.h buffer.h dispextern.h termchar.h window.h config.h $(MULE_H)
  4864. +alloc.o : alloc.c window.h buffer.h config.h mconfig.h puresize.h
  4865. +bytecode.o : bytecode.c buffer.h config.h 
  4866. +data.o : data.c buffer.h config.h 
  4867. +eval.o : eval.c commands.h config.h
  4868. +fns.o : fns.c buffer.h commands.h config.h
  4869. +print.o : print.c process.h window.h buffer.h dispextern.h termchar.h config.h 
  4870. +lread.o : lread.c buffer.h paths.h config.h $(MULE_H) $(MCPATH_H)
  4871. +${etcdir}emacstool: ${etcdir}emacstool.c
  4872. +    cd ${etcdir}; ${MAKE} ${MFLAGS} emacstool
  4873. +${etcdir}bdf.o: config.h paths.h $(MULE_H) \
  4874. +        ${etcdir}bdf.h ${etcdir}bdf.c ${etcdir}Makefile
  4875. +    ${CD} ${etcdir}; ${MAKE} ${MFLAGS} bdf.o
  4876. +#${etcdir}charset: xemacs
  4877. +#    $(etcdir)env EMACSLOADPATH=${lispdir} $(execprefix)xemacs -batch -l $(lispdir)mule-inst.el `pwd`/${etcdir}charset
  4878. +#${etcdir}CHARSETS: ${etcdir}charset ${etcdir}Makefile
  4879. +#    ${CD} ${etcdir}; ${MAKE} ${MFLAGS} CHARSETS
  4880. +os2.o : os2.c config.h
  4881. +pmterm.o : pmterm.c config.h pmmule.h
  4882. +#pmmule.o: pmmule.c pmmule.h
  4883. +pmmule.res: pmmule.rc mule.ico
  4884. +    rc -r pmmule
  4885. +pmmule.exe: pmmule.c pmmule.h pmmule.def pmmule.res
  4886. +    $(CC) -O pmmule.c pmmule.def pmmule.res -o pmmule.exe
  4887. diff -urP /mule-1.1/src/mconfig.h-dist ./src/mconfig.h-dist
  4888. --- /mule-1.1/src/mconfig.h-dist    Mon Mar 14 14:44:36 1994
  4889. +++ ./src/mconfig.h-dist    Tue Mar 15 06:48:18 1994
  4890. @@ -101,6 +101,14 @@
  4891.  #undef CANNA
  4892.  #undef CANNA2
  4893.  #endif
  4894. +
  4895. +#ifdef OS2 /* 93.8.20 by O.Sasaki */
  4896. +#undef EGG
  4897. +#undef WNN4
  4898. +#undef SJ3
  4899. +#undef CANNA
  4900. +#undef CANNA2
  4901. +#endif
  4902.  /* end of patch */
  4903.  
  4904.  /* 93.5.12 by T.Enami */
  4905. diff -urP /mule-1.1/src/os2.c ./src/os2.c
  4906. --- /mule-1.1/src/os2.c
  4907. +++ ./src/os2.c    Mon Sep 27 18:29:34 1993
  4908. @@ -0,0 +1,156 @@
  4909. +/* OS/2 specific functions for GNU Emacs for OS/2
  4910. +   Copyright (C) 1992 Free Software Foundation, Inc.
  4911. +
  4912. +This file is part of GNU Emacs.
  4913. +
  4914. +GNU Emacs is free software; you can redistribute it and/or modify
  4915. +it under the terms of the GNU General Public License as published by
  4916. +the Free Software Foundation; either version 1, or (at your option)
  4917. +any later version.
  4918. +
  4919. +GNU Emacs is distributed in the hope that it will be useful,
  4920. +but WITHOUT ANY WARRANTY; without even the implied warranty of
  4921. +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  4922. +GNU General Public License for more details.
  4923. +
  4924. +You should have received a copy of the GNU General Public License
  4925. +along with GNU Emacs; see the file COPYING.  If not, write to
  4926. +the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  4927. +
  4928. +#define    INCL_DOS
  4929. +#include <os2.h>
  4930. +#include <stdlib.h>
  4931. +#include <signal.h>
  4932. +#include <fcntl.h>
  4933. +#include <process.h>
  4934. +#include "config.h"
  4935. +#undef NULL
  4936. +#include "lisp.h"
  4937. +#include "process.h"
  4938. +
  4939. +/* Look at ctrl-break-action for explanation. */
  4940. +int Vctrl_break_action;
  4941. +
  4942. +void ctrl_break_signal()
  4943. +{
  4944. +    signal(SIGBREAK, SIG_ACK);
  4945. +
  4946. +    switch (Vctrl_break_action) {
  4947. +    case 0: break;
  4948. +    case 1: Vquit_flag = Qt; raise(SIGINT); break;
  4949. +    case 2: exit(1); break;
  4950. +    case 3: abort(); break;
  4951. +    default: break;
  4952. +    }
  4953. +}
  4954. +
  4955. +int 
  4956. +getdisk () 
  4957. +{ 
  4958. +    return (int) (_getdrive () - 'A'); 
  4959. +}
  4960. +     
  4961. +DEFUN ("valid-file-name-p", Fvalid_file_name_p, Svalid_file_name_p,
  4962. +  1, 1, 0,
  4963. +  "Return t if STRING is a valid file name.\n\
  4964. +This function tries to open the file and looks at the error code.\n\
  4965. +This is a special feature of GNU Emacs for OS/2.")
  4966. +  (str)
  4967. +    Lisp_Object str;
  4968. +{
  4969. +    struct Lisp_String *p;
  4970. +    int i;
  4971. +
  4972. +    CHECK_STRING (str, 0);
  4973. +    p = XSTRING (str);
  4974. +    i = open (p->data, O_RDONLY);
  4975. +    if (i >= 0) {
  4976. +    close (i);
  4977. +    return (Qt);
  4978. +    }
  4979. +    i = _syserrno ();
  4980. +    return (i != 15 && i != 123 && i != 206 ? Qt : Qnil);
  4981. +}
  4982. +
  4983. +#if 0
  4984. +DEFUN ("check-file-system-hpfs", Fcheck_file_system_hpfs,
  4985. +       Scheck_file_system_hpfs, 1, 1, 0,
  4986. +  "Retrun DRIVE File system type hpfs")
  4987. +  (drv)
  4988. +    Lisp_Object drv;
  4989. +{
  4990. +    char    drvtype[16] ;
  4991. +
  4992. +    _filesys (XSTRING(drv)->data, drvtype, sizeof(drvtype));
  4993. +    if ( strcmp( drvtype, "HPFS" ) == 0 )
  4994. +    return Qt ;
  4995. +    return Qnil ;
  4996. +}
  4997. +#endif /* 0 */
  4998. +
  4999. +DEFUN ("os2-kill-process", Fos2_kill_process, Sos2_kill_process, 0, 2, 0,
  5000. +  "Interrupt process PROCESS.  May be process or name of one.\n\
  5001. +Nil or no arg means current buffer's process.\n\
  5002. +Second arg CURRENT-GROUP non-nil means send signal to\n\
  5003. +the current process-group of the process's controlling terminal\n\
  5004. +rather than to the process's own process group.\n\
  5005. +If the process is a shell, this means interrupt current subjob\n\
  5006. +rather than the shell.")
  5007. +  (process, current_group)
  5008. +     Lisp_Object process, current_group;
  5009. +{
  5010. +    extern Lisp_Object    Vprocess_alist;
  5011. +    Lisp_Object        proc;
  5012. +    struct Lisp_Process *p;
  5013. +    char        killproc[] ="killtree.exe" ;
  5014. +    char        *name ;
  5015. +    char        *pid ;
  5016. +
  5017. +    /* proc = get_process (process); é╠ôWèJ */
  5018. +    if (XTYPE (process) == Lisp_Process) {
  5019. +    proc = process;
  5020. +    } else {
  5021. +    CHECK_STRING (process, 0);
  5022. +    proc = Fcdr (Fassoc (process, Vprocess_alist));
  5023. +    }
  5024. +    p = XPROCESS (proc);
  5025. +
  5026. +    if (!EQ (p->childp, Qt))
  5027. +    error ("Process %s is not a subprocess", XSTRING (p->name)->data);
  5028. +    if (!XFASTINT (p->infd))
  5029. +    error ("Process %s is not active", XSTRING (p->name)->data);
  5030. +
  5031. +    if (NULL (p->pty_flag))
  5032. +    current_group = Qnil;
  5033. +
  5034. +    flush_pending_output (XFASTINT (p->infd));
  5035. +
  5036. +    name = (char *) alloca (16 + XSTRING (Vexec_directory)->size + 1);
  5037. +    pid  = (char *) alloca (16);
  5038. +    sprintf (name, "%s%s", XSTRING (Vexec_directory)->data, killproc );
  5039. +    sprintf (pid, "%d", XFASTINT (p->pid));
  5040. +    spawnl ( P_WAIT, name, killproc, pid, "-c", 0 ) ;
  5041. +    return process;
  5042. +}
  5043. +
  5044. +syms_of_os2()
  5045. +{
  5046. +  
  5047. +  DEFVAR_INT("ctrl-break-action", &Vctrl_break_action,
  5048. +     "Determines the behavior of Emacs after Ctrl-Break has been pressed.\n\
  5049. +Available only under OS/2.\n\
  5050. +0 : Do nothing, just return C-@.\n\
  5051. +1 : Like C-g C-g, termination with request.\n\
  5052. +2 : Terminate program immediatly without request.\n\
  5053. +3 : Force an abnormal program termination (dump core) without request.\n\
  5054. +The default value is 1.
  5055. +It is strongly recommended not to use a value of 2 or higher
  5056. +since you may loose data after hitting Ctrl-Break !");
  5057. +  Vctrl_break_action = 1;
  5058. +
  5059. +  defsubr (&Svalid_file_name_p);
  5060. +#if 0
  5061. +  defsubr (&Scheck_file_system_hpfs);
  5062. +#endif
  5063. +  defsubr (&Sos2_kill_process);
  5064. +}
  5065. diff -urP /mule-1.1/src/pmmule.c ./src/pmmule.c
  5066. --- /mule-1.1/src/pmmule.c
  5067. +++ ./src/pmmule.c    Fri Mar 25 18:49:10 1994
  5068. @@ -0,0 +1,2469 @@
  5069. +/* pmMule.c -- OS/2 Presentation Manager interface for GNU Emacs.
  5070. +   Copyright (C) 1993 Osamu Sasaki
  5071. +
  5072. +This file is part of GNU Emacs.
  5073. +
  5074. +GNU Emacs is free software; you can redistribute it and/or modify
  5075. +it under the terms of the GNU General Public License as published by
  5076. +the Free Software Foundation; either version 1, or (at your option)
  5077. +any later version.
  5078. +
  5079. +GNU Emacs is distributed in the hope that it will be useful,
  5080. +but WITHOUT ANY WARRANTY; without even the implied warranty of
  5081. +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  5082. +GNU General Public License for more details.
  5083. +
  5084. +You should have received a copy of the GNU General Public License
  5085. +along with GNU Emacs; see the file COPYING.  If not, write to
  5086. +the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  5087. +
  5088. +#define INCL_DOS
  5089. +#define INCL_WIN
  5090. +#define INCL_GPI
  5091. +#define INCL_DEV
  5092. +#define INCL_NLS
  5093. +#define INCL_DOSDEVIOCTL
  5094. +#define INCL_KBD
  5095. +#include <os2.h>
  5096. +#include <stdio.h>
  5097. +#include <stdlib.h>
  5098. +#include <stdarg.h>
  5099. +#include <string.h>
  5100. +#include <signal.h>
  5101. +#include "pmmule.h"
  5102. +#ifdef DEBUGSNAP
  5103. +#include "debuglib.h"
  5104. +#endif
  5105. +
  5106. +
  5107. +/* #define USE_OUTLINE_FONT */
  5108. +
  5109. +#define UWM_POPUPMENU   ( WM_USER+1) /* Create a popup menu */
  5110. +
  5111. +/* See termhooks.h */
  5112. +
  5113. +#define DOWN_MODIFIER        0x00
  5114. +#define UP_MODIFIER             0x04
  5115. +#define SHIFT_MODIFIER        0x20
  5116. +#define CTRL_MODIFIER        0x40
  5117. +#define ALT_MODIFIER        0x80
  5118. +
  5119. +#define IDM_POPUP               100
  5120. +#define IDM_FUNCMENU        1
  5121. +#define SELECT_FONT_ID        1
  5122. +
  5123. +typedef struct {
  5124. +    int  size ;
  5125. +    int  sel ;
  5126. +    char name[FACESIZE] ;
  5127. +} FONTSPEC ;
  5128. +
  5129. +typedef struct {
  5130. +    int  panes ;
  5131. +    int  lines ;
  5132. +    int  x ;
  5133. +    int  y ;
  5134. +    int  title_size ;
  5135. +    int  button ;
  5136. +    char *data ;
  5137. +} MENUDATA ;
  5138. +
  5139. +typedef struct {
  5140. +    HWND    Frame ;
  5141. +    HWND    Client ;
  5142. +    HPS        Ps ;
  5143. +    int        Start ;
  5144. +    int        Len ;
  5145. +} PECICTABLE ;
  5146. +
  5147. +
  5148. +HAB    hab ;            /* OS/2 PMé╠âAâôâJü[âuâìâbâNânâôâhâï    */
  5149. +HMQ    hmq ;            /* âüâbâZü[âWâLâàü[ânâôâhâï        */
  5150. +SWP    swpScreen ;        /* ò\ĪâXâNâèü[âôâTâCâY            */
  5151. +int    InPipe ;        /* Muleû{æ╠é⌐éτé╠òWÅÇÅoù═âpâCâv        */
  5152. +int    OutPipe ;        /* Muleû{æ╠é╓é╠òWÅÇôⁿù═âpâCâv        */
  5153. +int    OutdataPipe ;        /* Muleû{æ╠é╓é╠âfü[â^ô]æùâpâCâv        */
  5154. +HPOINTER hptrCursor ;        /* Mouse Pointer text            */
  5155. +
  5156. +HWND    PmHwndFrame ;        /* PM Mule âtâîü[âÇânâôâhâï        */
  5157. +HWND    PmHwndClient ;        /* PM Mule âNâëâCâAâôâgânâôâhâï        */
  5158. +HPS    PmHpsClient ;        /* PM Mule âvâîâ[ü[âeü[âVâçâô âXâyü[âX    */
  5159. +LONG    PmCxClient ;        /* ò\Īëµû╩ëíâhâbâgâTâCâY        */
  5160. +LONG    PmCyClient ;        /* ò\Īëµû╩ÅcâhâbâgâTâCâY        */
  5161. +LONG    PmCxChar ;        /* ò\Īò╢ÄÜëíâhâbâgâTâCâY        */
  5162. +LONG    PmCyChar ;        /* ò\Īò╢ÄÜÅcâhâbâgâTâCâY        */
  5163. +LONG    PmCyDesc ;        /* ò\Īò╢ÄÜì┼æσâfâBâZâôâ^âhâbâgâTâCâY    */
  5164. +int    PmCursorX ;        /* âJü[â\âïëíê╩Æu(âsâNâZâïì└òWîn)    */
  5165. +int    PmCursorY ;        /* âJü[â\âïÅcê╩Æu(âsâNâZâïì└òWîn)    */
  5166. +int    PmCursorOn ;        /* âJü[â\âïò\ĪÅ≤æ╘(!=0é╛é╞ò\Ī)    */
  5167. +int    PmCursorType ;        /* âJü[â\âïî`Å≤                */
  5168. +int    PmCursorBlink ;        /* âJü[â\âïâuâèâôâNâtâëâO        */
  5169. +int    PmWidth ;        /* ò\ĪâGâèâAëíâTâCâY(ò╢ÄÜì└òWîn)    */
  5170. +int    PmHeight ;        /* ò\ĪâGâèâAÅcâTâCâY(ò╢ÄÜì└òWîn)    */
  5171. +int    PmLeft ;        /* ò\ĪâGâèâAì╢èJÄnê╩Æu            */
  5172. +int    PmTop ;            /* ò\ĪâGâèâAÅπèJÄnê╩Æu            */
  5173. +HWND    PmHwndPopupMenu ;    /* â|âbâvâAâbâvâüâjâàü[ânâôâhâï        */
  5174. +int    PmPopupMenuMin ;    /* â|âbâvâAâbâvâüâjâàü[ì┼żìÇû┌ID    */
  5175. +int    PmPopupMenuMax ;    /* â|âbâvâAâbâvâüâjâàü[ì┼æσìÇû┌ID    */
  5176. +int    PmPopupSubMenuMin ;    /* âTâuâüâjâàü[èJÄnID            */
  5177. +int    PmPopupSubMenuMax ;    /* âTâuâüâjâàü[ÅIù╣ID            */
  5178. +ULONG    *PmPopupMenuItems ;    /* æIæ≡ìÇû┌ Lisp_Objects âeü[âuâï    */
  5179. +FONTSPEC PmFont ;        /* ÄgùpâtâHâôâgâfü[â^âeü[âuâï        */
  5180. +FONTSPEC PmOldFont ;        /* ïîÄgùpâtâHâôâgâfü[â^âeü[âuâï        */
  5181. +FATTRS    NowFontAttrs ;        /* î╗ì▌ÄgùpâtâHâôâgâ}âgâèâNâX        */
  5182. +
  5183. +#ifdef    USE_OUTLINE_FONT
  5184. +int    PmOutline ;        /* âAâEâgâëâCâôâtâHâôâgÄgùpé╠ùLû│    */
  5185. +#endif
  5186. +
  5187. +int    PmDisableShortcuts ;    /* âVâXâeâÇâLü[ùLî°âtâëâO (ùLî°=FALSE)    */
  5188. +char    PmButtons[3] ;        /* â}âEâXâ{â^âôâRâôâoü[âgâ}âbâv        */
  5189. +COLOR    PmCurrentColor ;    /* ò╢ÄÜò\ĪÉF                */
  5190. +COLOR    PmCurrentBackcolor ;    /* ò╢ÄÜöwîiÉF                */
  5191. +COLOR    PmHighlightColor ;    /* ânâCâëâCâgò╢ÄÜò\ĪÉF            */
  5192. +COLOR    PmHighlightBackcolor ;    /* ânâCâëâCâgò╢ÄÜöwîiÉF            */
  5193. +int    PmFunctionKeyMenu ;    /* âtâ@âôâNâVâçâôï@ö\âüâjâàü[ò\ĪâtâëâO    */
  5194. +int    PmFunctionRows ;    /* âtâ@âôâNâVâçâôï@ö\âüâjâàü[ò\ĪìsÉö    */
  5195. +PUCHAR    PmFuncMenuData[12] ;    /* âtâ@âôâNâVâçâôâüâjâàü[ò\Īâfü[â^    */
  5196. +RECTL    PmFuncMenuRect[12] ;    /* âtâ@âôâNâVâçâôâüâjâàü[ò\Īê╩Æu    */
  5197. +POINTL    PmFuncMenuCharOffset ;    /* âtâ@âôâNâVâçâôâüâbâZü[âWò\Īê╩Æu    */
  5198. +
  5199. +/* Window class names. */
  5200. +char    szClientClass[] = "pmmule.client" ;
  5201. +char    szPecicClientClass[] = "pmmule.pecic" ;
  5202. +
  5203. +ULONG    *menu_items ;        /* Where to store the next menu event.    */
  5204. +
  5205. +int    MenuSelect = FALSE ;    /* âüâjâàü[æIæ≡âtâëâO            */
  5206. +LONG    cyMenu ;        /* âüâjâàü[ìÇû┌é╠ìéé│            */
  5207. +LONG    cxSysChar ;        /* âVâXâeâÇÅ╚ù¬Ä₧ò╢ÄÜëíâhâbâgâTâCâY    */
  5208. +LONG    cySysChar ;        /* âVâXâeâÇÅ╚ù¬Ä₧ò╢ÄÜÅcâhâbâgâTâCâY    */
  5209. +LONG    cxBorder ;        /* âVâXâeâÇâ{ü[â_ü[ëíâTâCâY        */
  5210. +LONG    cyBorder ;        /* âVâXâeâÇâ{ü[â_ü[ÅcâTâCâY        */
  5211. +LONG    cxSizeBorder ;        /* âVâXâeâÇâTâCâYâ{ü[â_ü[ëíâTâCâY    */
  5212. +LONG    cxRes ;            /* âVâXâeâÇâtâHâôâgÉàò╜ë≡æ£ôxâTâCâY    */
  5213. +
  5214. +int    MulePid ;        /* Muleû{æ╠é╠âvâìâZâXID            */
  5215. +int    QuitChar = 0x07 ;    /* âLü[èäéΦì₧é▌âRü[âh(Å╚ù¬Æl C-g)    */
  5216. +int    terminating = TRUE ;    /* Muleû{æ╠é╓é╠Æ╩ÉMï╓Ä~âtâëâO        */
  5217. +
  5218. +HWND    PmHwndPecic ;        /* ô·û{îΩâLü[Å≤æ╘è╟ù¥âEâBâôâhâEânâôâhâï    */
  5219. +
  5220. +PFNWP    OrgPecicFrameWndProc ;    /* è∙æ╢âtâîü[âÇâCâxâôâgÅêù¥        */
  5221. +HPS    PmHpsPecic ;        /* PM Mule âvâîâ[ü[âeü[âVâçâô âXâyü[âX    */
  5222. +int    PecicMode ;        /* ô·û{îΩôⁿù═âEâBâôâhâEâéü[âh        */
  5223. +PECICTABLE    Pecic[32] ;    /* ô·û{îΩôⁿù═ùpâEâBâôâhâEânâôâhâï    */
  5224. +int    PecicWndCount = 0 ;    /* ô·û{îΩôⁿù═ùpâEâBâôâhâEÉö        */
  5225. +UCHAR    PecicText[256] ;    /* ô·û{îΩôⁿù═âeâLâXâgâfü[â^        */
  5226. +UCHAR    PecicAttr[256] ;    /* ô·û{îΩôⁿù═æ«É½âeü[â^            */
  5227. +int    PecicLength = 0 ;    /* ô·û{îΩôⁿù═âfü[â^Æ╖            */
  5228. +int    PecicCurPos = 0 ;    /* ô·û{îΩôⁿù═âJü[â\âïê╩Æu        */
  5229. +int    PecicCurType = 0 ;    /* ô·û{îΩôⁿù═âJü[â\âïî`Å≤        */
  5230. +int    PecicCurBase = 0 ;    /* ô·û{îΩôⁿù═âJü[â\âïê╩ÆuâEâBâôâhâE    */
  5231. +int    PecicCurOffset = 0 ;    /* ô·û{îΩôⁿù═âJü[â\âïæèæ╬ê╩Æu        */
  5232. +
  5233. +UCHAR    *FuncDefMenu[12] = {
  5234. +    "F1", "F2", "F3", "F4",
  5235. +    "F5", "F6", "F7", "F8",
  5236. +    "F9", "F10", "F11", "F12",
  5237. +} ;
  5238. +
  5239. +/* Prototypes for functions which are used before defined. */
  5240. +void compute_func_menu( void ) ;
  5241. +void display_func_menu( void ) ;
  5242. +void ConvPecicPos( PPOINTL ptl ) ;
  5243. +void PecicCreateWindow( void ) ;
  5244. +void PecicDestroyWindow( void ) ;
  5245. +void PecicMoveWindow( void ) ;
  5246. +
  5247. +
  5248. +#define CONV_BUTTON( c ) ( ( c ) >= '1' && ( c ) <= '3' ? ( c ) - '0' : 0 )
  5249. +#define MAKE_X( x ) ( ( x ) * PmCxChar )
  5250. +#define MAKE_Y( y ) ( PmCyClient + PmCyDesc - ( ( y ) + 1 ) * PmCyChar )
  5251. +
  5252. +
  5253. +/********************************************************/
  5254. +/*                            */
  5255. +/*    âGâëü[âüâbâZü[âWò\ĪÅêù¥            */
  5256. +/*                            */
  5257. +/********************************************************/
  5258. +void error( const char *msg )
  5259. +{
  5260. +    WinMessageBox( HWND_DESKTOP, HWND_DESKTOP, msg, "PM Mule error", 0,
  5261. +           MB_MOVEABLE | MB_OK | MB_ICONEXCLAMATION ) ;
  5262. +    DosExit( EXIT_PROCESS, 1 ) ;
  5263. +}
  5264. +
  5265. +/********************************************************/
  5266. +/*                            */
  5267. +/*    âüâéâèü[èmò█(OS/2âtâ@âôâNâVâçâôÄgùp)        */
  5268. +/*                            */
  5269. +/********************************************************/
  5270. +void *MemAlloc( ULONG size )
  5271. +{
  5272. +    ULONG    rc ;
  5273. +    void    *p ;
  5274. +
  5275. +    if ( size == 0 )
  5276. +    return ( NULL ) ;
  5277. +    rc = DosAllocMem( ( PVOID )&p, size, PAG_COMMIT | PAG_READ | PAG_WRITE ) ;
  5278. +    if ( rc != 0 )
  5279. +    error( "Out of memory." ) ;
  5280. +    return( p ) ;
  5281. +}
  5282. +
  5283. +/********************************************************/
  5284. +/*                            */
  5285. +/*    âüâéâèü[èJò·(OS/2âtâ@âôâNâVâçâôÄgùp)        */
  5286. +/*                            */
  5287. +/********************************************************/
  5288. +void MemFree( void *p )
  5289. +{
  5290. +    if ( p != NULL )
  5291. +    DosFreeMem( p ) ;
  5292. +}
  5293. +
  5294. +/********************************************************/
  5295. +/*                            */
  5296. +/*    Muleû{æ╠é╓âpâCâvé≡Ägé┴é─âfü[â^é≡ô]æù        */
  5297. +/*                            */
  5298. +/********************************************************/
  5299. +void Send( int fd, const void *src, size_t size )
  5300. +{
  5301. +    const    char *s ;
  5302. +    ULONG    n ;
  5303. +
  5304. +    if ( terminating )
  5305. +    return ;
  5306. +    s = src ;
  5307. +    while ( size ) {
  5308. +    if ( DosWrite( fd, s, size, &n ) != 0 || n == 0 )
  5309. +        error( "Cannot write to pipe" ) ;
  5310. +    size -= n ;
  5311. +    s += n ;
  5312. +    }
  5313. +}
  5314. +
  5315. +/********************************************************/
  5316. +/*                            */
  5317. +/*    Muleû{æ╠é╠òWÅÇôⁿù═é╓PMâCâxâôâgâfü[â^é≡ô]æù    */
  5318. +/*                            */
  5319. +/********************************************************/
  5320. +void SendEvent( const pm_event *src )
  5321. +{
  5322. +    Send( OutPipe, src, sizeof( pm_event ) ) ;
  5323. +}
  5324. +
  5325. +/********************************************************/
  5326. +/*                            */
  5327. +/*    Muleû{æ╠é╓âfü[â^âuâìâbâNé≡ô]æù            */
  5328. +/*                            */
  5329. +/********************************************************/
  5330. +void SendOutdata( const void *src, unsigned size )
  5331. +{
  5332. +    Send( OutdataPipe, src, size ) ;
  5333. +}
  5334. +
  5335. +/********************************************************/
  5336. +/*                            */
  5337. +/*    OS/2î`Ä«é╠âtâHâôâgû╝é≡ôαòöî`Ä«é╔ò╧è╖é╖éΘ    */
  5338. +/*                            */
  5339. +/********************************************************/
  5340. +int parse_font_spec( FONTSPEC *dst, const unsigned char *str )
  5341. +{
  5342. +    int        i ;
  5343. +
  5344. +    dst->size = 0 ;
  5345. +    dst->sel = 0 ;
  5346. +    dst->name[0] = 0 ;
  5347. +    while ( *str >= '0' && *str <= '9' ) {
  5348. +    dst->size = dst->size * 10 + ( *str - '0' ) ;
  5349. +    ++str ;
  5350. +    }
  5351. +    dst->size *= 10 ;
  5352. +    if ( dst->size == 0 )
  5353. +    return FALSE ;
  5354. +    for ( ; ; ) {
  5355. +    if ( strncmp( str, ".bold", 5 ) == 0 ) {
  5356. +        dst->sel |= FM_SEL_BOLD ;
  5357. +        str += 5 ;
  5358. +    } else if ( strncmp( str, ".italic", 7 ) == 0 ) {
  5359. +        dst->sel |= FM_SEL_ITALIC ;
  5360. +        str += 7 ;
  5361. +    } else if ( *str == '.' ) {
  5362. +        ++str ;
  5363. +        break ;
  5364. +    } else
  5365. +        return FALSE ;
  5366. +    }
  5367. +    if ( *str == 0 )
  5368. +    return FALSE ;
  5369. +    _strncpy( dst->name, str, sizeof( dst->name ) ) ;
  5370. +    return TRUE ;
  5371. +}
  5372. +
  5373. +/********************************************************/
  5374. +/*                            */
  5375. +/*    ÄwÆΦâtâHâôâgû╝(ôαòöî`Ä«)é≡âVâXâeâÇé╔ôoÿ^é╖éΘ    */
  5376. +/*                            */
  5377. +/********************************************************/
  5378. +int select_font_internal( void )
  5379. +{
  5380. +    ULONG        fonts, temp, i ;
  5381. +    PFONTMETRICS    pfm ;
  5382. +#ifdef USE_OUTLINE_FONT
  5383. +    USHORT        size ;
  5384. +    FIXED        font_cbox ;
  5385. +    SIZEF        cbox ;
  5386. +#endif
  5387. +
  5388. +    temp = 0 ;
  5389. +    fonts = GpiQueryFonts( PmHpsClient, QF_PUBLIC | QF_PRIVATE,
  5390. +              PmFont.name,
  5391. +              &temp, sizeof( FONTMETRICS ), NULL ) ;
  5392. +    pfm = MemAlloc( fonts * sizeof( FONTMETRICS ) ) ;
  5393. +    GpiQueryFonts( PmHpsClient, QF_PUBLIC | QF_PRIVATE,
  5394. +          PmFont.name,
  5395. +          &fonts, sizeof( FONTMETRICS ), pfm ) ;
  5396. +
  5397. +    for ( i = 0; i < fonts; ++i ) {
  5398. +    if ( !( pfm[i].fsType & FM_TYPE_FIXED ) )
  5399. +        continue ;
  5400. +#ifndef USE_OUTLINE_FONT
  5401. +    if ( pfm[i].fsDefn & FM_DEFN_OUTLINE )
  5402. +        continue ;
  5403. +    if ( pfm[i].sNominalPointSize == PmFont.size ) {
  5404. +#else
  5405. +    if ( pfm[i].sNominalPointSize == PmFont.size ||
  5406. +        ( pfm[i].fsDefn & FM_DEFN_OUTLINE ) ) {
  5407. +#endif
  5408. +        /* âtâHâôâgé≡ôoÿ^é╖éΘ */
  5409. +        NowFontAttrs.usRecordLength  = sizeof( NowFontAttrs ) ;
  5410. +        NowFontAttrs.fsSelection     = PmFont.sel ;
  5411. +        NowFontAttrs.lMatch          = pfm[i].lMatch ;
  5412. +        strcpy( NowFontAttrs.szFacename, pfm[i].szFacename ) ;
  5413. +        NowFontAttrs.idRegistry      = pfm[i].idRegistry ;
  5414. +        NowFontAttrs.usCodePage      = pfm[i].usCodePage ;
  5415. +        NowFontAttrs.lMaxBaselineExt = pfm[i].lMaxBaselineExt ;
  5416. +        NowFontAttrs.lAveCharWidth   = pfm[i].lAveCharWidth ;
  5417. +        NowFontAttrs.fsType          = 0 ;
  5418. +        NowFontAttrs.fsFontUse       = 0 ;
  5419. +        if ( GpiCreateLogFont( PmHpsClient, NULL, SELECT_FONT_ID,
  5420. +                  &NowFontAttrs ) == GPI_ERROR )
  5421. +        continue ;    
  5422. +        GpiSetCharSet( PmHpsClient, SELECT_FONT_ID ) ;
  5423. +#ifdef USE_OUTLINE_FONT
  5424. +        if ( pfm[i].fsDefn & FM_DEFN_OUTLINE ) {
  5425. +        PmOutline = TRUE ;
  5426. +        size = ( USHORT )( ( double )PmFont.size * ( double )cxRes
  5427. +                  / 720.0 + 0.5 ) ;
  5428. +        font_cbox = MAKEFIXED( size, 0 ) ;
  5429. +        cbox.cx = cbox.cy = font_cbox ;
  5430. +        GpiSetCharBox( PmHpsClient, &cbox ) ;
  5431. +        } else {
  5432. +        PmOutline = FALSE ;
  5433. +        }
  5434. +#endif
  5435. +        /* ô·û{îΩôⁿù═âEâBâôâhâEéαò╢ÄÜò╧ìXé╖éΘ */
  5436. +        for ( i = 0; i < PecicWndCount; ++i ) {
  5437. +        GpiCreateLogFont( Pecic[i].Ps, NULL, SELECT_FONT_ID,
  5438. +                 &NowFontAttrs ) ;
  5439. +        GpiSetCharSet( Pecic[i].Ps, SELECT_FONT_ID ) ;
  5440. +#ifdef USE_OUTLINE_FONT
  5441. +        if ( PmOutline ) {
  5442. +            GpiSetCharBox( Pecic[i].Ps, &cbox) ;
  5443. +        }
  5444. +#endif
  5445. +        }
  5446. +        MemFree( pfm ) ;
  5447. +        return TRUE ;
  5448. +    }
  5449. +    }
  5450. +    MemFree( pfm ) ;
  5451. +    return FALSE ;
  5452. +}
  5453. +
  5454. +/********************************************************/
  5455. +/*                            */
  5456. +/*    PMé┼Ägùpé╖éΘâtâHâôâgé≡ÄwÆΦé╖éΘ            */
  5457. +/*                            */
  5458. +/********************************************************/
  5459. +void set_default_font( void )
  5460. +{
  5461. +    FONTMETRICS        fm ;
  5462. +
  5463. +    if ( !select_font_internal( ) ) {
  5464. +    PmFont = PmOldFont ;
  5465. +    select_font_internal( ) ;
  5466. +    }
  5467. +    GpiQueryFontMetrics( PmHpsClient, ( LONG )sizeof( fm ), &fm ) ;
  5468. +    PmCxChar = fm.lMaxCharInc ;
  5469. +    PmCyChar = fm.lMaxBaselineExt ;
  5470. +    PmCyDesc = fm.lMaxDescender ;
  5471. +}
  5472. +
  5473. +/********************************************************/
  5474. +/*                            */
  5475. +/*    âEâBâôâhâEâTâCâYé╞ò\Īê╩Æué≡É▌ÆΦé╖éΘ        */
  5476. +/*                            */
  5477. +/********************************************************/
  5478. +void set_size( int first )
  5479. +{
  5480. +    RECTL    rcl ;
  5481. +    SWP        swp ;
  5482. +    POINTL    ptl ;
  5483. +    ULONG    options ;
  5484. +
  5485. +
  5486. +    options = SWP_SIZE | SWP_SHOW ;
  5487. +    if ( first )
  5488. +    options |= SWP_ZORDER ;
  5489. +    else
  5490. +    options |= SWP_MOVE ;
  5491. +
  5492. +    /* î╗ì▌é╠âEâBâôâhâEâTâCâY&ê╩Æué⌐éτÉVé╡éóâTâCâY&ê╩Æué≡ì─îvÄZé╡é─
  5493. +       âTâCâYé≡îêÆΦé╖éΘ */
  5494. +    WinQueryWindowPos( PmHwndClient, &swp ) ;
  5495. +    ptl.x = swp.x ;                /* Upper left-hand corner */
  5496. +    ptl.y = swp.y + swp.cy ;
  5497. +    WinMapWindowPoints( PmHwndFrame, HWND_DESKTOP, &ptl, 1 ) ;
  5498. +    rcl.xLeft = ptl.x ;
  5499. +    rcl.xRight = rcl.xLeft + PmWidth * PmCxChar ;
  5500. +    rcl.yTop = ptl.y ;
  5501. +    if ( PmFunctionKeyMenu )
  5502. +    rcl.yBottom = rcl.yTop - ( PmHeight + PmFunctionRows ) * PmCyChar ;
  5503. +    else
  5504. +    rcl.yBottom = rcl.yTop - PmHeight * PmCyChar ;
  5505. +    WinCalcFrameRect( PmHwndFrame, &rcl, FALSE ) ;
  5506. +
  5507. +    /* âEâBâôâhâEò\Īé¬Ä└ì█é╠âXâNâèü[âôèOé╔ÅoéΘéµéñé╚ÅΩìçé═âEâBâôâhâEôαé╔
  5508. +       ò\Īé╖éΘéµéñé╔ê╩Æué≡ê┌ô«é╖éΘ */
  5509. +    if ( rcl.yTop > swpScreen.cy ) {
  5510. +    LONG offset = rcl.yTop - swpScreen.cy ;
  5511. +    rcl.yBottom -= offset ;
  5512. +    rcl.yTop -= offset ;
  5513. +    options |= SWP_MOVE ;
  5514. +    }
  5515. +    WinSetWindowPos( PmHwndFrame, HWND_TOP, rcl.xLeft, rcl.yBottom,
  5516. +            rcl.xRight - rcl.xLeft, rcl.yTop - rcl.yBottom, options ) ;
  5517. +}
  5518. +
  5519. +/********************************************************/
  5520. +/*                            */
  5521. +/* âLü[ôⁿù═âRü[âhé≡é≡û{æ╠é╔æùÉMé╖éΘ            */
  5522. +/*                            */
  5523. +/********************************************************/
  5524. +void SendKey( pm_key_type type, int code, int rep )
  5525. +{
  5526. +    pm_event    pme ;
  5527. +    int        i ;
  5528. +
  5529. +    if ( type == PMK_ASCII && code == QuitChar )
  5530. +    kill( MulePid, SIGINT ) ;
  5531. +    else {
  5532. +    pme.key.header.type = PME_KEY ;
  5533. +    pme.key.type = type ;
  5534. +    pme.key.code = code ;
  5535. +    for ( i = 0; i < rep; ++i )
  5536. +        SendEvent( &pme ) ;
  5537. +    }
  5538. +}
  5539. +
  5540. +/********************************************************/
  5541. +/*                            */
  5542. +/* PMâNâëâCâAâôâgÅπé╔âJü[â\âïé≡É╢ɼé╖éΘ            */
  5543. +/*                            */
  5544. +/********************************************************/
  5545. +void create_cursor( int size )
  5546. +{
  5547. +    LONG    cx, cy ;
  5548. +    ULONG    flags ;
  5549. +
  5550. +    if ( PecicLength )
  5551. +    return ;
  5552. +
  5553. +    if ( PmCxChar != 0 && PmCyChar != 0 ) {
  5554. +    cx = PmCxChar ;
  5555. +    if ( size )
  5556. +        cx <<= 1 ;
  5557. +    cy = PmCyChar ;
  5558. +    flags = CURSOR_SOLID ;
  5559. +    switch ( PmCursorType ) {
  5560. +        case CURSORTYPE_BAR:
  5561. +        cx = 0 ;
  5562. +        break ;
  5563. +        case CURSORTYPE_FRAME:
  5564. +        flags = CURSOR_FRAME ;
  5565. +        break ;
  5566. +        case CURSORTYPE_UNDERLINE:
  5567. +        cy = 0 ;
  5568. +        break ;
  5569. +        case CURSORTYPE_HALFTONE:
  5570. +        flags = CURSOR_HALFTONE ;
  5571. +        break ;
  5572. +        case CURSORTYPE_BOX:
  5573. +        break ;
  5574. +        }
  5575. +    if ( PmCursorBlink )
  5576. +        flags |= CURSOR_FLASH ;
  5577. +    WinCreateCursor( PmHwndClient,
  5578. +             PmCursorX, PmCursorY,
  5579. +             cx, cy,
  5580. +             flags, NULL ) ;
  5581. +    if ( PmCursorOn )
  5582. +        WinShowCursor( PmHwndClient, TRUE ) ;
  5583. +    }
  5584. +}
  5585. +
  5586. +/********************************************************/
  5587. +/*                            */
  5588. +/* PM MuleâEâBâôâhâEé╔âtâHü[âJâXé¬éáéΘÅΩìçé╠é▌        */
  5589. +/* âJü[â\âïé≡ò\Īé╖éΘ                    */
  5590. +/*                            */
  5591. +/********************************************************/
  5592. +void set_cursor( void )
  5593. +{
  5594. +    if ( PmHwndClient == WinQueryFocus( HWND_DESKTOP ) ) {
  5595. +    WinDestroyCursor( PmHwndClient ) ;
  5596. +    create_cursor( 0 ) ;
  5597. +    }
  5598. +}
  5599. +
  5600. +/********************************************************/
  5601. +/*                            */
  5602. +/*ü@âüâjâàü[âEâBâôâhâEé≡É╢ɼé╖éΘ(SUBâEâBâôâhâEéαè▄é▐)    */
  5603. +/*                            */
  5604. +/********************************************************/
  5605. +HWND create_menu_handle( HWND hwndParent, HWND hwndOwner, ULONG id )
  5606. +{
  5607. +    return ( WinCreateWindow( hwndParent, WC_MENU, "", 0, 0, 0, 0, 0,
  5608. +                 hwndOwner, HWND_TOP, id, NULL, NULL ) ) ;
  5609. +}
  5610. +
  5611. +/********************************************************/
  5612. +/*                            */
  5613. +/* âüâjâàü[ìÇû┌é≡É▌ÆΦ(æ}ôⁿ)é╖éΘ                */
  5614. +/*                            */
  5615. +/********************************************************/
  5616. +void create_pane( HWND hwndMenu, char **ptr,
  5617. +         char *title, int title_size )
  5618. +{
  5619. +    MENUITEM        mi ;
  5620. +    pm_menu_pane    pmp ;
  5621. +    pm_menu_line    pml ;
  5622. +    char        buf[512], *p ;
  5623. +    int            j, len ;
  5624. +
  5625. +    p = *ptr ;
  5626. +    memcpy( &pmp, p, sizeof( pmp ) ) ;
  5627. +    p += sizeof( pmp ) ;
  5628. +    len = pmp.size ;
  5629. +    if ( title != NULL && title_size > 0 ) {
  5630. +    if ( len >= title_size )
  5631. +        len = title_size - 1 ;
  5632. +    memcpy( title, p, len ) ;
  5633. +    title[len] = 0 ;
  5634. +    }
  5635. +    p += pmp.size ;
  5636. +    for ( j = 0; j < pmp.lines; ++j ) {
  5637. +    memcpy( &pml, p, sizeof( pml ) ) ;
  5638. +    p += sizeof( pml ) ;
  5639. +    len = pml.size ;
  5640. +    if ( len >= sizeof( buf ) )
  5641. +        len = sizeof( buf ) - 1 ;
  5642. +    memcpy( buf, p, len ) ;
  5643. +    p += pml.size ;
  5644. +    buf[len] = 0 ;
  5645. +    *menu_items++ = pml.item ;
  5646. +    mi.iPosition = MIT_END ;
  5647. +    mi.afStyle = MIS_TEXT ;
  5648. +    mi.afAttribute = (pml.enable ? 0 : MIA_DISABLED) ;
  5649. +    mi.hwndSubMenu = NULL ;
  5650. +    mi.hItem = 0 ;
  5651. +    mi.id = PmPopupMenuMax++ ;
  5652. +    WinSendMsg( hwndMenu, MM_INSERTITEM, MPFROMP( &mi ), MPFROMP( buf ) ) ;
  5653. +    }
  5654. +    *ptr = p ;
  5655. +}
  5656. +
  5657. +/********************************************************/
  5658. +/*                            */
  5659. +/*ü@âüâCâôâüâjâàü[âOâïü[âvé≡É╢ɼé╖éΘ            */
  5660. +/*                            */
  5661. +/********************************************************/
  5662. +void create_menu( HWND hwndMenu, HWND hwndOwner, int panes, char **p )
  5663. +{
  5664. +    MENUITEM    mi ;
  5665. +    char    buf[512] ;
  5666. +    int        i ;
  5667. +
  5668. +    if ( panes == 1 )
  5669. +    create_pane( hwndMenu, p, NULL, 0 ) ;
  5670. +    else
  5671. +    for ( i = 0; i < panes; ++i ) {
  5672. +        if ( ( ( pm_menu_pane *)*p )->size == 0 )
  5673. +        create_pane( hwndMenu, p, NULL, 0 ) ;
  5674. +        else {
  5675. +        mi.hwndSubMenu = create_menu_handle( hwndMenu, hwndOwner, 0 ) ;
  5676. +        mi.afStyle = MIS_SUBMENU | MIS_TEXT ;
  5677. +        create_pane( mi.hwndSubMenu, p, buf, sizeof( buf ) ) ;
  5678. +        mi.iPosition = MIT_END ;
  5679. +        mi.afAttribute = 0 ;
  5680. +        mi.hItem = 0 ;
  5681. +        mi.id = PmPopupSubMenuMax++ ;
  5682. +        WinSendMsg( hwndMenu, MM_INSERTITEM, MPFROMP( &mi ),
  5683. +                MPFROMP( buf ) ) ;
  5684. +        }
  5685. +    }
  5686. +}
  5687. +
  5688. +/********************************************************/
  5689. +/*                            */
  5690. +/*ü@â|âbâvâAâbâvâüâjâàü[é≡É╢ɼé╖éΘ            */
  5691. +/*                            */
  5692. +/********************************************************/
  5693. +HWND create_popup_menu( int panes, int lines, char *p, int Titlelen )
  5694. +{
  5695. +    HWND    hwnd ;
  5696. +    MENUITEM    mi ;
  5697. +    char    buf[512] ;
  5698. +
  5699. +    hwnd = create_menu_handle( PmHwndClient, PmHwndClient, 0 ) ;
  5700. +    PmPopupSubMenuMin = PmPopupSubMenuMax = IDM_POPUP + 1000 ;
  5701. +
  5702. +    /* âüâjâàü[æSæ╠é╠â^âCâgâïé≡É╢ɼ */
  5703. +    memcpy( buf, p, Titlelen ) ;
  5704. +    buf[Titlelen] = 0 ;
  5705. +    strcat( buf,"ü@" ) ;
  5706. +    mi.iPosition = MIT_END ;
  5707. +    mi.afAttribute = 0 ;
  5708. +    mi.hwndSubMenu = NULL ;
  5709. +    mi.hItem = 0 ;
  5710. +    mi.id = PmPopupSubMenuMax++ ;
  5711. +    mi.afStyle = MIS_SEPARATOR ;
  5712. +    WinSendMsg( hwnd, MM_INSERTITEM, MPFROMP( &mi ), MPFROMP( buf ) ) ;
  5713. +    mi.id = PmPopupSubMenuMax++ ;
  5714. +    mi.afStyle = MIS_TEXT | MIS_STATIC ;
  5715. +    WinSendMsg( hwnd, MM_INSERTITEM, MPFROMP( &mi ), MPFROMP( buf ) ) ;
  5716. +    mi.id = PmPopupSubMenuMax++ ;
  5717. +    mi.afStyle = MIS_SEPARATOR ;
  5718. +    WinSendMsg( hwnd, MM_INSERTITEM, MPFROMP( &mi ), MPFROMP( buf ) ) ;
  5719. +    p += Titlelen ;
  5720. +
  5721. +    PmPopupMenuItems = MemAlloc( lines * sizeof( *PmPopupMenuItems ) ) ;
  5722. +    PmPopupMenuMin = PmPopupMenuMax = IDM_POPUP ;
  5723. +    menu_items = PmPopupMenuItems ;
  5724. +    create_menu( hwnd, PmHwndClient, panes, &p ) ;
  5725. +    menu_items = NULL ;
  5726. +    return hwnd ;
  5727. +}
  5728. +
  5729. +/********************************************************/
  5730. +/*                            */
  5731. +/* â}âEâXâCâxâôâgé╞âLü[â{ü[âhÅ≤æ╘é┼âCâxâôâgé≡É╢ɼ    */
  5732. +/*                            */
  5733. +/********************************************************/
  5734. +int mouse_button( HWND hwnd, MPARAM mp1, MPARAM mp2, int button,
  5735. +                         int modifier )
  5736. +{
  5737. +    pm_event    pme ;
  5738. +    int        key ;
  5739. +
  5740. +    if ( hwnd == WinQueryFocus( HWND_DESKTOP ) ) {
  5741. +    pme.button.header.type = PME_BUTTON ;
  5742. +    pme.button.button = PmButtons[button] ;
  5743. +    key = ( int )SHORT2FROMMP( mp2 ) ;
  5744. +    if ( key & KC_ALT )    pme.button.button |= ALT_MODIFIER ;
  5745. +    if ( key & KC_CTRL )    pme.button.button |= CTRL_MODIFIER ;
  5746. +    if ( key & KC_SHIFT )    pme.button.button |= SHIFT_MODIFIER ;
  5747. +    pme.button.button |= modifier ;
  5748. +    pme.button.x = ( USHORT )SHORT1FROMMP( mp1 ) / PmCxChar ;
  5749. +    pme.button.y = ( PmCyClient - ( USHORT )SHORT2FROMMP( mp1 ) )
  5750. +        / PmCyChar ;
  5751. +    if ( pme.button.x < 0 ) pme.button.x = 0 ;
  5752. +    if ( pme.button.y < 0 ) pme.button.y = 0 ;
  5753. +    pme.button.timestamp = WinQueryMsgTime( hab ) ;
  5754. +    SendEvent( &pme ) ;
  5755. +    return TRUE ;
  5756. +    }
  5757. +    /* Continue processing -- make window active */
  5758. +    return FALSE ;
  5759. +}
  5760. +
  5761. +static char VKeyTable[][4] = {
  5762. +    {    0x49,    0x49,    0x84,    0x99    },    /* VK_PAGEUP      */
  5763. +    {    0x51,    0x51,    0x76,    0xA1    },    /* VK_PAGEDOWN    */
  5764. +    {    0x4F,    0x4F,    0x75,    0x9F    },    /* VK_END         */
  5765. +    {    0x47,    0x47,    0x77,    0x97    },    /* VK_HOME        */
  5766. +    {    0x4B,    0x4B,    0x73,    0x9B    },    /* VK_LEFT        */
  5767. +    {    0x48,    0x48,    0x8D,    0x98    },    /* VK_UP          */
  5768. +    {    0x4D,    0x4D,    0x74,    0x9D    },    /* VK_RIGHT       */
  5769. +    {    0x50,    0x50,    0x91,    0xA0    },    /* VK_DOWN        */
  5770. +    {    0x00,    0x00,    0x00,    0x00    },    /* VK_PRINTSCRN   */
  5771. +    {    0x52,    0x04,    0x92,    0xA2    },    /* VK_INSERT      */
  5772. +    {    0x53,    0x05,    0x93,    0xA3    },    /* VK_DELETE      */
  5773. +    {    0x00,    0x00,    0x00,    0x00    },    /* VK_SCRLLOCK    */
  5774. +    {    0x00,    0x00,    0x00,    0x00    },    /* VK_NUMLOCK     */
  5775. +    {    0x0A,    0x0A,    0x0A,    0x1C    },    /* VK_ENTER       */
  5776. +    {    0x00,    0x00,    0x00,    0x00    },    /* VK_SYSRQ       */
  5777. +    {    0x3B,    0x54,    0x5E,    0x68    },    /* VK_F1          */
  5778. +    {    0x3C,    0x55,    0x5F,    0x69    },    /* VK_F2          */
  5779. +    {    0x3D,    0x56,    0x60,    0x6A    },    /* VK_F3          */
  5780. +    {    0x3E,    0x57,    0x61,    0x6B    },    /* VK_F4          */
  5781. +    {    0x3F,    0x58,    0x62,    0x6C    },    /* VK_F5          */
  5782. +    {    0x40,    0x59,    0x63,    0x6D    },    /* VK_F6          */
  5783. +    {    0x41,    0x5A,    0x64,    0x6E    },    /* VK_F7          */
  5784. +    {    0x42,    0x5B,    0x65,    0x6F    },    /* VK_F8          */
  5785. +    {    0x43,    0x5C,    0x66,    0x70    },    /* VK_F9          */
  5786. +    {    0x45,    0x5D,    0x67,    0x71    },    /* VK_F10         */
  5787. +    {    0x85,    0x87,    0x89,    0x8B    },    /* VK_F11         */
  5788. +    {    0x86,    0x88,    0x8A,    0x8C    },    /* VK_F12         */
  5789. +} ;
  5790. +
  5791. +/********************************************************/
  5792. +/*                            */
  5793. +/* PM Muleé╠âüâCâôâNâëâCâAâôâgâEâBâôâhâEÅêù¥        */
  5794. +/*                            */
  5795. +/********************************************************/
  5796. +MRESULT ClientWndProc( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2 )
  5797. +{
  5798. +    HPS        hps ;
  5799. +    HDC        hdc ;
  5800. +    RECTL    rcl ;
  5801. +    POINTL    ptl ;
  5802. +    SIZEL    sizel ;
  5803. +    SWP        swp ;
  5804. +    ULONG    menu_item, options, cmd ;
  5805. +    unsigned    fsflags, usch, usvk, usrep, ussc ;
  5806. +    pm_event    pme ;
  5807. +    MENUDATA    *md ;
  5808. +    int        i ;
  5809. +
  5810. +    switch ( msg ) {
  5811. +    case WM_CREATE:
  5812. +    PmHwndPopupMenu = NULLHANDLE ;
  5813. +    hdc = WinOpenWindowDC( hwnd ) ;
  5814. +    DevQueryCaps( hdc, CAPS_GRAPHICS_CHAR_WIDTH, 1, &cxSysChar ) ;
  5815. +    DevQueryCaps( hdc, CAPS_GRAPHICS_CHAR_HEIGHT, 1, &cySysChar ) ;
  5816. +    DevQueryCaps( hdc, CAPS_HORIZONTAL_FONT_RES, 1, &cxRes ) ;
  5817. +
  5818. +    sizel.cx = sizel.cy = 0 ;
  5819. +    PmHpsClient = GpiCreatePS( hab, hdc, &sizel,
  5820. +                    PU_PELS | GPIT_MICRO | GPIA_ASSOC ) ;
  5821. +
  5822. +    GpiSetBackMix( PmHpsClient, BM_OVERPAINT ) ;
  5823. +
  5824. +    /* Switch color table to RGB mode.    */
  5825. +    GpiCreateLogColorTable( PmHpsClient, LCOL_PURECOLOR, LCOLF_RGB,
  5826. +                0, 0, NULL ) ;
  5827. +
  5828. +    hptrCursor = WinLoadPointer( HWND_DESKTOP, ( HMODULE )0L, 2 ) ;
  5829. +
  5830. +    /* ùºÅπéΦÄ₧é╠âtâHâôâgé≡ÄwÆΦ (âVâXâeâÇâfâtâHâïâgâtâHâôâgÄgùp) */
  5831. +    PmFont.size = ( ( 720 / cxRes ) + 1 ) * 10 ;
  5832. +    PmFont.sel = 0 ;
  5833. +    strcpy( PmFont.name, "GOTHIC" ) ;
  5834. +    PmOldFont = PmFont ;
  5835. +    set_default_font( ) ;
  5836. +    return 0 ;
  5837. +
  5838. +    case WM_DESTROY:
  5839. +    GpiDestroyPS( PmHpsClient ) ;
  5840. +    if ( PecicMode )
  5841. +        PecicDestroyWindow( ) ;
  5842. +    break ;
  5843. +
  5844. +    case WM_PAINT:
  5845. +    hps = WinBeginPaint( hwnd, PmHpsClient, &rcl ) ;
  5846. +    WinFillRect( hps, &rcl, PmCurrentBackcolor ) ;
  5847. +    if ( rcl.yBottom <= MAKE_Y( PmHeight - 1 ) - PmCyDesc - 1 ) 
  5848. +        display_func_menu( ) ;
  5849. +    WinEndPaint( hps ) ;
  5850. +
  5851. +    /* Send a redraw event to Emacs.  The minimal bounding rectangle
  5852. +       for the update region is sent along with the event.  */
  5853. +    pme.paint.header.type = PME_PAINT ;
  5854. +    pme.paint.x0 = rcl.xLeft  / PmCxChar ;
  5855. +    pme.paint.x1 = rcl.xRight / PmCxChar ;
  5856. +    pme.paint.y0 = ( PmCyClient - rcl.yTop )    / PmCyChar ;
  5857. +    pme.paint.y1 = ( PmCyClient - rcl.yBottom ) / PmCyChar ;
  5858. +    SendEvent( &pme ) ;
  5859. +    return 0 ;
  5860. +
  5861. +    case WM_CLOSE:
  5862. +    SendKey( PMK_ASCII, 'X' & 0x1f, 1 ) ;
  5863. +    SendKey( PMK_ASCII, 'C' & 0x1f, 1 ) ;
  5864. +    return 0 ;
  5865. +
  5866. +    case WM_CHAR:
  5867. +    /* EMXé╠termioé╞ô»é╢âRü[âhæ╠îné≡ì╠éΘé╜é▀üAtermioé┼îƒÅoé┼é½é╚éó
  5868. +       ægé▌ìçéφé╣é═û│Äïé╖éΘ */
  5869. +
  5870. +    fsflags = ( USHORT )SHORT1FROMMP( mp1 ) ;
  5871. +
  5872. +    /* âLü[âAâbâvâCâxâôâgé═û│Äïé╖éΘ */
  5873. +    if ( fsflags & KC_KEYUP )
  5874. +        return 0 ;
  5875. +
  5876. +    usrep = CHAR3FROMMP( mp1 ) ;
  5877. +    ussc  = CHAR4FROMMP( mp1 ) ;
  5878. +    usch  = ( USHORT )SHORT1FROMMP( mp2 ) ;
  5879. +    usvk  = ( USHORT )SHORT2FROMMP( mp2 ) ;
  5880. +
  5881. +    /* ègÆúâLü[ÆPæ╠é╛é»é╠ÅΩìçé═âèâ^ü[âô */
  5882. +    switch ( usvk ) {
  5883. +    case VK_NUMLOCK:
  5884. +    case VK_CAPSLOCK:
  5885. +    case VK_SHIFT:
  5886. +    case VK_ALT:
  5887. +    case VK_CTRL:
  5888. +        return 0 ;
  5889. +    }
  5890. +
  5891. +    /* â_âCâîâNâgâRü[âhôⁿù═é⌐é≡â`âFâbâN */
  5892. +    if ( ( fsflags & ( KC_ALT | KC_SCANCODE ) )
  5893. +        == ( KC_ALT | KC_SCANCODE ) ) {
  5894. +        switch ( ussc ) {
  5895. +        case 0x47: case 0x48: case 0x49:   /* 7 8 9 */
  5896. +        case 0x4b: case 0x4c: case 0x4d:   /* 4 5 6 */
  5897. +        case 0x4f: case 0x50: case 0x51:   /* 1 2 3 */
  5898. +        case 0x52:                         /* 0     */
  5899. +        /* âeâôâLü[ÉöÄÜé╠ÅΩìçé═â_âCâîâNâgôⁿù═é┼éáéΘ */
  5900. +        return 0 ;
  5901. +        }
  5902. +    }
  5903. +
  5904. +    /* ë╝æzâLü[Åêù¥ */
  5905. +    if ( fsflags & KC_VIRTUALKEY ) {
  5906. +        switch ( usvk ) {
  5907. +        case VK_ESC:
  5908. +        SendKey( PMK_ASCII, 0x1b, usrep ) ;
  5909. +        return 0 ;
  5910. +
  5911. +        case VK_BACKSPACE:
  5912. +        if ( fsflags & KC_ALT ) {
  5913. +            for ( i = 0; i < usrep; ++i ) {
  5914. +            SendKey( PMK_ASCII, 0, 1 ) ;
  5915. +            SendKey( PMK_ASCII, 0x0e, 1 ) ;
  5916. +            }
  5917. +        } else
  5918. +            SendKey( PMK_ASCII, 0x7f, usrep ) ;
  5919. +        return 0 ;
  5920. +
  5921. +        case VK_NEWLINE:
  5922. +        case VK_ENTER:
  5923. +        /* âRâôâgâìü[âïâLü[ò╣ùpé╠ÅΩìçé═ LFDâLü[é╞é╡é─âRü[âgé≡ò╘é╖ */
  5924. +        if ( fsflags & KC_CTRL )
  5925. +            SendKey( PMK_ASCII, 0x0a, usrep ) ;
  5926. +        else
  5927. +            SendKey( PMK_ASCII, 0x0d, usrep ) ;
  5928. +        return 0 ;
  5929. +
  5930. +        case VK_SPACE:
  5931. +        if ( ( fsflags & ( KC_CTRL | KC_ALT ) ) == 0 ) {
  5932. +            SendKey( PMK_ASCII, 0x20, usrep ) ;
  5933. +            return 0 ;
  5934. +        }
  5935. +        for ( i = 0; i < usrep; ++i ) {
  5936. +            SendKey( PMK_ASCII, 0, 1 ) ;
  5937. +            if ( ( fsflags & KC_CTRL ) == KC_CTRL )
  5938. +            SendKey( PMK_ASCII, 0x02, 1 ) ;
  5939. +            else
  5940. +            SendKey( PMK_ASCII, 0x39, 1 ) ;
  5941. +        }
  5942. +        return 0 ;
  5943. +        } /* end of switch */
  5944. +
  5945. +        if ( usvk >= VK_PAGEUP && usvk <= VK_F12
  5946. +        && !( fsflags & KC_CHAR ) ) {
  5947. +        for ( i = 0; i < usrep; ++i ) {
  5948. +            SendKey( PMK_ASCII, 0, 1 ) ;
  5949. +            if ( fsflags & KC_ALT ) {
  5950. +            SendKey( PMK_ASCII, VKeyTable[usvk-VK_PAGEUP][3], 1 ) ;
  5951. +            } else if ( fsflags & KC_CTRL ) {
  5952. +            SendKey( PMK_ASCII, VKeyTable[usvk-VK_PAGEUP][2], 1 ) ;
  5953. +            } else if ( fsflags & KC_SHIFT ) {
  5954. +            SendKey( PMK_ASCII, VKeyTable[usvk-VK_PAGEUP][1], 1 ) ;
  5955. +            } else
  5956. +            SendKey( PMK_ASCII, VKeyTable[usvk-VK_PAGEUP][0], 1 ) ;
  5957. +        }
  5958. +        return 0 ;
  5959. +            }
  5960. +    }
  5961. +
  5962. +    /* ò╢ÄÜôⁿù═é╠é▌ */
  5963. +    if (fsflags & KC_CHAR) {
  5964. +        if ( usch > 0xff )
  5965. +        SendKey( PMK_KANJI, usch, usrep ) ;
  5966. +        else            
  5967. +        SendKey( PMK_ASCII, usch, usrep ) ;
  5968. +        return 0 ;
  5969. +        }
  5970. +
  5971. +    /* CTRL+òüÆ╩âLü[é╠Åêù¥ */
  5972. +    if ( fsflags & KC_CTRL ) {
  5973. +        if ( usch >= 0x40 && usch <= 0x7f ) {
  5974. +        if ( usch == 0x40 ) {
  5975. +            /* C-@ */
  5976. +            for ( i = 0; i < usrep; ++i ) {
  5977. +            SendKey( PMK_ASCII, 0, 1 ) ;
  5978. +            SendKey( PMK_ASCII, 0x03, 1 ) ;
  5979. +            }
  5980. +        } else {
  5981. +            SendKey( PMK_ASCII, usch & 0x1f, usrep ) ;
  5982. +        }
  5983. +        } else if ( ( usch & 0xff ) != 0 ) {
  5984. +        SendKey( PMK_ASCII, usch, usrep ) ;
  5985. +            }
  5986. +        return 0 ;
  5987. +        }
  5988. +
  5989. +    /* ALT+òüÆ╩âLü[é╠Åêù¥ */
  5990. +    if ( fsflags & KC_ALT ) {
  5991. +        if ( ussc >= 0x02 && ussc <= 0x0d )
  5992. +        /* ALT+1ü`ALT+= */
  5993. +        ussc += 0x76 ;
  5994. +        else if ( ussc == 0x92 )
  5995. +        /* AXâLü[é╠"âì"âLü[ */
  5996. +        ussc = 0xb3 ;
  5997. +        for ( i = 0; i < usrep; ++i ) {
  5998. +        SendKey( PMK_ASCII, 0, 1 ) ;
  5999. +        SendKey( PMK_ASCII, ussc, 1 ) ;
  6000. +        }
  6001. +        return 0 ;
  6002. +    }
  6003. +
  6004. +    /* âeâôâLü[é¬âRâôâgâìü[âïâLü[é╠Ä₧é╠5 */
  6005. +    if ( ussc == 0x4c ) {
  6006. +        for ( i = 0; i < usrep; ++i ) {
  6007. +        SendKey( PMK_ASCII, 0, 1 ) ;
  6008. +        SendKey( PMK_ASCII, ussc, 1 ) ;
  6009. +        }
  6010. +        return 0 ;
  6011. +    }
  6012. +
  6013. +    /* ô·û{îΩâtâìâôâgâGâôâhâLâbâNôÖé╠ègÆúé¬éáéΘÅΩìç */
  6014. +    if ( fsflags & KC_VIRTUALKEY ) {
  6015. +        SendKey( PMK_VIRTUAL, usvk, usrep ) ;
  6016. +        switch ( usvk ) {
  6017. +        case VK_DBE_IMEACTIVATE:
  6018. +        PecicMode = 1 ;
  6019. +        PecicCreateWindow( ) ;
  6020. +        return 0 ;
  6021. +
  6022. +        case VK_DBE_IMEDEACTIVATE:
  6023. +        PecicMode = 0 ;
  6024. +        PecicDestroyWindow( ) ;
  6025. +        return 0 ;
  6026. +        default:
  6027. +        return 0 ;
  6028. +        }
  6029. +    }
  6030. +    return 0 ;
  6031. +
  6032. +    case WM_TRANSLATEACCEL:
  6033. +
  6034. +    /* Examine accelerator table.  We ignore the accelerator table
  6035. +       if the shortcuts frame parameter is nil.  By ignoring the
  6036. +       accelerator table, we receive WM_CHAR messages for F1, F10,
  6037. +       A-f4, A-space etc. */
  6038. +
  6039. +    if ( PmDisableShortcuts )
  6040. +        return FALSE ;
  6041. +    break ;
  6042. +
  6043. +    case WM_COMMAND:
  6044. +    cmd = COMMANDMSG( &msg )->cmd ;
  6045. +    /* â|âbâvâAâbâvâüâjâàü[é⌐éτé╠âCâxâôâgÅêù¥ */
  6046. +    if ( COMMANDMSG( &msg )->source == CMDSRC_MENU
  6047. +        && cmd >= PmPopupMenuMin
  6048. +        && cmd < PmPopupMenuMax ) {
  6049. +        /* æIæ≡é│éΩé╜ìÇû┌ö╘ìåé≡Muleû{æ╠é╔æùéΘ */
  6050. +        menu_item = PmPopupMenuItems[cmd - PmPopupMenuMin];
  6051. +        SendOutdata( &menu_item, sizeof( menu_item ) ) ;
  6052. +        return 0 ;
  6053. +        }
  6054. +
  6055. +    switch ( cmd ) {
  6056. +    case IDM_FUNCMENU:
  6057. +        WinSetFocus( HWND_DESKTOP, PmHwndClient ) ;
  6058. +        return 0 ;
  6059. +    }
  6060. +
  6061. +    break ;
  6062. +
  6063. +    case WM_MENUEND:
  6064. +    /* Äσâ|âbâvâAâbâvâüâjâàü[é¬ÅIù╣é╡é╜ÅΩìçé╠é▌Åêù¥é╖éΘ */
  6065. +    if ( HWNDFROMMP( mp2 ) == PmHwndPopupMenu ) {
  6066. +        /* âüâjâàü[ÅIù╣Ä₧üAìÇû┌æIæ≡é│éΩé─éóéΘé⌐é≡â`âFâbâNé╡üAæIæ≡é│éΩé─
  6067. +           éóé╚éóÅΩìçé═ ûóæIæ≡é╞é╡é─Muleû{æ╠é╔ìÇû┌ö╘ìåé≡æùéΘ */
  6068. +        if ( !MenuSelect ) {
  6069. +        menu_item = 0 ;
  6070. +        SendOutdata( &menu_item, sizeof( menu_item ) ) ;
  6071. +            }
  6072. +        }
  6073. +    return 0 ;
  6074. +
  6075. +    case WM_MENUSELECT:
  6076. +    /* â|âbâvâAâbâvâüâjâàü[é¬æIæ≡é│éΩé╜ÅΩìçé═âtâëâOé≡âZâbâgé╖éΘüB
  6077. +       Ä└ì█é╠æIæ≡ìÇû┌é╠ö╘ìåô]æùé═â|âbâvâAâbâvâüâjâàü[é¬Å┴éªé─é⌐éτæùéτéΩéΘ
  6078. +       WM_COMMANDôαé┼ìséñüB*/
  6079. +
  6080. +    if ( SHORT2FROMMP( mp1 ) ) {
  6081. +        cmd = SHORT1FROMMP( mp1 ) ;
  6082. +        if ( cmd >= PmPopupMenuMin
  6083. +        && cmd < PmPopupMenuMax )
  6084. +        MenuSelect = TRUE ;
  6085. +        }
  6086. +    break ;
  6087. +
  6088. +    case WM_BUTTON1DOWN:
  6089. +    if ( mouse_button( hwnd, mp1, mp2, 0, DOWN_MODIFIER ) )
  6090. +        return ( MRESULT )TRUE ;
  6091. +    break ;
  6092. +
  6093. +    case WM_BUTTON1UP:
  6094. +    if ( mouse_button( hwnd, mp1, mp2, 0, UP_MODIFIER ) )
  6095. +        return ( MRESULT )TRUE ;
  6096. +    break ;
  6097. +
  6098. +    case WM_BUTTON2DOWN:
  6099. +    if ( mouse_button( hwnd, mp1, mp2, 1, DOWN_MODIFIER ) )
  6100. +        return ( MRESULT )TRUE ;
  6101. +    break ;
  6102. +
  6103. +    case WM_BUTTON2UP:
  6104. +    if ( mouse_button( hwnd, mp1, mp2, 1, UP_MODIFIER ) )
  6105. +        return ( MRESULT )TRUE ;
  6106. +    break ;
  6107. +
  6108. +    case WM_BUTTON3DOWN:
  6109. +    if ( mouse_button( hwnd, mp1, mp2, 2, DOWN_MODIFIER ) )
  6110. +        return ( MRESULT )TRUE ;
  6111. +    break ;
  6112. +
  6113. +    case WM_BUTTON3UP:
  6114. +    if ( mouse_button( hwnd, mp1, mp2, 2, UP_MODIFIER ) )
  6115. +        return ( MRESULT )TRUE ;
  6116. +    break ;
  6117. +
  6118. +    case WM_BUTTON1DBLCLK:
  6119. +    case WM_BUTTON2DBLCLK:
  6120. +    case WM_BUTTON3DBLCLK:
  6121. +    /* â_âuâïâNâèâbâNé═â_âEâôâCâxâôâgé¬ö¡É╢é╡é─êΩÆΦÄ₧è╘ôαé╔éαéñêΩôx
  6122. +       ô»é╢â{â^âôé¬â_âEâôé│éΩé╜Ä₧ô_é┼ö¡ìsé│éΩéΘé╜é▀üAû{æ╠é╔1ôxâ_âEâô
  6123. +       âCâxâôâgé¬ô]æùé│éΩé─é⌐éτâ_âuâïâNâèâbâNâCâxâôâgé≡ô]æùé╡é─é╡é▄éñüB
  6124. +       é▒éΩé≡ë≡îêé╖éΘù╟éóâAâCâfâBâAé¬û│éóé╜é▀î╗ì▌û│Äïé╡é─éóéΘüB*/
  6125. +    break ;
  6126. +
  6127. +    case WM_SIZE:
  6128. +
  6129. +    /* The size of the window has changed.  Store the new size and
  6130. +       recreate the cursor.  The cursor must be recreated to install
  6131. +       the new clipping rectangle.  While minimizing the window,
  6132. +       this message is ignored. */
  6133. +
  6134. +    PmCxClient = SHORT1FROMMP( mp2 ) ;
  6135. +    PmCyClient = SHORT2FROMMP( mp2 ) ;
  6136. +    set_cursor( ) ;
  6137. +
  6138. +    /* ò╧ìXâTâCâYé≡Muleû{æ╠é╔Æméτé╣éΘ */
  6139. +    pme.size.header.type = PME_SIZE ;
  6140. +    pme.size.width = PmCxClient / PmCxChar ;
  6141. +    pme.size.height = PmCyClient / PmCyChar ;
  6142. +    if ( PmFunctionKeyMenu )
  6143. +        pme.size.height -= PmFunctionRows ;
  6144. +    if ( pme.size.width  < 0 ) pme.size.width = 0 ;
  6145. +    if ( pme.size.height < 0 ) pme.size.height = 0 ;
  6146. +    PmWidth = pme.size.width ;
  6147. +    PmHeight = pme.size.height ;
  6148. +    SendEvent( &pme ) ;
  6149. +
  6150. +    /* âtâ@âôâNâVâçâôâüâjâàü[âTâCâYé≡ì─îvÄZé╖éΘ */
  6151. +    compute_func_menu( ) ;
  6152. +
  6153. +    /* ô·û{îΩôⁿù═âEâBâôâhâEìÇû┌é╠ì─É▌ÆΦ */
  6154. +    PecicComputeWindow( ) ;
  6155. +
  6156. +    /* ì┼æσë╗üAò£î│ë╗é╠é╜é▀é╔break é═é╣é╕üAWM_MOVEï@ö\éαÄ└ìsé╖éΘ */
  6157. +    case WM_MOVE:
  6158. +    WinQueryWindowPos( PmHwndClient, &swp ) ;
  6159. +    ptl.x = swp.x ;
  6160. +    ptl.y = swp.y ;
  6161. +    WinMapWindowPoints( PmHwndFrame, HWND_DESKTOP, &ptl, 1 ) ;
  6162. +    PmTop = swpScreen.cy - 1 - ( ptl.y + swp.cy ) ;
  6163. +    PmLeft = ptl.x ;
  6164. +
  6165. +    /* ô·û{îΩôⁿù═PecicâEâBâôâhâEéαô»Ä₧é╔ê┌ô«é╖éΘ */
  6166. +    PecicMoveWindow( ) ;
  6167. +    return 0 ;
  6168. +
  6169. +    case WM_SETFOCUS:
  6170. +
  6171. +    /* Create the cursor when receiving the input focus, destroy the
  6172. +       cursor when loosing the input focus. */
  6173. +    if ( SHORT1FROMMP( mp2 ) )
  6174. +        create_cursor( 0 ) ;
  6175. +    else
  6176. +        WinDestroyCursor( hwnd ) ;
  6177. +    return 0 ;
  6178. +
  6179. +    case WM_QUERYCONVERTPOS:
  6180. +        /* ô·û{îΩôⁿù═âXâ|âbâg(âmü[â}âïâéü[âh)ò╧è╖ê╩Æué≡PecicâvâìâZâXé╓ò╘é╖ */
  6181. +    ( ( PRECTL )mp1 )->xLeft   = PmCursorX ;
  6182. +    ( ( PRECTL )mp1 )->yBottom = PmCursorY ;
  6183. +    ( ( PRECTL )mp1 )->xRight  = 0L ;
  6184. +    ( ( PRECTL )mp1 )->yTop    = 0L ;
  6185. +    return( MRFROMLONG( TRUE ) ) ;
  6186. +
  6187. +    case UWM_POPUPMENU:
  6188. +    md = ( MENUDATA * )mp2 ;
  6189. +    PmHwndPopupMenu = create_popup_menu( md->panes, md->lines,
  6190. +                          md->data, md->title_size ) ;
  6191. +    options = ( PU_MOUSEBUTTON1 | PU_MOUSEBUTTON2 | PU_MOUSEBUTTON3
  6192. +           | PU_KEYBOARD | PU_HCONSTRAIN | PU_VCONSTRAIN ) ;
  6193. +    if ( md->button >= 1 && md->button <= 3 )
  6194. +        for ( i = 0; i < 3; ++i )
  6195. +        if ( PmButtons[i] == md->button )
  6196. +            switch ( i ) {
  6197. +            case 0: options |= PU_MOUSEBUTTON1DOWN ; break ;
  6198. +            case 1: options |= PU_MOUSEBUTTON2DOWN ; break ;
  6199. +            case 2: options |= PU_MOUSEBUTTON3DOWN ; break ;
  6200. +            }
  6201. +    MenuSelect = FALSE ;
  6202. +    WinPopupMenu( PmHwndFrame, hwnd, PmHwndPopupMenu,
  6203. +              md->x, md->y, 0, options ) ;
  6204. +    return 0 ;
  6205. +    }
  6206. +    return WinDefWindowProc( hwnd, msg, mp1, mp2 ) ;
  6207. +}
  6208. +
  6209. +/********************************************************/
  6210. +/*                            */
  6211. +/* Muleû{æ╠é⌐éτé╠Åoù═âfü[â^é≡Ä≤é»ÄµéΘ            */
  6212. +/*                            */
  6213. +/********************************************************/
  6214. +void receive( void *dst, ULONG size )
  6215. +{
  6216. +    char    *d ;
  6217. +    ULONG    n ;
  6218. +
  6219. +    d = dst ;
  6220. +    while ( size != 0 ) {
  6221. +    if ( DosRead( InPipe, d, size, &n ) != 0 || n == 0 )
  6222. +        error( "Cannot read from pipe" ) ;
  6223. +    size -= n ;
  6224. +    d += n ;
  6225. +    }
  6226. +}
  6227. +
  6228. +/********************************************************/
  6229. +/*                            */
  6230. +/*ü@âEâBâôâhâEò\Īê╩Æué≡É▌ÆΦé╖éΘ            */
  6231. +/*                            */
  6232. +/********************************************************/
  6233. +void set_pos( int left, int top )
  6234. +{
  6235. +    SWP        swp ;
  6236. +    RECTL    rcl ;
  6237. +  
  6238. +    WinQueryWindowPos( PmHwndClient, &swp ) ;
  6239. +    if ( left != DONT_MOVE ) {
  6240. +    if ( left >= 0 )
  6241. +        swp.x = left ;
  6242. +    else
  6243. +        swp.x = swpScreen.cx - swp.cx + left ;
  6244. +    }
  6245. +    if ( top != DONT_MOVE ) {
  6246. +    if ( top >= 0 )
  6247. +        swp.y = swpScreen.cy - 1 - ( top + swp.cy ) ;
  6248. +    else
  6249. +        swp.y = - top ;
  6250. +    }
  6251. +    rcl.xLeft   = swp.x ;
  6252. +    rcl.xRight  = swp.x + swp.cx ;
  6253. +    rcl.yBottom = swp.y ;
  6254. +    rcl.yTop    = swp.y + swp.cy ;
  6255. +    WinCalcFrameRect( PmHwndFrame, &rcl, FALSE ) ;
  6256. +    swp.x = rcl.xLeft ;
  6257. +    swp.y = rcl.yBottom ;
  6258. +
  6259. +    WinSetWindowPos( PmHwndFrame, HWND_TOP,
  6260. +             swp.x, swp.y, 0, 0, SWP_MOVE ) ;
  6261. +    PmLeft = rcl.xLeft ;
  6262. +    PmTop  = rcl.yTop ;
  6263. +}
  6264. +
  6265. +/********************************************************/
  6266. +/*                            */
  6267. +/* î╗ì▌é╠â}âEâXâ|âWâVâçâôé≡Muleû{æ╠é╔æùÉMé╖éΘ        */
  6268. +/*                            */
  6269. +/********************************************************/
  6270. +void get_mousepos( void )
  6271. +{
  6272. +    HWND    hwnd ;
  6273. +    POINTL    ptl ;
  6274. +    int        i ;
  6275. +    pmd_mousepos result ;
  6276. +
  6277. +    result.frame = 0 ;
  6278. +    result.x = 0 ;
  6279. +    result.y = 0 ;
  6280. +    WinQueryPointerPos( HWND_DESKTOP, &ptl ) ;
  6281. +    hwnd = WinWindowFromPoint( HWND_DESKTOP, &ptl, TRUE ) ;
  6282. +    if ( hwnd != NULLHANDLE ) {
  6283. +    WinMapWindowPoints( HWND_DESKTOP, PmHwndClient, &ptl, 1 ) ;
  6284. +    result.x = ptl.x / PmCxChar ;
  6285. +    result.y = ( PmCyClient - ptl.y ) / PmCyChar ;
  6286. +    if ( result.x < 0 ) result.x = 0 ;
  6287. +    if ( result.y < 0 ) result.y = 0 ;
  6288. +    }
  6289. +    SendOutdata( &result, sizeof( result ) ) ;
  6290. +}
  6291. +
  6292. +UCHAR *config_buffer = NULL ;
  6293. +
  6294. +/********************************************************/
  6295. +/*                            */
  6296. +/* PMö┼Muleé╠ègÆúï@ö\êΩùùé≡Muleû{æ╠é╔ô]æùé╖éΘ        */
  6297. +/*                            */
  6298. +/********************************************************/
  6299. +void get_config (void)
  6300. +{
  6301. +    pmd_config        answer ;
  6302. +    UCHAR        *p ;
  6303. +    int            len, size ;
  6304. +    UCHAR        tmp[32] ;
  6305. +
  6306. +    size = 0 ;
  6307. +    config_buffer = p = MemAlloc( 80 * 20 ) ;
  6308. +    answer.count = 13 ;
  6309. +
  6310. +    len = sprintf( p+1, "         ëíò╢ÄÜÉö : %d ò╢ÄÜ", PmWidth ) ;
  6311. +    *p = ( UCHAR )len++ ; size += len ; p += len ;
  6312. +
  6313. +    len = sprintf( p+1, "         Åcò╢ÄÜÉö : %d ìs", PmHeight ) ;
  6314. +    *p = ( UCHAR )len++ ; size += len ; p += len ;
  6315. +
  6316. +    len = sprintf( p+1, "   ò\\ĪèJÄnÅπê╩Æu : %d (âhâbâg)", PmTop ) ;
  6317. +    *p = ( UCHAR )len++ ; size += len ; p += len ;
  6318. +
  6319. +    len = sprintf( p+1, "   ò\\ĪèJÄnì╢ê╩Æu : %d (âhâbâg)", PmLeft ) ;
  6320. +    *p = ( UCHAR )len++ ; size += len ; p += len ;
  6321. +
  6322. +    len = sprintf( p+1, "       ò╢ÄÜò\\ĪÉF : %3d %3d %3d (RGB)",
  6323. +          ( PmCurrentColor >> 16 ) & 0xff,
  6324. +          ( PmCurrentColor >> 8 ) & 0xff, 
  6325. +          PmCurrentColor & 0xff ) ;
  6326. +    *p = ( UCHAR )len++ ; size += len ; p += len ;
  6327. +
  6328. +    len = sprintf( p+1, "       ò╢ÄÜöwîiÉF : %3d %3d %3d (RGB)",
  6329. +          ( PmCurrentBackcolor >> 16 ) & 0xff,
  6330. +          ( PmCurrentBackcolor >> 8 ) & 0xff,
  6331. +          PmCurrentBackcolor & 0xff ) ;
  6332. +    *p = ( UCHAR )len++ ; size += len ; p += len ;
  6333. +
  6334. +    len = sprintf( p+1, "   ï¡Æ▓ò╢ÄÜò\\ĪÉF : %3d %3d %3d (RGB)",
  6335. +          ( PmHighlightColor >> 16 ) & 0xff,
  6336. +          ( PmHighlightColor >> 8 ) & 0xff,
  6337. +          PmHighlightColor & 0xff ) ;
  6338. +    *p = ( UCHAR )len++ ; size += len ; p += len ;
  6339. +
  6340. +    len = sprintf( p+1, "   ï¡Æ▓ò╢ÄÜöwîiÉF : %3d %3d %3d (RGB)",
  6341. +          ( PmHighlightBackcolor >> 16 ) & 0xff,
  6342. +          ( PmHighlightBackcolor >> 8 ) & 0xff,
  6343. +          PmHighlightBackcolor & 0xff ) ;
  6344. +    *p = ( UCHAR )len++ ; size += len ; p += len ;
  6345. +
  6346. +    switch ( PmCursorType ) {
  6347. +    case CURSORTYPE_BOX:    strcpy( tmp, "box" ) ;        break ;
  6348. +    case CURSORTYPE_BAR:    strcpy( tmp, "bar" ) ;        break ;
  6349. +    case CURSORTYPE_FRAME:    strcpy( tmp, "frame" ) ;    break ;
  6350. +    case CURSORTYPE_UNDERLINE:    strcpy( tmp, "underline" ) ;    break ;
  6351. +    case CURSORTYPE_HALFTONE:    strcpy( tmp, "halftone" ) ;    break ;
  6352. +    }
  6353. +    len = sprintf( p+1, "     âJü[â\\âïî`Å≤ : %s", tmp ) ;
  6354. +    *p = ( UCHAR )len++ ; size += len ; p += len ;
  6355. +
  6356. +    len = sprintf( p+1, "     âJü[â\\âïô_û┼ : %s",
  6357. +          PmCursorBlink ? "yes" : "no" ) ;
  6358. +    *p = ( UCHAR )len++ ; size += len ; p += len ;
  6359. +
  6360. +    len = sprintf( p+1, "   âzâbâgâLü[ïzÄ√ : %s",
  6361. +          PmDisableShortcuts ? "yes" : "no" ) ;
  6362. +    *p = ( UCHAR )len++ ; size += len ; p += len ;
  6363. +
  6364. +    len = sprintf( p+1, " â}âEâXâ{â^âôÄwÆΦ : %c%c%c",
  6365. +        PmButtons[0] + '0',
  6366. +        PmButtons[1] + '0',
  6367. +        PmButtons[2] + '0' ) ;
  6368. +    *p = ( UCHAR )len++ ; size += len ; p += len ;
  6369. +
  6370. +    len = sprintf( p+1, "     ÄgùpâtâHâôâg : %d.%s",
  6371. +          PmFont.size / 10,
  6372. +          PmFont.name ) ;
  6373. +    *p = ( UCHAR )len++ ; size += len ; p += len ;
  6374. +
  6375. +    answer.size = size ;
  6376. +    SendOutdata( &answer, sizeof( answer ) ) ;
  6377. +    SendOutdata( config_buffer, answer.size ) ;
  6378. +    MemFree( config_buffer ) ;
  6379. +}
  6380. +
  6381. +/********************************************************/
  6382. +/*                            */
  6383. +/* âNâèâbâvâ{ü[âhé⌐éτâeü[â^é≡ĵéΦé╛é╡üAû{æ╠é╓ô]æùé╖éΘ    */
  6384. +/*                            */
  6385. +/********************************************************/
  6386. +void get_clipboard (int get_text)
  6387. +{
  6388. +    ULONG    size, ulData ;
  6389. +    PCH        str ;
  6390. +    int        opened ;
  6391. +
  6392. +    size = 0 ;
  6393. +    opened = WinOpenClipbrd( hab ) ;
  6394. +    if ( opened ) {
  6395. +    ulData = WinQueryClipbrdData( hab, CF_TEXT ) ;
  6396. +    if ( ulData != 0 ) {
  6397. +        str = ( PCH )ulData ;
  6398. +        size = strlen( str ) ;
  6399. +        }
  6400. +    }
  6401. +    SendOutdata( &size, sizeof( size ) ) ;
  6402. +    if ( size != 0 && get_text )
  6403. +    SendOutdata( str, size ) ;
  6404. +    if ( opened )
  6405. +    WinCloseClipbrd( hab ) ;
  6406. +}
  6407. +
  6408. +/********************************************************/
  6409. +/*                            */
  6410. +/* âNâèâbâvâ{ü[âhé╔âfü[â^é≡âZâbâgé╖éΘ            */
  6411. +/*                            */
  6412. +/********************************************************/
  6413. +void put_clipboard (unsigned long size)
  6414. +{
  6415. +    char *buf ;
  6416. +
  6417. +    DosAllocSharedMem( ( PVOID )&buf, NULL, size + 1,
  6418. +               PAG_COMMIT | PAG_READ | PAG_WRITE | OBJ_GIVEABLE ) ;
  6419. +    receive( buf, size ) ;
  6420. +    buf[size] = 0 ;
  6421. +    if ( WinOpenClipbrd( hab ) ) {
  6422. +    WinEmptyClipbrd( hab ) ;
  6423. +    WinSetClipbrdData( hab, ( ULONG )buf, CF_TEXT, CFI_POINTER ) ;
  6424. +    WinCloseClipbrd( hab ) ;
  6425. +    }
  6426. +}
  6427. +
  6428. +/********************************************************/
  6429. +/*                            */
  6430. +/* ôⁿù═âpâ^ü[âôé╞êΩÆvé╖éΘâtâHâôâgû╝é≡ò╘é╖        */
  6431. +/*                            */
  6432. +/********************************************************/
  6433. +int font_match (const UCHAR *pattern, const UCHAR *name)
  6434. +{
  6435. +    for (;;) {
  6436. +    switch ( *pattern ) {
  6437. +    case 0:
  6438. +        return ( *name == 0 ) ;
  6439. +    case '?':
  6440. +        ++pattern ;
  6441. +        if ( *name == 0 )
  6442. +        return 0 ;
  6443. +        ++name ;
  6444. +        break ;
  6445. +    case '*':
  6446. +        while ( *pattern == '*' )
  6447. +        ++pattern ;
  6448. +        if ( *pattern == 0 )
  6449. +        return 1 ;
  6450. +        while ( *name != 0 ) {
  6451. +        if ( font_match( pattern, name ) )
  6452. +            return 1 ;
  6453. +        ++name ;
  6454. +        }
  6455. +        return 0 ;
  6456. +    default:
  6457. +        if ( *pattern != *name )
  6458. +        return 0 ;
  6459. +        ++pattern ;
  6460. +        ++name ;
  6461. +        break ;
  6462. +    }
  6463. +    }
  6464. +}
  6465. +
  6466. +
  6467. +/* Buffer for pm-list-fonts. */
  6468. +
  6469. +UCHAR *fontlist_buffer = NULL ;
  6470. +ULONG fontlist_size = 0 ;
  6471. +ULONG fontlist_used = 0 ;
  6472. +
  6473. +#define LISTFONT_NAME   0x01    /* Name is known */
  6474. +#define LISTFONT_SIZE   0x02    /* Size is known */
  6475. +
  6476. +/********************************************************/
  6477. +/*                            */
  6478. +/* ÄwÆΦâpâ^ü[âôé╔êΩÆvé╖éΘâtâHâôâgû╝é≡âèâXâgé╔ë┴éªéΘ    */
  6479. +/*                            */
  6480. +/********************************************************/
  6481. +void list_one_font( pmd_fontlist *answer, PFONTMETRICS pfm,
  6482. +               int size, const UCHAR *pattern, int flags )
  6483. +{
  6484. +    ULONG    len ;
  6485. +    UCHAR    *p ;
  6486. +
  6487. +    if ( fontlist_used + 256 > fontlist_size ) {
  6488. +    fontlist_size += 0x10000 ;
  6489. +    p = MemAlloc( fontlist_size ) ;
  6490. +    memcpy( p, fontlist_buffer, fontlist_used ) ;
  6491. +    MemFree( fontlist_buffer ) ;
  6492. +    fontlist_buffer = p ;
  6493. +    }
  6494. +    p = fontlist_buffer + fontlist_used ;
  6495. +    len = sprintf( p+1, "%d", ( size + 5 ) / 10 ) ;
  6496. +    len += sprintf( p+1+len, ".%s", pfm->szFacename ) ;
  6497. +    if ( font_match( pattern, p + 1 ) ) {
  6498. +    *p = ( UCHAR )len ;
  6499. +    fontlist_used += 1 + len ;
  6500. +    ++answer->count ;
  6501. +    }
  6502. +}
  6503. +
  6504. +
  6505. +/********************************************************/
  6506. +/*                            */
  6507. +/* âpâ^ü[âôé╔êΩÆvé╖éΘæSé─é╠âtâHâôâgêΩùùé≡É╢ɼé╖éΘ    */
  6508. +/*                            */
  6509. +/********************************************************/
  6510. +void fontlist( const UCHAR *pattern )
  6511. +{
  6512. +    pmd_fontlist    answer ;
  6513. +    ULONG        fonts, temp, i ;
  6514. +    PFONTMETRICS    pfm ;
  6515. +    int            size, flags ;
  6516. +    FONTSPEC        spec ;
  6517. +
  6518. +    temp = 0 ;
  6519. +    fonts = GpiQueryFonts( PmHpsClient, QF_PUBLIC | QF_PRIVATE, NULL,
  6520. +               &temp, sizeof( FONTMETRICS ), NULL ) ;
  6521. +    pfm = MemAlloc( fonts * sizeof( FONTMETRICS ) ) ;
  6522. +    GpiQueryFonts( PmHpsClient, QF_PUBLIC | QF_PRIVATE, NULL,
  6523. +           &fonts, sizeof( FONTMETRICS ), pfm ) ;
  6524. +    answer.count = 0 ;
  6525. +    fontlist_used = 0 ;
  6526. +    flags = 0 ;
  6527. +    if ( parse_font_spec( &spec, pattern ) ) {
  6528. +    flags |= LISTFONT_SIZE ;
  6529. +    if ( strpbrk( spec.name, "?*" ) == NULL )
  6530. +        flags |= LISTFONT_NAME ;
  6531. +    }
  6532. +    for ( i = 0; i < fonts; ++i ) {
  6533. +    if ( !( pfm[i].fsType & FM_TYPE_FIXED ) )
  6534. +        continue ;
  6535. +#ifndef USE_OUTLINE_FONT
  6536. +    if ( pfm[i].fsDefn & FM_DEFN_OUTLINE )
  6537. +        continue ;
  6538. +#endif
  6539. +    if ( !( flags & LISTFONT_NAME ) ||
  6540. +        strcmp( pfm[i].szFacename, spec.name ) == 0 ) {
  6541. +#ifdef USE_OUTLINE_FONT
  6542. +        if ( pfm[i].fsDefn & FM_DEFN_OUTLINE )
  6543. +        list_one_font( &answer, pfm + i,
  6544. +                  0, pattern,
  6545. +                  flags ) ;
  6546. +        else
  6547. +#endif
  6548. +        list_one_font( &answer, pfm + i,
  6549. +                  pfm[i].sNominalPointSize, pattern,
  6550. +                  flags ) ;
  6551. +    }
  6552. +    }
  6553. +    answer.size = fontlist_used ;
  6554. +    SendOutdata( &answer, sizeof( answer ) ) ;
  6555. +    SendOutdata( fontlist_buffer, answer.size ) ;
  6556. +    MemFree( pfm ) ;
  6557. +    MemFree( fontlist_buffer ) ;
  6558. +    fontlist_buffer = NULL ;
  6559. +    fontlist_size = fontlist_used = 0 ;
  6560. +}
  6561. +
  6562. +/********************************************************/
  6563. +/*                            */
  6564. +/* âtâHâôâgé≡âVâXâeâÇé╔ôoÿ^é╖éΘ                */
  6565. +/*                            */
  6566. +/********************************************************/
  6567. +void setfont( const UCHAR *fontname )
  6568. +{
  6569. +    PmOldFont = PmFont ;
  6570. +    parse_font_spec( &PmFont, fontname ) ;
  6571. +    set_default_font( ) ;
  6572. +    set_cursor( ) ;
  6573. +    set_size( FALSE ) ;
  6574. +    WinInvalidateRect( PmHwndClient, NULL, FALSE ) ;
  6575. +}
  6576. +
  6577. +#define isKANJI(c) \
  6578. +  ((unsigned char)(c) & 0x80 \
  6579. +   && ((unsigned char)(c) < 0xA0 || (unsigned char)(c) >= 0xE0))
  6580. +
  6581. +#define    BASESPACE    3
  6582. +
  6583. +/********************************************************/
  6584. +/*                            */
  6585. +/* âtâ@âôâNâVâçâôâüâjâàü[ò\Īê╩Æué≡îvÄZé╖éΘ        */
  6586. +/*                            */
  6587. +/********************************************************/
  6588. +void compute_func_menu( void )
  6589. +{
  6590. +    int            total, onesize, spacesize ;
  6591. +    int            dispchar ;
  6592. +    int            lp ;
  6593. +    RECTL        rcl ;
  6594. +
  6595. +    /* âNâëâCâAâôâgâTâCâYé╔éµéΦüAì┼ôKë╗é╡é╜âüâjâàü[ê╩Æué≡îvÄZé╖éΘüB
  6596. +       12âtâ@âôâNâVâçâôò\Īé≡ìséñÅπé┼Æ[Éöâhâbâgé≡é┼é½éΘé╛é»ì┼ôKë╗é╡é╜
  6597. +       ê╩Æué╔ùêéΘéµéñé╔ö≈Æ▓É«é╖éΘüB*/
  6598. +    onesize = ( PmCxClient - BASESPACE * 15 ) / 12 ;
  6599. +    spacesize = ( PmCxClient - onesize * 12 ) / 15 ;
  6600. +    total = spacesize * 15 + onesize * 12 ;
  6601. +    dispchar = onesize / PmCxChar ;
  6602. +    PmFuncMenuCharOffset.x = ( onesize - ( dispchar -1 ) * PmCxChar ) / 2 ;
  6603. +
  6604. +    /* âtâ@âôâNâVâçâôò\Īâxü[âXì└òWé≡îvÄZé╖éΘ */
  6605. +    rcl.xLeft    = spacesize + ( PmCxClient - total ) / 2 ;
  6606. +    rcl.yBottom  = PmCyChar / 3 - 1 ;
  6607. +    rcl.yTop     = ( MAKE_Y( PmHeight - 1 ) - PmCyDesc ) - PmCyChar / 3 - 1 ;
  6608. +
  6609. +    PmFuncMenuCharOffset.y = ( (rcl.yTop-rcl.yBottom + 1)
  6610. +                  -( PmCyChar * ( PmFunctionRows -1) ) ) / 2;
  6611. +
  6612. +    /* âtâ@âôâNâVâçâôö╘ìåé╔ö║éñê╩Æué≡îvÄZé╖éΘ */
  6613. +    for ( lp = 0 ; lp < 12; ++lp ) {
  6614. +    rcl.xRight = rcl.xLeft + onesize - 1 ;
  6615. +    PmFuncMenuRect[lp] = rcl ;
  6616. +    rcl.xLeft += onesize + spacesize ;
  6617. +    if ( lp % 4 == 3 ) {
  6618. +        rcl.xLeft += spacesize ;
  6619. +    }
  6620. +    }
  6621. +}
  6622. +
  6623. +/********************************************************/
  6624. +/*                            */
  6625. +/* âtâ@âôâNâVâçâôâüâjâàü[é≡ò\Īé╖éΘ            */
  6626. +/*                            */
  6627. +/********************************************************/
  6628. +void display_func_menu( void )
  6629. +{
  6630. +    int            lp, len, lp2, kanji ;
  6631. +    POINTL        ptl ;
  6632. +    RECTL        rcl ;
  6633. +
  6634. +
  6635. +    if ( !PmFunctionKeyMenu )
  6636. +    return ;
  6637. +
  6638. +    if ( PmCursorOn )
  6639. +    WinShowCursor( PmHwndClient, FALSE ) ;
  6640. +
  6641. +    rcl.xLeft =
  6642. +    rcl.yBottom = 0 ;
  6643. +    rcl.xRight = PmCxClient ;
  6644. +    rcl.yTop = MAKE_Y( PmHeight - 1 ) - PmCyDesc - 1 ;
  6645. +    WinFillRect( PmHpsClient, &rcl, 0x00bfbfbf ) ;
  6646. +    GpiSetColor( PmHpsClient, 0x007f7f7f ) ;
  6647. +    ptl.x = rcl.xLeft + 1 ;
  6648. +    ptl.y = rcl.yBottom + 1 ;
  6649. +    GpiMove( PmHpsClient, &ptl ) ;
  6650. +    ptl.y = rcl.yTop - 2 ;
  6651. +    GpiLine( PmHpsClient, &ptl ) ;
  6652. +    ptl.x = rcl.xRight - 2 ;
  6653. +    GpiLine( PmHpsClient, &ptl ) ;
  6654. +    GpiSetColor( PmHpsClient, RGB_WHITE ) ;
  6655. +    ptl.y = rcl.yBottom + 1 ;
  6656. +    GpiLine( PmHpsClient, &ptl ) ;
  6657. +    ptl.x = rcl.xLeft + 2 ;
  6658. +    GpiLine( PmHpsClient, &ptl ) ;
  6659. +
  6660. +#if 0
  6661. +    GpiSetBackColor( PmHpsClient, PmHighlightBackcolor ) ;
  6662. +#endif
  6663. +    GpiSetBackColor( PmHpsClient, 0x00bfbfbf ) ;
  6664. +
  6665. +    for ( lp = 0 ; lp < 12; ++lp ) {
  6666. +    GpiSetColor( PmHpsClient, RGB_WHITE ) ;
  6667. +    ptl.x = PmFuncMenuRect[lp].xLeft ;
  6668. +    ptl.y = PmFuncMenuRect[lp].yBottom ;
  6669. +    GpiMove( PmHpsClient, &ptl ) ;
  6670. +    ptl.y = PmFuncMenuRect[lp].yTop ;
  6671. +    GpiLine( PmHpsClient, &ptl ) ;
  6672. +    ptl.x = PmFuncMenuRect[lp].xRight ;
  6673. +    GpiLine( PmHpsClient, &ptl ) ;
  6674. +    GpiSetColor( PmHpsClient, 0x007f7f7f ) ;
  6675. +    ptl.y = PmFuncMenuRect[lp].yBottom ;
  6676. +    GpiLine( PmHpsClient, &ptl ) ;
  6677. +    ptl.x = PmFuncMenuRect[lp].xLeft + 1 ;
  6678. +    GpiLine( PmHpsClient, &ptl ) ;
  6679. +
  6680. +#if 0
  6681. +    GpiSetColor( PmHpsClient, PmHighlightColor ) ;
  6682. +#endif
  6683. +    GpiSetColor( PmHpsClient, RGB_BLACK ) ;
  6684. +
  6685. +    rcl = PmFuncMenuRect[lp] ;
  6686. +    rcl.xRight  -= PmFuncMenuCharOffset.x ;
  6687. +    rcl.yBottom += 1 ;
  6688. +    rcl.yTop    -= 1 ;
  6689. +
  6690. +    ptl.x = rcl.xLeft + PmFuncMenuCharOffset.x ;
  6691. +    ptl.y = rcl.yBottom + PmCyChar * ( PmFunctionRows - 2 )
  6692. +        + PmFuncMenuCharOffset.y + PmCyDesc;
  6693. +
  6694. +    GpiCharStringPosAt( PmHpsClient, &ptl, &rcl,
  6695. +               CHS_CLIP,
  6696. +               strlen( PmFuncMenuData[lp] ),
  6697. +               PmFuncMenuData[lp],
  6698. +               NULL ) ;
  6699. +    }
  6700. +    if ( PmCursorOn )
  6701. +    WinShowCursor( PmHwndClient, TRUE ) ;
  6702. +}
  6703. +
  6704. +/********************************************************/
  6705. +/*                            */
  6706. +/* û{æ╠Muleé⌐éτé╠âCâxâôâgé≡ô╟é▌ì₧é▐            */
  6707. +/*                            */
  6708. +/********************************************************/
  6709. +void pipe_thread( ULONG arg )
  6710. +{
  6711. +    HMQ            hmq ;
  6712. +    POINTL        ptl, aptl[3] ;
  6713. +    RECTL        rcl, rcl2 ;
  6714. +    COLOR        foreground, background;
  6715. +    pm_request        pmr ;
  6716. +    pm_event        pme ;
  6717. +    MENUDATA         md ;
  6718. +    char        buf[512], *p ;
  6719. +    pm_popup_menu    popupmenu ;
  6720. +
  6721. +
  6722. +    hmq = WinCreateMsgQueue( hab, 0 ) ;
  6723. +    for (;;) {
  6724. +    receive( &pmr, sizeof( pmr ) ) ;
  6725. +#ifdef REC_DEBUG
  6726. +    sprintf( buf, "PMR %s", pmr_msg[pmr.header.type] ) ;
  6727. +    WinMessageBox( HWND_DESKTOP, HWND_DESKTOP, buf, "debug", 0,
  6728. +               MB_MOVEABLE | MB_OK | MB_ICONEXCLAMATION ) ;
  6729. +#endif
  6730. +    switch ( pmr.header.type ) {
  6731. +        case PMR_DESTROY:
  6732. +        terminating = TRUE ;
  6733. +        WinPostMsg( PmHwndClient, WM_CLOSE, 0L, 0L ) ;
  6734. +        DosExit( EXIT_THREAD, 0 ) ;
  6735. +
  6736. +        case PMR_CURSOR:
  6737. +        /* Turn on or off cursor ; change cursor position. */
  6738. +
  6739. +        PmCursorX = MAKE_X( pmr.cursor.x ) ;
  6740. +        PmCursorY = MAKE_Y( pmr.cursor.y ) - PmCyDesc ;
  6741. +        PmCursorOn = pmr.cursor.on ;
  6742. +
  6743. +        if ( PmHwndClient == WinQueryFocus( HWND_DESKTOP ) ) {
  6744. +        if ( PmCursorOn )
  6745. +            create_cursor( pmr.cursor.size ) ;
  6746. +        else
  6747. +            WinDestroyCursor( PmHwndClient ) ;
  6748. +            }
  6749. +
  6750. +        /* ô·û{îΩôⁿù═PecicâEâBâôâhâEéαê┌ô«é╖éΘ */
  6751. +        PecicMoveWindow( ) ;
  6752. +        break ;
  6753. +
  6754. +        case PMR_OUTCHARS:
  6755. +        receive( buf, pmr.outchars.count ) ;
  6756. +        if ( pmr.outchars.y >= PmHeight )
  6757. +        break ;
  6758. +
  6759. +        if ( PmCursorOn )
  6760. +        WinShowCursor( PmHwndClient, FALSE ) ;
  6761. +
  6762. +        ptl.x = MAKE_X( pmr.outchars.x ) ;
  6763. +        ptl.y = MAKE_Y( pmr.outchars.y ) ;
  6764. +
  6765. +        if ( pmr.outchars.highlight ) {
  6766. +        GpiSetColor( PmHpsClient, PmHighlightColor ) ;
  6767. +        GpiSetBackColor( PmHpsClient, PmHighlightBackcolor ) ;
  6768. +        } else {
  6769. +        GpiSetColor( PmHpsClient, PmCurrentColor ) ;
  6770. +        GpiSetBackColor( PmHpsClient, PmCurrentBackcolor ) ;
  6771. +        }
  6772. +#ifdef USE_OUTLINE_FONT
  6773. +        if ( PmOutline ) {
  6774. +        rcl.xLeft   = ptl.x ;
  6775. +        rcl.yBottom = ptl.y - PmCyDesc ;
  6776. +        rcl.xRight  = rcl.xLeft + pmr.outchars.count * PmCxChar ;
  6777. +        rcl.yTop    = rcl.yBottom + PmCyChar - 1 ;
  6778. +        WinFillRect( PmHpsClient, &rcl, PmCurrentBackcolor ) ;
  6779. +        --rcl.xRight ; --rcl.yTop ;
  6780. +        GpiCharStringPosAt( PmHpsClient, &ptl, &rcl,
  6781. +                   CHS_CLIP,
  6782. +                   pmr.outchars.count, buf,
  6783. +                   NULL ) ;
  6784. +        } else
  6785. +#endif
  6786. +        {
  6787. +            GpiCharStringAt( PmHpsClient, &ptl,
  6788. +                pmr.outchars.count, buf ) ;
  6789. +        }
  6790. +
  6791. +        if ( PmCursorOn )
  6792. +        WinShowCursor( PmHwndClient, TRUE ) ;
  6793. +        break ;
  6794. +
  6795. +        case PMR_CLEAR:
  6796. +        if ( PmCursorOn )
  6797. +        WinShowCursor( PmHwndClient, FALSE ) ;
  6798. +
  6799. +        rcl.xLeft = 0 ;
  6800. +        if ( PmFunctionKeyMenu )
  6801. +        rcl.yBottom = MAKE_Y( PmHeight - 1 ) - PmCyDesc ;
  6802. +        else
  6803. +        rcl.yBottom = 0 ;
  6804. +        rcl.xRight  = PmCxClient ;
  6805. +        rcl.yTop    = PmCyClient ;
  6806. +        WinFillRect( PmHpsClient, &rcl, PmCurrentBackcolor ) ;
  6807. +        if ( PmCursorOn )
  6808. +        WinShowCursor( PmHwndClient, TRUE ) ;
  6809. +        break ;
  6810. +
  6811. +        case PMR_CLREOL:
  6812. +        if ( PmCursorOn )
  6813. +        WinShowCursor( PmHwndClient, FALSE ) ;
  6814. +
  6815. +        rcl.xLeft = MAKE_X( pmr.clreol.x0 ) ;
  6816. +        rcl.xRight = MAKE_X( pmr.clreol.x1 ) ;
  6817. +        rcl.yBottom = MAKE_Y( pmr.clreol.y ) - PmCyDesc ;
  6818. +        rcl.yTop = rcl.yBottom + PmCyChar ;
  6819. +        WinFillRect( PmHpsClient, &rcl, PmCurrentBackcolor ) ;
  6820. +        if ( PmCursorOn )
  6821. +        WinShowCursor( PmHwndClient, TRUE ) ;
  6822. +        break ;
  6823. +
  6824. +        case PMR_LINES:
  6825. +        if ( PmCursorOn )
  6826. +        WinShowCursor( PmHwndClient, FALSE ) ;
  6827. +
  6828. +        aptl[0].x = aptl[2].x = rcl.xLeft = 0 ;
  6829. +        aptl[1].x  = rcl.xRight = PmCxClient ;
  6830. +        if ( pmr.lines.count > 0 ) {
  6831. +        aptl[0].y = MAKE_Y( pmr.lines.max_y ) ;
  6832. +        aptl[1].y = MAKE_Y( pmr.lines.y + pmr.lines.count ) ;
  6833. +        aptl[2].y = MAKE_Y( pmr.lines.max_y - pmr.lines.count ) ;
  6834. +        rcl.yBottom = MAKE_Y( pmr.lines.y + pmr.lines.count ) ;
  6835. +        rcl.yTop = MAKE_Y( pmr.lines.y ) ;
  6836. +            } else {
  6837. +        aptl[0].y = MAKE_Y( pmr.lines.max_y + pmr.lines.count ) ;
  6838. +        aptl[1].y = MAKE_Y( pmr.lines.y ) ;
  6839. +        aptl[2].y = MAKE_Y( pmr.lines.max_y ) ;
  6840. +        rcl.yBottom = MAKE_Y( pmr.lines.y ) ;
  6841. +        rcl.yTop = MAKE_Y( pmr.lines.max_y + pmr.lines.count ) ;
  6842. +            }{
  6843. +        int    tmp = PmCyChar - PmCyDesc ;
  6844. +        aptl[0].y += tmp ;
  6845. +        aptl[1].y += tmp ;
  6846. +        aptl[2].y += tmp ;
  6847. +        rcl.yBottom += tmp ;
  6848. +        rcl.yTop += tmp ;
  6849. +        }
  6850. +        GpiBitBlt( PmHpsClient, PmHpsClient,
  6851. +              3, aptl, ROP_SRCCOPY, BBO_IGNORE ) ;
  6852. +
  6853. +        /* Clear the lines uncovered. */
  6854. +
  6855. +        WinFillRect( PmHpsClient, &rcl, PmCurrentBackcolor ) ;
  6856. +        if ( PmCursorOn )
  6857. +        WinShowCursor( PmHwndClient, TRUE ) ;
  6858. +        break ;
  6859. +
  6860. +        case PMR_BELL:
  6861. +        if ( pmr.bell.visible ) {
  6862. +        rcl.xLeft   =
  6863. +        rcl.yBottom = 0 ;
  6864. +        rcl.xRight  = PmCxClient ;
  6865. +        rcl.yTop    = PmCyClient ;
  6866. +        WinInvertRect( PmHpsClient, &rcl ) ;
  6867. +        DosSleep( 100 ) ;
  6868. +        WinInvertRect( PmHpsClient, &rcl ) ;
  6869. +            } else
  6870. +        WinAlarm( HWND_DESKTOP, WA_WARNING ) ;
  6871. +        break ;
  6872. +
  6873. +        case PMR_POPUPMENU:
  6874. +        receive( &popupmenu, sizeof( popupmenu ) ) ;
  6875. +        if ( popupmenu.size <= sizeof( buf ) )
  6876. +        p = buf ;
  6877. +        else
  6878. +        p = MemAlloc( popupmenu.size ) ;
  6879. +        receive( p, popupmenu.size ) ;
  6880. +        md.panes = popupmenu.panes ;
  6881. +        md.lines = popupmenu.lines ;
  6882. +        md.button = popupmenu.button ;
  6883. +#ifdef POPUPMENUCHARPOS
  6884. +        md.x = MAKE_X( popupmenu.x ) ;
  6885. +        md.y = MAKE_Y( popupmenu.y ) ;
  6886. +#else
  6887. +        WinQueryPointerPos( HWND_DESKTOP, &ptl ) ;
  6888. +        WinMapWindowPoints( HWND_DESKTOP, PmHwndClient, &ptl, 1 ) ;
  6889. +        md.x = ( int )ptl.x ;
  6890. +        md.y = ( int )(ptl.y + cyMenu / 2 ) ;
  6891. +#endif
  6892. +        md.data = p ;
  6893. +        md.title_size = popupmenu.title_size ;
  6894. +        WinSendMsg (PmHwndClient, UWM_POPUPMENU, 0L, MPFROMP( &md ) ) ;
  6895. +        if ( p != buf )
  6896. +        MemFree( p ) ;
  6897. +        break ;
  6898. +
  6899. +        case PMR_POPUPMENUDESTROY:
  6900. +        {
  6901. +        int        lp ;
  6902. +
  6903. +        for ( lp = PmPopupMenuMax -1; lp >= PmPopupMenuMin; --lp ) {
  6904. +            WinSendMsg( PmHwndPopupMenu, MM_DELETEITEM,
  6905. +                   MPFROM2SHORT( lp, TRUE ), NULL ) ;
  6906. +        }
  6907. +        for ( lp=PmPopupSubMenuMax -1; lp >= PmPopupSubMenuMin; --lp ){
  6908. +            WinSendMsg( PmHwndPopupMenu, MM_DELETEITEM,
  6909. +                   MPFROM2SHORT( lp, TRUE ), NULL ) ;
  6910. +        }
  6911. +        }
  6912. +
  6913. +        MemFree( PmPopupMenuItems ) ;
  6914. +        PmPopupMenuItems = NULL ;
  6915. +        WinDestroyWindow( PmHwndPopupMenu ) ;
  6916. +        PmHwndPopupMenu = NULLHANDLE ;
  6917. +        break ;
  6918. +
  6919. +        case PMR_PASTE:
  6920. +        get_clipboard( pmr.paste.get_text ) ;
  6921. +        break ;
  6922. +
  6923. +        case PMR_CUT:
  6924. +        put_clipboard( pmr.cut.size ) ;
  6925. +        break ;
  6926. +
  6927. +        case PMR_QUITCHAR:
  6928. +        QuitChar = pmr.quitchar.quitchar ;
  6929. +        break ;
  6930. +
  6931. +        case PMR_TITLENAME:
  6932. +        receive( buf, pmr.titlename.count ) ;
  6933. +        buf[pmr.titlename.count] = 0 ;
  6934. +        WinSetWindowText( PmHwndFrame, buf ) ;
  6935. +        break ;
  6936. +
  6937. +        case PMR_SETSIZE:
  6938. +        PmWidth = pmr.setsize.width ;
  6939. +        PmHeight = pmr.setsize.height ;
  6940. +        set_size( FALSE ) ;
  6941. +        break ;
  6942. +
  6943. +        case PMR_SETPOS:
  6944. +        set_pos( pmr.setpos.left, pmr.setpos.top ) ;
  6945. +        break ;
  6946. +
  6947. +    case PMR_SETCOLOR:
  6948. +        if ( pmr.setcolor.fore != COLOR_NONE )
  6949. +        PmCurrentColor = pmr.setcolor.fore ;
  6950. +        if ( pmr.setcolor.back != COLOR_NONE )
  6951. +        PmCurrentBackcolor = pmr.setcolor.back ;
  6952. +        WinInvalidateRect( PmHwndClient, NULL, FALSE ) ;
  6953. +        break ;
  6954. +
  6955. +    case PMR_SETHICOLOR:
  6956. +        if ( pmr.setcolor.fore != COLOR_NONE )
  6957. +        PmHighlightColor = pmr.setcolor.fore ;
  6958. +        if ( pmr.setcolor.back != COLOR_NONE )
  6959. +        PmHighlightBackcolor = pmr.setcolor.back ;
  6960. +        WinInvalidateRect( PmHwndClient, NULL, FALSE ) ;
  6961. +        break ;
  6962. +
  6963. +    case PMR_CURSORTYPE:
  6964. +        if ( pmr.cursortype.type != 0 )
  6965. +        PmCursorType = pmr.cursortype.type ;
  6966. +        if ( pmr.cursortype.blink != 0 )
  6967. +        PmCursorBlink = ( pmr.cursortype.blink == PMR_TRUE ) ;
  6968. +        break ;
  6969. +
  6970. +    case PMR_SHORTCUT:
  6971. +        if ( pmr.shortcut.shortcut != 0 )
  6972. +        PmDisableShortcuts
  6973. +            = (pmr.shortcut.shortcut == PMR_TRUE) ;
  6974. +        break ;
  6975. +
  6976. +    case PMR_MOUSE:
  6977. +        PmButtons[0] = CONV_BUTTON( pmr.mouse.button[0] ) ;
  6978. +        PmButtons[1] = CONV_BUTTON( pmr.mouse.button[1] ) ;
  6979. +        PmButtons[2] = CONV_BUTTON( pmr.mouse.button[2] ) ;
  6980. +        break ;
  6981. +
  6982. +        case PMR_SETFONT:
  6983. +        receive( buf, pmr.setfont.fontname_length ) ;
  6984. +        buf[pmr.setfont.fontname_length] = 0 ;
  6985. +        setfont( buf ) ;
  6986. +        break ;
  6987. +
  6988. +    case PMR_FUNCMENU:
  6989. +        if ( pmr.funcmenu.display == PMR_TRUE ) {
  6990. +        if ( PmFunctionKeyMenu )
  6991. +            break ;
  6992. +        PmFunctionKeyMenu = TRUE ;
  6993. +        PmHeight -= PmFunctionRows ;
  6994. +        if ( PmHeight < 1 ) PmHeight = PmFunctionRows + 1 ;
  6995. +        } else {
  6996. +        if ( !PmFunctionKeyMenu )
  6997. +            break ;
  6998. +        PmFunctionKeyMenu = FALSE ;
  6999. +        PmHeight += PmFunctionRows ;
  7000. +        }        
  7001. +        pme.size.header.type = PME_SIZE ;
  7002. +        pme.size.width = PmWidth ;
  7003. +        pme.size.height = PmHeight ;
  7004. +        SendEvent( &pme ) ;
  7005. +
  7006. +        compute_func_menu( ) ;
  7007. +        display_func_menu( ) ;
  7008. +
  7009. +        break ;
  7010. +
  7011. +    case PMR_FUNCMENUMSG:
  7012. +        receive( buf, pmr.funcmenumsg.funcmenu_length ) ;
  7013. +        buf[pmr.funcmenumsg.funcmenu_length] = 0 ;
  7014. +        {
  7015. +        int    lp = 0, rows ;
  7016. +        UCHAR    *pnt = buf;
  7017. +        UCHAR    tmpbuf[64], *ptmp ;
  7018. +
  7019. +        ptmp = tmpbuf ;
  7020. +        rows = 2 ;
  7021. +        while ( lp < 12 ) {
  7022. +            if ( *pnt == '\r' ) {
  7023. +#ifdef MULTILINE
  7024. +            if ( ++rows > PmFunctionRows )
  7025. +                PmFunctionRows = rows ;
  7026. +#endif
  7027. +            ++pnt ;
  7028. +            continue ;
  7029. +            }
  7030. +            if ( *pnt == '\t' || *pnt == '\0' ) {
  7031. +            *ptmp = '\0' ;
  7032. +            MemFree( PmFuncMenuData[lp] ) ;
  7033. +            PmFuncMenuData[lp] = MemAlloc( strlen( tmpbuf ) + 1 ) ;
  7034. +            strcpy( PmFuncMenuData[lp], tmpbuf ) ;
  7035. +            ++lp ;
  7036. +            ++pnt ;
  7037. +            ptmp = tmpbuf ;
  7038. +            rows = 2 ;
  7039. +            continue ;
  7040. +            }
  7041. +            *ptmp++ = *pnt++ ;
  7042. +        }
  7043. +        compute_func_menu( ) ;
  7044. +        display_func_menu( ) ;
  7045. +        }
  7046. +        break ;
  7047. +
  7048. +        case PMR_FONTLIST:
  7049. +        receive( buf, pmr.fontlist.pattern_length ) ;
  7050. +        buf[pmr.fontlist.pattern_length] = 0 ;
  7051. +        fontlist( buf ) ;
  7052. +        break ;
  7053. +
  7054. +        case PMR_CONFIG:
  7055. +        get_config( ) ;
  7056. +        break ;
  7057. +
  7058. +        case PMR_MOUSEPOS:
  7059. +        get_mousepos( ) ;
  7060. +        break ;
  7061. +
  7062. +        case PMR_SUSPEND:
  7063. +        /* PMö┼é┼é═î╗ì▌éµéóò√û@é¬û│éóé╠é┼âTâXâyâôâhé═é┼é½é╚éó */
  7064. +        break ;
  7065. +
  7066. +        case PMR_PAINTEND:
  7067. +        {
  7068. +        int    lp ;
  7069. +        for ( lp = 0; lp < PecicComputeWindow( ); ++lp )
  7070. +            WinInvalidateRect( Pecic[lp].Client, NULL, FALSE ) ;
  7071. +        }
  7072. +        break ;
  7073. +        default:
  7074. +        error( "Unknown message type" ) ;
  7075. +        }
  7076. +    }
  7077. +}
  7078. +
  7079. +/********************************************************/
  7080. +/*                            */
  7081. +/* PM Muleôαé╠Åëè·ë╗                    */
  7082. +/*                            */
  7083. +/********************************************************/
  7084. +void initialize( void )
  7085. +{
  7086. +    int        lp, len ;
  7087. +
  7088. +    /* Obtain the height of the menu. */
  7089. +    cyMenu = WinQuerySysValue( HWND_DESKTOP, SV_CYMENU ) ;
  7090. +    cxBorder = WinQuerySysValue( HWND_DESKTOP, SV_CXBORDER ) ;
  7091. +    cyBorder = WinQuerySysValue( HWND_DESKTOP, SV_CYBORDER ) ;
  7092. +    cxSizeBorder = WinQuerySysValue( HWND_DESKTOP, SV_CXSIZEBORDER ) ;
  7093. +
  7094. +    /* Obtain the size of the screen. */
  7095. +    WinQueryWindowPos( HWND_DESKTOP, &swpScreen ) ;
  7096. +
  7097. +    /* âEâBâôâhâEèεû{âRâôâgâìü[âïÉ▌ÆΦ */
  7098. +    PmWidth = 80 ;
  7099. +    PmHeight = 25 ;
  7100. +    PmCurrentColor = RGB_BLACK ;
  7101. +    PmCurrentBackcolor = RGB_WHITE ;
  7102. +    PmHighlightColor = RGB_WHITE ;
  7103. +    PmHighlightBackcolor = RGB_BLUE ;
  7104. +    PmCursorOn = FALSE ;
  7105. +    PmCursorType = CURSORTYPE_BOX ;
  7106. +    PmCursorBlink = TRUE ;
  7107. +    PmDisableShortcuts = FALSE ;
  7108. +    PmPopupMenuItems = NULL ;
  7109. +    PmCursorX =
  7110. +    PmCursorY =
  7111. +    PmPopupMenuMin =
  7112. +    PmPopupMenuMax =
  7113. +    PmCxChar =
  7114. +    PmCyChar = 0 ;
  7115. +    PmButtons[0] = 1 ;
  7116. +    PmButtons[1] = 3 ;
  7117. +    PmButtons[2] = 2 ;
  7118. +    PmFunctionKeyMenu = FALSE ;
  7119. +    PmFunctionRows = 2 ;
  7120. +
  7121. +    for ( lp = 0; lp < 12; ++lp ) {
  7122. +    len = strlen( FuncDefMenu[lp] ) ;
  7123. +    PmFuncMenuData[lp] = MemAlloc( len + 1 ) ;
  7124. +    strcpy( PmFuncMenuData[lp], FuncDefMenu[lp] ) ;
  7125. +    }
  7126. +    *PecicText = '\0' ;
  7127. +}
  7128. +
  7129. +/********************************************************/
  7130. +/*                            */
  7131. +/* ô·û{îΩôⁿù═âEâBâôâhâEé≡É╢ɼé╖éΘ            */
  7132. +/*                            */
  7133. +/********************************************************/
  7134. +void PecicCreateWindow( void )
  7135. +{
  7136. +    ULONG    flFrameFlags = FCF_BORDER | FCF_NOBYTEALIGN ;
  7137. +    HWND    frame, client ;
  7138. +
  7139. +    frame = WinCreateStdWindow( PmHwndFrame
  7140. +                   , WS_DISABLED
  7141. +                   , &flFrameFlags
  7142. +                   , szPecicClientClass
  7143. +                   , "pecic"
  7144. +                   , 0L
  7145. +                   , 0, 0
  7146. +                   , &client
  7147. +                   ) ;
  7148. +
  7149. +    WinSetWindowPos( frame, HWND_TOP,
  7150. +            0, 0, 0, 0,
  7151. +            SWP_SIZE | SWP_MOVE |
  7152. +            SWP_SHOW | SWP_ZORDER ) ;
  7153. +    Pecic[PecicWndCount].Frame = frame ;
  7154. +    Pecic[PecicWndCount].Client = client ;
  7155. +    ++PecicWndCount ;
  7156. +}
  7157. +
  7158. +/********************************************************/
  7159. +/*                            */
  7160. +/* ô·û{îΩôⁿù═âEâBâôâhâEé≡öjèⁿé╖éΘ            */
  7161. +/*                            */
  7162. +/********************************************************/
  7163. +void PecicDestroyWindow( void )
  7164. +{
  7165. +    int        lp ;
  7166. +
  7167. +    for ( lp = 0; lp < PecicWndCount; ++lp )
  7168. +    WinDestroyWindow( Pecic[lp].Frame ) ;
  7169. +    PecicWndCount = 0 ;
  7170. +}
  7171. +
  7172. +/********************************************************/
  7173. +/*                            */
  7174. +/* ô·û{îΩôⁿù═âEâBâôâhâEé╠ò\Īê╩Æué≡îvÄZé╖éΘ        */
  7175. +/*                            */
  7176. +/********************************************************/
  7177. +int PecicComputeWindow( void )
  7178. +{
  7179. +    int        startx ;
  7180. +    int        wnds ;
  7181. +    int        pos, offset, len ;
  7182. +
  7183. +    /* â}âïâ`âEâBâôâhâEâüâbâZü[âWÆ╖Åëè·ë╗ */
  7184. +    for ( pos = 0; pos < PecicWndCount; ++pos )
  7185. +    Pecic[pos].Len = -1 ;
  7186. +
  7187. +    if ( !PecicLength )
  7188. +    return 0 ;
  7189. +
  7190. +    PecicCurBase = -1 ;
  7191. +    startx = PmCursorX / PmCxChar ;
  7192. +    wnds = len = Pecic[0].Start = 0 ;
  7193. +    for ( pos = 0; pos < PecicLength -1; ) {
  7194. +    if ( isKANJI( PecicText[pos] ) ) {
  7195. +        offset = 2 ;
  7196. +    } else
  7197. +        offset = 1 ;
  7198. +    if ( ( startx + offset ) > PmWidth ) {
  7199. +        /* ò\Īù╠êµé≡ëzéªé╜ */
  7200. +        Pecic[wnds].Len = len ;
  7201. +        ++wnds ;
  7202. +        Pecic[wnds].Start = pos ;
  7203. +        startx = len = 0 ;
  7204. +    }
  7205. +    /* Æìû┌ê╩Æué¬âJü[â\âïê╩Æué╞ô»é╢ÅΩìçé═âJü[â\âïê╩Æuâfü[â^é≡É▌ÆΦ */
  7206. +    if ( pos == PecicCurPos ) {
  7207. +        PecicCurBase   = wnds ;
  7208. +        PecicCurOffset = len ;
  7209. +    }
  7210. +    pos += offset ;
  7211. +    startx += offset ;
  7212. +    len += offset ;
  7213. +    Pecic[wnds].Len = len ;
  7214. +    }
  7215. +
  7216. +    /* âJü[â\âïé¬ì┼îπé╔ùLéΘÅΩìç */
  7217. +    if ( PecicCurBase == -1 ) {
  7218. +    PecicCurBase   = wnds ;
  7219. +    PecicCurOffset = len ;
  7220. +    }    
  7221. +    if ( wnds + 1 > PecicWndCount ) {
  7222. +    /* î╗ì▌É╢ɼé│éΩé─éóéΘâEâBâôâhâEÉöé≡ëzéªé╜ÅΩìçé═üAëzéªé╜ò¬é≡
  7223. +       é▒é▒é┼É╢ɼé╖éΘüB*/
  7224. +    for ( pos = PecicWndCount; pos <= wnds; ++pos )
  7225. +        PecicCreateWindow( ) ;
  7226. +    }
  7227. +    return ( wnds + 1 ) ;
  7228. +}
  7229. +
  7230. +/********************************************************/
  7231. +/*                            */
  7232. +/* ô·û{îΩôⁿù═âEâBâôâhâEé≡îƒì⌡é╖éΘ            */
  7233. +/*                            */
  7234. +/********************************************************/
  7235. +int PecicSearchWindow( HWND hwnd )
  7236. +{
  7237. +    int        lp ;
  7238. +
  7239. +    for ( lp = 0; lp < PecicWndCount; ++lp ) {
  7240. +    if ( Pecic[lp].Client == hwnd )
  7241. +        return lp ;
  7242. +    }
  7243. +}
  7244. +
  7245. +/********************************************************/
  7246. +/*                            */
  7247. +/* ô·û{îΩôⁿù═âEâBâôâhâEâNâëâCâAâôâgâüâCâôÅêù¥        */
  7248. +/*                            */
  7249. +/********************************************************/
  7250. +MRESULT PecicClientWndProc( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2 )
  7251. +{
  7252. +    HPS        hps ;
  7253. +    HDC        hdc ;
  7254. +    RECTL    rcl ;
  7255. +    POINTL    ptl ;
  7256. +    SIZEL    sizel ;
  7257. +#ifdef USE_OUTLINE_FONT
  7258. +    USHORT    size ;
  7259. +    FIXED    font_cbox ;
  7260. +    SIZEF    cbox ;
  7261. +#endif
  7262. +
  7263. +    int        wnd ;
  7264. +    PUCHAR    Text ;
  7265. +    PUCHAR    Attr ;
  7266. +    int        dsplen ;
  7267. +    USHORT    hi, low ;
  7268. +
  7269. +    switch ( msg ) {
  7270. +    case WM_CREATE:
  7271. +    hdc = WinOpenWindowDC( hwnd ) ;
  7272. +    sizel.cx = sizel.cy = 0 ;
  7273. +    hps = GpiCreatePS( hab, hdc, &sizel,
  7274. +              PU_PELS | GPIT_MICRO | GPIA_ASSOC ) ;
  7275. +    GpiSetBackMix( hps, BM_OVERPAINT ) ;
  7276. +    GpiCreateLogColorTable( hps, LCOL_PURECOLOR, LCOLF_RGB,
  7277. +                0, 0, NULL ) ;
  7278. +
  7279. +    GpiCreateLogFont( hps, NULL, SELECT_FONT_ID, &NowFontAttrs ) ;
  7280. +    GpiSetCharSet( hps, SELECT_FONT_ID ) ;
  7281. +#ifdef USE_OUTLINE_FONT
  7282. +    if ( PmOutline ) {
  7283. +        size = ( USHORT )( ( double )PmFont.size * ( double )cxRes
  7284. +                  / 720.0 + 0.5 ) ;
  7285. +        font_cbox = MAKEFIXED( size, 0 ) ;
  7286. +        cbox.cx = cbox.cy = font_cbox ;
  7287. +        GpiSetCharBox( hps, &cbox ) ;
  7288. +    }
  7289. +#endif
  7290. +    Pecic[PecicWndCount].Ps = hps ;
  7291. +    return 0 ;
  7292. +
  7293. +    case WM_DESTROY:
  7294. +    GpiDestroyPS( Pecic[PecicSearchWindow( hwnd )].Ps ) ;
  7295. +    break ;
  7296. +
  7297. +    case WM_PAINT:
  7298. +    wnd = PecicSearchWindow( hwnd ) ;
  7299. +    hps = WinBeginPaint( hwnd, Pecic[wnd].Ps, &rcl ) ;
  7300. +    Text = &PecicText[Pecic[wnd].Start] ;
  7301. +    Attr = &PecicAttr[Pecic[wnd].Start] ;
  7302. +    dsplen = Pecic[wnd].Len ;
  7303. +    ptl.x = 0 ;
  7304. +    ptl.y = PmCyDesc ;
  7305. +    GpiMove( hps, &ptl ) ;
  7306. +    while ( dsplen ) {
  7307. +        if ( *Attr & 1 ) {
  7308. +        GpiSetColor( hps, RGB_BLACK ) ;
  7309. +        GpiSetBackColor( hps, RGB_YELLOW );
  7310. +        } else {
  7311. +        GpiSetColor( hps, RGB_WHITE ) ;
  7312. +        GpiSetBackColor( hps, RGB_BLUE );
  7313. +        }
  7314. +        if ( isKANJI( *Text ) ) {
  7315. +        GpiCharString( hps, 2L, Text ) ;
  7316. +        dsplen -= 2 ;
  7317. +        Text += 2 ;
  7318. +        Attr += 2 ;
  7319. +        } else {
  7320. +        GpiCharString( hps, 1L, Text ) ;
  7321. +        --dsplen ;
  7322. +        ++Text ;
  7323. +        ++Attr ;
  7324. +        }
  7325. +    }
  7326. +    WinEndPaint( hps ) ;
  7327. +
  7328. +    if ( PecicCurBase == wnd ) {
  7329. +        /* âJü[â\âïê╩Æuö╜ô] */
  7330. +        rcl.yBottom = 0L ;
  7331. +        if ( PecicCurType )
  7332. +        rcl.yTop = PmCyChar / 2 ;
  7333. +        else
  7334. +        rcl.yTop = PmCyChar / 4 ;
  7335. +        rcl.xLeft  = PecicCurOffset * PmCxChar ;
  7336. +        rcl.xRight = rcl.xLeft + PmCxChar ; 
  7337. +        if ( isKANJI( PecicText[PecicCurPos] ) )
  7338. +        rcl.xRight += PmCxChar ;
  7339. +
  7340. +        /* âJü[â\âïé¬ì┼îπé╔éáéΘÅΩìçé═Å¡é╡û▀é╖ */
  7341. +        if ( PecicLength - 1 == PecicCurPos )
  7342. +        rcl.xLeft  -= PmCxChar / 3 ;
  7343. +        WinInvertRect( Pecic[wnd].Ps, &rcl ) ;
  7344. +    }
  7345. +    return 0 ;
  7346. +    case WM_QUERYFOCUSCHAIN:
  7347. +    return NULL ;
  7348. +
  7349. +    case WM_SETFOCUS:
  7350. +    WinSetFocus( HWND_DESKTOP, PmHwndClient ) ;
  7351. +    break ;
  7352. +    }
  7353. +    return WinDefWindowProc( hwnd, msg, mp1, mp2 ) ;
  7354. +}
  7355. +
  7356. +/********************************************************/
  7357. +/*                            */
  7358. +/* ô·û{îΩâEâBâôâhâEò\Īê╩Æué≡âJü[â\âïê╩Æué⌐éτîvÄZ    */
  7359. +/*                            */
  7360. +/********************************************************/
  7361. +void ConvPecicPos( PPOINTL ptl )
  7362. +{
  7363. +    ptl->x = PmCursorX - cxBorder ;
  7364. +    ptl->y = PmCursorY - cyBorder ;
  7365. +    WinMapWindowPoints( PmHwndClient, PmHwndFrame, ptl, 1 ) ;
  7366. +}
  7367. +
  7368. +/********************************************************/
  7369. +/*                            */
  7370. +/* ô·û{îΩôⁿù═âEâBâôâhâEé≡ê┌ô«é╖éΘ            */
  7371. +/*                            */
  7372. +/********************************************************/
  7373. +void PecicMoveWindow( void )
  7374. +{
  7375. +    SWP        swp[32] ;
  7376. +    POINTL    ptl ;
  7377. +    int        lp ;
  7378. +
  7379. +    /* âfü[â^é╠ùLéΘû│é╡è╓îWé╚é¡æSé─é╠âEâBâôâhâEé≡ê┌ô«é╖éΘüB
  7380. +       âfü[â^é¬æ╢ì▌é╡é╚éóâEâBâôâhâEé═cxâUâCâYé¬0ê╚ë║é╞é╚éΦÄ⌐ô«ôIé╔
  7381. +       ö±ò\Īé╞é╚éΘüB*/
  7382. +    ConvPecicPos( &ptl ) ;
  7383. +    for ( lp = 0; lp < PecicWndCount; ++lp ) {
  7384. +    swp[lp].hwnd = Pecic[lp].Frame ;
  7385. +    swp[lp].hwndInsertBehind = HWND_TOP ;
  7386. +    swp[lp].x  = ptl.x ;
  7387. +    swp[lp].y  = ptl.y ;
  7388. +    swp[lp].cx = Pecic[lp].Len * PmCxChar + cxBorder * 2 ;
  7389. +    swp[lp].cy = PmCyChar + cyBorder * 2 ;
  7390. +    swp[lp].fl = SWP_SIZE | SWP_MOVE | SWP_ZORDER ;
  7391. +    ptl.x = cxSizeBorder ;
  7392. +    ptl.y -= PmCyChar + cyBorder * 2 ;
  7393. +    }
  7394. +    WinSetMultWindowPos( hab, swp, PecicWndCount ) ;
  7395. +}
  7396. +
  7397. +/********************************************************/
  7398. +/*                            */
  7399. +/* ô·û{îΩôⁿù═âtâîü[âÇâEâBâôâhâEâRâôâgâìü[âï        */
  7400. +/*                            */
  7401. +/********************************************************/
  7402. +MRESULT PecicFrameWndProc( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2 )
  7403. +{
  7404. +    PPECICDATA    pPecic ;
  7405. +    POINTL    ptl ;
  7406. +    LPKKCPARAMS    kkparam ;
  7407. +    int        wnd, lp ;
  7408. +    USHORT    hi, low ;
  7409. +
  7410. +    switch (msg) {
  7411. +    case WM_SETWINDOWPARAMS:
  7412. +        pPecic = ( ( PWNDPARAMS )mp1 )->pCtlData ;
  7413. +        if ( pPecic->wpmctlflag != DBE_KSF_TEXT )
  7414. +        return( MRFROMLONG( TRUE ) ) ;
  7415. +
  7416. +    PecicLength = pPecic->textlength ;
  7417. +    strcpy( PecicText, pPecic->lpTextString ) ;
  7418. +    strncpy( PecicAttr, pPecic->lpAttrString, PecicLength ) ;
  7419. +    PecicCurPos = pPecic->CursorPos ;
  7420. +    PecicCurType = pPecic->CursorAttr ;
  7421. +
  7422. +    wnd = PecicComputeWindow( ) ;
  7423. +
  7424. +    if ( PecicLength )
  7425. +        WinDestroyCursor( PmHwndClient ) ;
  7426. +    else
  7427. +        create_cursor( 0 ) ;
  7428. +
  7429. +    PecicMoveWindow( ) ;
  7430. +
  7431. +    for ( lp = 0; lp < wnd; ++lp )
  7432. +        WinInvalidateRect( Pecic[lp].Client, NULL, FALSE ) ;
  7433. +        return( MRFROMLONG( TRUE ) ) ;
  7434. +
  7435. +    case WM_DBE_KKCPARAMS:
  7436. +    /* KKCé╠ò\Īê╩Æué≡Pecicé╠âJü[â\âïê╩Æué╠ï▀é¡é╔Ä¥é┴é─ìsé¡ */
  7437. +    kkparam = PVOIDFROMMP( mp1 ) ;
  7438. +    ConvPecicPos( &ptl ) ;
  7439. +    ptl.x += ( PecicCurPos -1 ) * PmCxChar ;
  7440. +    ((POINTL *)kkparam->lpKKCData)->x = ptl.x ;
  7441. +    ((POINTL *)kkparam->lpKKCData)->y = ptl.y ;
  7442. +    break ;
  7443. +    }
  7444. +    return OrgPecicFrameWndProc( hwnd, msg, mp1, mp2 ) ;
  7445. +}
  7446. +
  7447. +/********************************************************/
  7448. +/*                            */
  7449. +/* âüâCâôÅêù¥                        */
  7450. +/*                            */
  7451. +/********************************************************/
  7452. +int main( int argc, char *argv[] )
  7453. +{
  7454. +    ULONG    flFrameFlags ;
  7455. +    QMSG    qmsg ;
  7456. +    TID        tid ;
  7457. +    int        lp ;
  7458. +
  7459. +    /* Parse the command line. */
  7460. +
  7461. +    ++argv ;
  7462. +    --argc ;
  7463. +    if ( argc != 4 )
  7464. +    return 1 ;
  7465. +    MulePid     = atoi( *argv++ ) ;
  7466. +    InPipe      = atoi( *argv++ ) ;
  7467. +    OutPipe     = atoi( *argv++ ) ;
  7468. +    OutdataPipe = atoi( *argv ) ;
  7469. +
  7470. +    /* Initialize the Presentation Manager and create a message queue
  7471. +       for this thread, the PM thread. */
  7472. +
  7473. +    hab = WinInitialize( 0 ) ;
  7474. +    hmq = WinCreateMsgQueue( hab, 0 ) ;
  7475. +
  7476. +#ifdef DEBUGSNAP
  7477. +    if ( DebugSnapOpen( ) ) {
  7478. +    WinDestroyMsgQueue( hmq ) ;
  7479. +    WinTerminate( hab ) ;
  7480. +    return -1 ;
  7481. +    }
  7482. +#endif
  7483. +
  7484. +    initialize( ) ;
  7485. +
  7486. +    /* Register window classes. */
  7487. +
  7488. +    WinRegisterClass( hab, szClientClass, ClientWndProc,
  7489. +              CS_SIZEREDRAW | CS_MOVENOTIFY /* | CS_SAVEBITS */
  7490. +             , 0 ) ;
  7491. +
  7492. +    WinRegisterClass( hab, szPecicClientClass, PecicClientWndProc,
  7493. +             CS_SIZEREDRAW | CS_SYNCPAINT
  7494. +             , 0 ) ;
  7495. +
  7496. +    flFrameFlags = ( FCF_TITLEBAR     | FCF_SYSMENU  | FCF_ICON |
  7497. +            FCF_SIZEBORDER    | FCF_MINMAX   |
  7498. +            FCF_SHELLPOSITION | FCF_TASKLIST | FCF_DBE_APPSTAT ) ;
  7499. +
  7500. +    PmHwndFrame = WinCreateStdWindow( HWND_DESKTOP
  7501. +                     , 0
  7502. +                     , &flFrameFlags, szClientClass
  7503. +                     , "PM Mule (Gnu Emacs 18.59)"
  7504. +                     , 0L, 0, 1
  7505. +                     , &PmHwndClient ) ;
  7506. +    set_size( TRUE ) ;
  7507. +
  7508. +    OrgPecicFrameWndProc = WinSubclassWindow( WinWindowFromID( PmHwndFrame,
  7509. +                                  FID_DBE_PECIC ),
  7510. +                         ( PFNWP )PecicFrameWndProc ) ;
  7511. +
  7512. +
  7513. +    display_func_menu( ) ;
  7514. +
  7515. +    /* âEâBâôâhâEé¬É╢ɼé│éΩéΘé▄é┼é╠âCâxâôâgé≡ïzÄ√é╖éΘ */
  7516. +    while( WinPeekMsg( hab, &qmsg, NULL, WM_CHAR, WM_MOUSEFIRST, PM_REMOVE ) )
  7517. +    WinDispatchMsg( hab, &qmsg ) ;
  7518. +
  7519. +    terminating = FALSE ;
  7520. +
  7521. +    DosCreateThread( &tid, pipe_thread, 0, 2, 0x8000 ) ;
  7522. +
  7523. +    while ( WinGetMsg( hab, &qmsg, 0L, 0, 0 ) )
  7524. +    WinDispatchMsg( hab, &qmsg ) ;
  7525. +
  7526. +    WinDestroyWindow( PmHwndFrame ) ;
  7527. +    WinDestroyMsgQueue( hmq ) ;
  7528. +    WinTerminate( hab ) ;
  7529. +
  7530. +    for ( lp = 0; lp < 12; ++lp )
  7531. +    MemFree( PmFuncMenuData[lp] ) ;
  7532. +
  7533. +#ifdef DEBUGSNAP
  7534. +    DebugSnapClose( ) ;
  7535. +#endif
  7536. +    return 0 ;
  7537. +}
  7538. diff -urP /mule-1.1/src/pmmule.def ./src/pmmule.def
  7539. --- /mule-1.1/src/pmmule.def
  7540. +++ ./src/pmmule.def    Thu Dec 23 19:58:56 1993
  7541. @@ -0,0 +1,21 @@
  7542. +; pmmule.def -- module definition file for pmmule
  7543. +;
  7544. +; This file is part of GNU Emacs.
  7545. +;
  7546. +; GNU Emacs is free software; you can redistribute it and/or modify
  7547. +; it under the terms of the GNU General Public License as published by
  7548. +; the Free Software Foundation; either version 1, or (at your option)
  7549. +; any later version.
  7550. +;
  7551. +; GNU Emacs is distributed in the hope that it will be useful,
  7552. +; but WITHOUT ANY WARRANTY; without even the implied warranty of
  7553. +; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  7554. +; GNU General Public License for more details.
  7555. +;
  7556. +; You should have received a copy of the GNU General Public License
  7557. +; along with GNU Emacs; see the file COPYING.  If not, write to
  7558. +; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  7559. +
  7560. +NAME        PMMULE    WINDOWAPI
  7561. +DESCRIPTION    'Presentation Manager Interface for GNU Emacs'
  7562. +STACKSIZE    32768
  7563. diff -urP /mule-1.1/src/pmmule.h ./src/pmmule.h
  7564. --- /mule-1.1/src/pmmule.h
  7565. +++ ./src/pmmule.h    Wed Jan 26 05:18:02 1994
  7566. @@ -0,0 +1,603 @@
  7567. +/* pmemacs.h
  7568. +   Copyright (C) 1993 Osamu Sasaki
  7569. +
  7570. +This file is part of GNU Emacs.
  7571. +
  7572. +GNU Emacs is free software; you can redistribute it and/or modify
  7573. +it under the terms of the GNU General Public License as published by
  7574. +the Free Software Foundation; either version 1, or (at your option)
  7575. +any later version.
  7576. +
  7577. +GNU Emacs is distributed in the hope that it will be useful,
  7578. +but WITHOUT ANY WARRANTY; without even the implied warranty of
  7579. +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  7580. +GNU General Public License for more details.
  7581. +
  7582. +You should have received a copy of the GNU General Public License
  7583. +along with GNU Emacs; see the file COPYING.  If not, write to
  7584. +the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  7585. +
  7586. +/* Requests */
  7587. +
  7588. +typedef enum
  7589. +{
  7590. +    PMR_DESTROY,        /* PM Mule ÅIù╣âCâxâôâg            */
  7591. +    PMR_CURSOR,            /* âJü[â\âïê┌ô« & ò\Ī/ö±ò\Ī        */
  7592. +    PMR_OUTCHARS,        /* ò╢ÄÜù±ò\ĪÅêù¥            */
  7593. +    PMR_CLEAR,            /* æSëµû╩âNâèâAÅêù¥            */
  7594. +    PMR_CLREOL,            /* ìsûûâNâèâAÅêù¥            */
  7595. +    PMR_LINES,            /* ìsæ}ôⁿ & ìsìφÅ£Åêù¥            */
  7596. +    PMR_BELL,            /* âxâïÅêù¥                */
  7597. +    PMR_POPUPMENU,        /* â|âbâvâAâbâvâüâjâàü[ò\ĪÅêù¥        */
  7598. +    PMR_PASTE,            /* âNâèâbâvâ{ü[âhé⌐éτâeâLâXâgòíÄ╩Åêù¥    */
  7599. +    PMR_CUT,            /* âNâèâbâvâ{ü[âhé╓âeâLâXâgô]æùÅêù¥    */
  7600. +    PMR_QUITCHAR,        /* âLü[èäéΦì₧é▌âRü[âhÄwÆΦÅêù¥        */
  7601. +
  7602. +    PMR_TITLENAME,        /* âEâBâôâhâEâ^âCâgâïÉ▌ÆΦÅêù¥        */
  7603. +    PMR_SETSIZE,        /* âEâBâôâhâEâTâCâYÄwÆΦÅêù¥        */
  7604. +    PMR_SETPOS,            /* âEâBâôâhâEò\Īê╩ÆuÄwÆΦÅêù¥        */
  7605. +    PMR_SETCOLOR,        /* ò\Īò╢ÄÜâJâëü[ÄwÆΦÅêù¥        */
  7606. +    PMR_SETHICOLOR,        /* ï¡Æ▓ò\Īò╢ÄÜâJâëü[ÄwÆΦÅêù¥        */
  7607. +    PMR_CURSORTYPE,        /* âJü[â\âïâ^âCâvÄwÆΦÅêù¥        */
  7608. +    PMR_SHORTCUT,        /* PMâVâXâeâÇâLü[ùLî°/û│î°ÄwÆΦÅêù¥    */
  7609. +    PMR_MOUSE,            /* â}âEâXâ{â^âôö╘ìåÄwÆΦÅêù¥        */
  7610. +    PMR_SETFONT,        /* ò\ĪâtâHâôâgÄwÆΦÅêù¥            */
  7611. +
  7612. +    PMR_FUNCMENU,        /* âtâ@âôâNâVâçâôï@ö\ò\ÄåÅêù¥        */
  7613. +    PMR_FUNCMENUMSG,        /* âtâ@âôâNâVâçâôï@ö\ò\ÄåâüâbâZü[âW    */
  7614. +
  7615. +    PMR_FONTLIST,        /* âVâXâeâÇôoÿ^âtâHâôâgêΩùùò\ĪÅêù¥    */
  7616. +    PMR_CONFIG,            /* âEâBâôâhâEî╗É▌ÆΦèlô╛Åêù¥        */
  7617. +    PMR_MOUSEPOS,        /* â}âEâXê╩Æuèlô╛Åêù¥            */
  7618. +
  7619. +    PMR_SUSPEND,        /* Muleé╠âTâXâyâôâhÅêù¥            */
  7620. +
  7621. +    PMR_POPUPMENUDESTROY,    /* â|âbâvâAâbâvâüâjâàü[öjèⁿâCâxâôâg    */
  7622. +    PMR_PAINTEND,        /* âèâhâìâEÅIù╣âCâxâôâg            */
  7623. +} pm_request_type ;
  7624. +
  7625. +typedef struct {
  7626. +    pm_request_type type ;
  7627. +} pmr_header ;
  7628. +
  7629. +typedef struct {
  7630. +    pmr_header header ;
  7631. +    short x, y, size, on ;
  7632. +} pmr_cursor ;
  7633. +
  7634. +typedef struct {
  7635. +    pmr_header header ;
  7636. +    short x, y, highlight, count  ;
  7637. +} pmr_outchars ;
  7638. +
  7639. +typedef struct {
  7640. +    pmr_header header ;
  7641. +    short x0, x1, y ;
  7642. +} pmr_clreol ;
  7643. +
  7644. +typedef struct {
  7645. +    pmr_header header ;
  7646. +    short y, max_y ;
  7647. +    short count ;                    /* Insert this many lines if positive */
  7648. +} pmr_lines ;
  7649. +
  7650. +typedef struct {
  7651. +    pmr_header header ;
  7652. +    short visible ;
  7653. +} pmr_bell ;
  7654. +
  7655. +typedef struct {
  7656. +    pmr_header header ;
  7657. +    short get_text ;
  7658. +} pmr_paste ;
  7659. +
  7660. +typedef struct {
  7661. +    pmr_header header ;
  7662. +    unsigned long size ;           /* Size of data to follow */
  7663. +} pmr_cut ;
  7664. +
  7665. +typedef struct {
  7666. +    pmr_header header ;
  7667. +    short quitchar ;                 /* The quit character */
  7668. +} pmr_quitchar ;
  7669. +
  7670. +typedef struct {
  7671. +    pmr_header header ;
  7672. +    short count ;
  7673. +} pmr_titlename ;
  7674. +
  7675. +typedef struct {
  7676. +    pmr_header header ;
  7677. +    short width, height ;
  7678. +} pmr_setsize ;
  7679. +
  7680. +typedef struct {
  7681. +    pmr_header header ;
  7682. +    short top, left ;
  7683. +} pmr_setpos ;
  7684. +
  7685. +typedef struct {
  7686. +    pmr_header header ;
  7687. +    unsigned long fore, back ;
  7688. +} pmr_setcolor ;
  7689. +
  7690. +typedef struct {
  7691. +    pmr_header header ;
  7692. +    short type ;
  7693. +    short blink ;
  7694. +} pmr_cursortype ;
  7695. +
  7696. +typedef struct {
  7697. +    pmr_header header ;
  7698. +    short shortcut ;
  7699. +} pmr_shortcut ;
  7700. +
  7701. +typedef struct {
  7702. +    pmr_header header ;
  7703. +    char button[3] ;
  7704. +} pmr_mouse ;
  7705. +
  7706. +typedef struct {
  7707. +    pmr_header header ;
  7708. +    short fontname_length ;          /* Length of string to follow */
  7709. +} pmr_setfont ;
  7710. +
  7711. +typedef struct {
  7712. +    pmr_header header ;
  7713. +    short display ;
  7714. +} pmr_funcmenu ;
  7715. +
  7716. +typedef struct {
  7717. +    pmr_header header ;
  7718. +    short funcmenu_length ;
  7719. +} pmr_funcmenumsg ;
  7720. +
  7721. +typedef struct {
  7722. +    pmr_header header ;
  7723. +    short pattern_length ;           /* Length of string to follow */
  7724. +} pmr_fontlist ;
  7725. +
  7726. +
  7727. +typedef union
  7728. +{
  7729. +    pmr_header        header ;
  7730. +    pmr_cursor        cursor ;
  7731. +    pmr_outchars    outchars ;
  7732. +    pmr_clreol        clreol ;
  7733. +    pmr_lines        lines ;
  7734. +    pmr_bell        bell ;
  7735. +#if 0
  7736. +    pmr_popupmenu popupmenu ;
  7737. +#endif
  7738. +    pmr_paste        paste ;
  7739. +    pmr_cut        cut ;
  7740. +    pmr_quitchar    quitchar ;
  7741. +    pmr_titlename    titlename ;
  7742. +    pmr_setsize        setsize ;
  7743. +    pmr_setpos        setpos ;
  7744. +    pmr_setcolor    setcolor ;
  7745. +    pmr_cursortype    cursortype ;
  7746. +    pmr_shortcut    shortcut ;
  7747. +    pmr_mouse        mouse ;
  7748. +    pmr_setfont        setfont ;
  7749. +    pmr_funcmenu    funcmenu ;
  7750. +    pmr_funcmenumsg    funcmenumsg ;
  7751. +    pmr_fontlist    fontlist ;
  7752. +} pm_request ;
  7753. +
  7754. +/* Additional data for PMR_POPUPMENU, PMR_MENUBAR and PMR_MENU. */
  7755. +
  7756. +typedef struct {
  7757. +    int panes, lines ;
  7758. +    int button ;
  7759. +    int x, y ;
  7760. +    int title_size ;               /* Length of title */
  7761. +    int size ;                     /* Size of data to follow */
  7762. +} pm_popup_menu ;
  7763. +
  7764. +typedef struct
  7765. +{
  7766. +    int lines ;
  7767. +    int size ;                     /* Length of string to follow */
  7768. +} pm_menu_pane ;
  7769. +
  7770. +typedef struct
  7771. +{
  7772. +    unsigned long item ;
  7773. +    int enable ;                   /* Menu entry enabled */
  7774. +    int size ;                     /* Length of string to follow */
  7775. +} pm_menu_line ;
  7776. +
  7777. +/* PMR_CONFIGé┼Ägùpé│éΘâ}âNâì    */
  7778. +
  7779. +#define CURSORTYPE_BOX          1
  7780. +#define CURSORTYPE_BAR          2
  7781. +#define CURSORTYPE_FRAME        3
  7782. +#define CURSORTYPE_UNDERLINE    4
  7783. +#define CURSORTYPE_HALFTONE     5
  7784. +
  7785. +#define COLOR_NONE              (0xff000000)
  7786. +#define DONT_MOVE               (-999999)
  7787. +
  7788. +#define PMR_FALSE               1
  7789. +#define PMR_TRUE                2
  7790. +
  7791. +typedef struct
  7792. +{
  7793. +    int width ;
  7794. +    int height ;
  7795. +    int top ;
  7796. +    int left ;
  7797. +    int foreground_color ;
  7798. +    int background_color ;
  7799. +    int hi_foreground_color ;
  7800. +    int hi_background_color ;
  7801. +    int cursor_type ;
  7802. +    int cursor_blink ;
  7803. +    int disable_shortcuts ;
  7804. +    char buttons[3] ;
  7805. +    char font_name[100] ;
  7806. +} pm_config ;
  7807. +
  7808. +
  7809. +/* Events */
  7810. +
  7811. +typedef enum
  7812. +{
  7813. +    PME_PAINT,            /* ì─ò`ëµâCâxâôâg            */
  7814. +    PME_KEY,            /* âLü[ôⁿù═âCâxâôâg            */
  7815. +    PME_BUTTON,            /* â}âCâXâ{â^âôâCâxâôâg            */
  7816. +    PME_SIZE,            /* âEâBâôâhâEâTâCâYò╧ìXâCâxâôâg        */
  7817. +    PME_DEBUG,            /* âfâoâbâNâüâbâZü[âWò\ĪÅêù¥        */
  7818. +} pm_event_type ;
  7819. +
  7820. +typedef enum
  7821. +{
  7822. +    PMK_ASCII,
  7823. +    PMK_KANJI,
  7824. +    PMK_VIRTUAL,
  7825. +#if 0
  7826. +    PMK_SYMBOL,
  7827. +#endif
  7828. +} pm_key_type ;
  7829. +
  7830. +typedef struct
  7831. +{
  7832. +    pm_event_type type ;
  7833. +} pme_header ;
  7834. +
  7835. +typedef struct
  7836. +{
  7837. +    pme_header header ;
  7838. +    int x0, x1, y0, y1 ;
  7839. +} pme_paint ;
  7840. +
  7841. +typedef struct
  7842. +{
  7843. +    pme_header header ;
  7844. +    pm_key_type type ;
  7845. +    int code ;
  7846. +} pme_key ;
  7847. +
  7848. +typedef struct
  7849. +{
  7850. +    pme_header header ;
  7851. +    int width, height ;
  7852. +} pme_size ;
  7853. +
  7854. +typedef struct
  7855. +{
  7856. +    pme_header header ;
  7857. +    int button, x, y ;
  7858. +    unsigned long timestamp ;
  7859. +} pme_button ;
  7860. +
  7861. +typedef struct
  7862. +{
  7863. +    pme_header header ;
  7864. +    int len ;
  7865. +} pme_debug ;
  7866. +
  7867. +
  7868. +typedef union
  7869. +{
  7870. +    pme_header header ;
  7871. +    pme_paint paint ;
  7872. +    pme_key key ;
  7873. +    pme_size size ;
  7874. +    pme_button button ;
  7875. +    pme_debug debug ;
  7876. +} pm_event ;
  7877. +
  7878. +/* Out-of-band data */
  7879. +
  7880. +typedef struct {
  7881. +    unsigned long frame ;
  7882. +    int x, y ;
  7883. +} pmd_mousepos ;
  7884. +
  7885. +typedef struct {
  7886. +    int size, count ;
  7887. +} pmd_fontlist ;
  7888. +
  7889. +typedef struct {
  7890. +    int size, count ;
  7891. +} pmd_config ;
  7892. +
  7893. +#if 0
  7894. +typedef struct {
  7895. +    int top, left ;
  7896. +} pmd_framepos ;
  7897. +#endif
  7898. +
  7899. +
  7900. +/************************************************************************/
  7901. +/*                                    */
  7902. +/* ô·û{îΩénérü^éQùp NLS âCâôâNâïü[âhÉ▌ÆΦ                */
  7903. +/*                                    */
  7904. +/************************************************************************/
  7905. +#pragma pack(1)
  7906. +
  7907. +/* KC_ flags definition of WM_CHAR */
  7908. +
  7909. +#define KC_DBE_INTERIMCHAR    KC_DBCSRSRVD2
  7910. +
  7911. +/* resource ID offset for bi-lingual system resources (menu & string) */
  7912. +
  7913. +#define RID_DBE_OFFSET        0x1000
  7914. +#define STR_DBE_OFFSET        0x1000
  7915. +
  7916. +/*
  7917. + * definition of Virtual key values for DBCS
  7918. + */
  7919. +#define VK_DBE_FIRST    0x080
  7920. +#define VK_DBE_LAST    0x0ff
  7921. +
  7922. +#define VK_DBE_IMEFIRST        VK_DBE_FIRST + 0x1f
  7923. +#define VK_DBE_IMELAST        VK_DBE_LAST
  7924. +
  7925. +/* for codepage 932 */
  7926. +
  7927. +#define VK_DBE_ALPHANUMERIC    0x80 /* VK_DBE_FIRST + 0x00 */
  7928. +#define VK_DBE_KATAKANA        0x81 /* VK_DBE_FIRST + 0x01 */
  7929. +#define VK_DBE_HIRAGANA        0x82 /* VK_DBE_FIRST + 0x02 */
  7930. +#define VK_DBE_SBCSCHAR        0x83 /* VK_DBE_FIRST + 0x03 */
  7931. +#define VK_DBE_DBCSCHAR        0x84 /* VK_DBE_FIRST + 0x04 */
  7932. +#define VK_DBE_SBCSDBCSCHAR    0x85 /* VK_DBE_FIRST + 0x05 */
  7933. +#define VK_DBE_ROMAN        0x86 /* VK_DBE_FIRST + 0x06 */
  7934. +
  7935. +/* for codepage 934 */
  7936. +
  7937. +#define VK_DBE_HANJA        0x87 /* VK_DBE_FIRST + 0x07 */
  7938. +#define VK_DBE_HANGEUL        0x88 /* VK_DBE_FIRST + 0x08 */
  7939. +#define VK_DBE_JAMO        0x89 /* VK_DBE_FIRST + 0x09 */
  7940. +
  7941. +/* for codepage 936 */
  7942. +
  7943. +#define VK_DBE_HANZI        0x8A /* VK_DBE_FIRST + 0x0A */
  7944. +
  7945. +/* for codepage 938 */
  7946. +
  7947. +#define VK_DBE_TSANGJYE        0x8C /* VK_DBE_FIRST + 0x0C */
  7948. +#define VK_DBE_PHONETIC        0x8D /* VK_DBE_FIRST + 0x0D */
  7949. +
  7950. +#define VK_DBE_KANJI        0xa0 /* VK_DBE_IMEFIRST + 0x00 */
  7951. +#define VK_DBE_IMEACTIVATE    0xa0 /* VK_DBE_IMEFIRST + 0x00 */
  7952. +#define VK_DBE_CONV        0xa1 /* VK_DBE_IMEFIRST + 0x01 */
  7953. +#define VK_DBE_NOCONV        0xa2 /* VK_DBE_IMEFIRST + 0x02 */
  7954. +#define VK_DBE_TANGO        0xa3 /* VK_DBE_IMEFIRST + 0x03 */
  7955. +#define VK_DBE_WORDREGISTER    0xa3 /* VK_DBE_IMEFIRST + 0x03 */
  7956. +#define VK_DBE_IMEDIALOG    0xa4 /* VK_DBE_IMEFIRST + 0x04 */
  7957. +#define VK_DBE_IME_MBSELECTED    0xa5 /* VK_DBE_IMEFIRST + 0x05 */
  7958. +#define VK_DBE_IME_LBSELECTED    0xa6 /* VK_DBE_IMEFIRST + 0x06 */
  7959. +#define VK_DBE_CODEINPUT    0xa7 /* VK_DBE_IMEFIRST + 0x07 */
  7960. +#define VK_DBE_ALLCANDIDATE    0xa8 /* VK_DBE_IMEFIRST + 0x08 */
  7961. +#define VK_DBE_PREVCANDIDATE    0xa9 /* VK_DBE_IMEFIRST + 0x09 */
  7962. +#define VK_DBE_IMEDEACTIVATE    0xaa /* VK_DBE_IMEFIRST + 0x0a */
  7963. +#define VK_DBE_IME_WORDREGISTED    0xab /* VK_DBE_IMEFIRST + 0x0b */
  7964. +#define VK_DBE_IMECONTROL    0xac /* VK_DBE_IMEFIRST + 0x0c */
  7965. +#define VK_DBE_IME_FREEPS    0xad /* VK_DBE_IMEFIRST + 0x0d */
  7966. +#define VK_DBE_IMEMODEEXIT    0xae /* VK_DBE_IMEFIRST + 0x0e */
  7967. +
  7968. +/* Window Class definitoin for DBCS */
  7969. +
  7970. +#define WC_DBE_KBDSTAT        ((PSZ)0xffff0011L)
  7971. +#define WC_DBE_PECIC        ((PSZ)0xffff0012L)
  7972. +#define WC_DBE_APPSTAT        ((PSZ)0xffff0010L)
  7973. +
  7974. +/* Double byte character set messages */
  7975. +
  7976. +#define WM_DBCSFIRST        0x00b0
  7977. +#define WM_DBCSLAST        0x00cf
  7978. +#define WM_QUERYCONVERTPOS    0x00b0 /* WM_DBCSFIRST */
  7979. +#define WM_DBE_NOTIFYSETCP    0x00cf /* WM_DBCEFIRST+1f */
  7980. +#define WM_DBE_SETAPPLSTAT    0x00b6
  7981. +#define WM_QUERYCURRENTFONT    0x00b8
  7982. +#define WM_DBE_SHLDNOTIFYSETCP    0x00bb /* LIFEGAME */
  7983. +#define WM_DBE_KKCPARAMS    0x00bc /* KKC Parameters */
  7984. +
  7985. +/* WM_QUERYCONVERTPOS return value */
  7986. +
  7987. +#define QCP_VERTICAL        0x0002
  7988. +
  7989. +
  7990. +/* DBCS unique statndsrd Frame Create Flag */
  7991. +
  7992. +#define FCF_DBE_STATAREA    0x80000000L
  7993. +
  7994. +
  7995. +/* WM_SETWINDOWPARAM ctldata of DBCS status area */
  7996. +
  7997. +typedef struct _KEYSTSDATA {
  7998. +    unsigned long    wpmctlflag ;
  7999. +    unsigned long    textlength ;
  8000. +    unsigned char    *lpTextString ;
  8001. +    unsigned char    *lpAttrString ;
  8002. +    unsigned char    *lpRomanString ;
  8003. +} KEYSTSDATA, *PKEYSTSDATA ;
  8004. +
  8005. +typedef struct _WPMCTLPARAMS {
  8006. +    unsigned long    wpmctlflag ;
  8007. +    unsigned long    textlength ;
  8008. +    unsigned char    *lpTextString ;
  8009. +    unsigned char    *lpAttrString ;
  8010. +} WPMCTLPARAMS, *PWPMCTLPARAMS ;
  8011. +
  8012. +/* wpmctlflag value definition */
  8013. +
  8014. +#define DBE_KSF_ALPHANUMERIC        0x0001
  8015. +#define DBE_KSF_KATAKANA        0x0002
  8016. +#define DBE_KSF_HIRAGANA        0x0004
  8017. +#define DBE_KSF_CAPS            0x0008
  8018. +#define DBE_KSF_ROMAN            0x0010
  8019. +#define DBE_KSF_HANKAKU            0x0020
  8020. +#define DBE_KSF_ZENKAKU            0x0040
  8021. +#define DBE_KSF_SBCS            DBE_KSF_HANKAKU
  8022. +#define DBE_KSF_DBCS            DBE_KSF_ZENKAKU
  8023. +#define DBE_KSF_UPPER            0x0080
  8024. +#define DBE_KSF_LOWER            0x0100
  8025. +#define DBE_KSF_TEXT            0x0200
  8026. +#define DBE_KSF_NOROMAN            0x0400
  8027. +#define DBE_KSF_DISABLEONTHESPOT    0x0800
  8028. +#define DBE_KSF_ROMANTEXT        0x1000
  8029. +
  8030. +/* For Code Page 934(Korea) wpmctlflag value definition  */
  8031. +
  8032. +#define DBE_KSF_JAMO            0x0002
  8033. +#define DBE_KSF_HANGEUL            0x0004
  8034. +
  8035. +/* For Code Page 938(Taiwan) wpmctlflag value definition  */
  8036. +
  8037. +#define DBE_KSF_PHONETIC        0x0002
  8038. +#define DBE_KSF_TSANGJYE        0x0004
  8039. +
  8040. +
  8041. +/* WM_SETWINDOWPARAM ctldata of Pecic control */
  8042. +
  8043. +typedef struct _PECICDATA {
  8044. +    unsigned long    wpmctlflag ;
  8045. +    unsigned long    textlength ;
  8046. +    unsigned char    *lpTextString ;
  8047. +    unsigned char    *lpAttrString ;
  8048. +    unsigned long    CursorPos ;
  8049. +    unsigned long    CursorAttr ;
  8050. +} PECICDATA, * PPECICDATA ;
  8051. +
  8052. +/* wndparams definition of WM_DBE_APPLSTAT */
  8053. +
  8054. +#define DBE_WPM_APPLSTAT_VISIBILITY   0x0004
  8055. +
  8056. +/* ctldata of DBE_WPM_APPLSTAT_VISIBLITY */
  8057. +
  8058. +#define DBE_AS_APPLTOP        0x0001
  8059. +#define DBE_AS_KBDTOP        0x0002
  8060. +#define DBE_AS_PECICTOP        0x0004
  8061. +#define DBE_AS_APPLBOTTOM    0x0008
  8062. +
  8063. +
  8064. +/** WM_DBE_KKCPARAMS definition **/
  8065. +/* mp1(lpkkcparams) */
  8066. +
  8067. +typedef struct _KKCPARAMS {
  8068. +    unsigned long    lenKKCParams ;
  8069. +    unsigned long    fRequest ;
  8070. +    unsigned long    fKKCParams ;
  8071. +    void        *lpKKCData ;
  8072. +    unsigned long    Reserved ;
  8073. +} KKCPARAMS, * LPKKCPARAMS ;
  8074. +
  8075. +/* fRequest */
  8076. +#define DBE_KKCPARAMS_SET        0x0001
  8077. +#define DBE_KKCPARAMS_QUERY        0x0002
  8078. +
  8079. +/* fKKCParams */
  8080. +#define DBE_KKCPARAMS_PHYSICALATTRIBUTE    0x0001
  8081. +#define DBE_KKCPARAMS_PECICCURSORPOS    0x0002
  8082. +
  8083. +/* Level format for ColorLookUpTable */
  8084. +
  8085. +typedef struct _LEVEL {
  8086. +    unsigned char    attri1 ; /** 1st Attribute         **/
  8087. +    unsigned char    attri2 ; /** 2nd Attribute         **/
  8088. +} LEVEL , *PLEVEL ;
  8089. +
  8090. +/* Color Look Up Table format */
  8091. +
  8092. +typedef struct _COLORLOOKUPTBL {
  8093. +    unsigned long    nAttr ;            /** number of Attribute   **/
  8094. +    LEVEL    PhysicalLevel[32] ;    /** struct of Levels      **/
  8095. +} COLORLOOKUPTBL, * LPCOLORLOOKUPTBL ;
  8096. +
  8097. +
  8098. +/** WinDBCSIMEControl() Definition & Prototype **/
  8099. +
  8100. +#define DBE_IMCTL_QUERY        0x0001
  8101. +#define DBE_IMCTL_SET        0x0002
  8102. +
  8103. +typedef struct _IMEMODE {
  8104. +    unsigned long    lenIMEMODE ;
  8105. +    unsigned long    fIMEMode ;
  8106. +    unsigned long    hIME ;        /* query mode only valid */
  8107. +    unsigned long    hModIME ;    /* query mode only valid */
  8108. +} IMEMODE, *PIMEMODE ;
  8109. +
  8110. +/* definition of fIMEMode */
  8111. +#define DBE_IMCTL_IMEENABLE        0x0001
  8112. +#define DBE_IMCTL_IMEDISABLE        0x0002
  8113. +#define DBE_IMCTL_IMEMODE        0x0004
  8114. +#define DBE_IMCTL_NOTIMEMODE        0x0008
  8115. +#define DBE_IMCTL_INHERIT_PFRAME    0x0100
  8116. +#define DBE_IMCTL_INTERIMREQUEST    0x8000
  8117. +
  8118. +
  8119. +/* WinDBCSModeControl parameters definitions */
  8120. +/* type */
  8121. +
  8122. +#define DBE_MCTL_QUERY        0x0001
  8123. +#define DBE_MCTL_SET        0x0002
  8124. +
  8125. +/* arg */
  8126. +#define DBE_MCTL_INPUTMODEREQUEST 0x0001
  8127. +#define DBE_MCTL_JAPANREQ    0x0001 /* migration */
  8128. +
  8129. +/* parm - MCTL_JAPAN */
  8130. +#define DBE_MCTL_ALPHANUMERIC    0x0001
  8131. +#define DBE_MCTL_KATAKANA    0x0002
  8132. +#define DBE_MCTL_HIRAGANA    0x0004
  8133. +#define DBE_MCTL_SBCSCHAR    0x0008
  8134. +#define DBE_MCTL_DBCSCHAR    0x0010
  8135. +#define DBE_MCTL_ROMAN        0x0020
  8136. +#define DBE_MCTL_NOROMAN    0x0040
  8137. +
  8138. +#define DBE_MCTL_KKCREQ        0x1000
  8139. +#define DBE_MCTL_CP932REQ    0x0001
  8140. +#define DBE_MCTL_KKCENABLE    0x1000
  8141. +#define DBE_MCTL_KKCDISABLE    0x2000
  8142. +#define DBE_MCTL_HANKAKU    0x0008
  8143. +#define DBE_MCTL_ZENKAKU    0x0010
  8144. +
  8145. +/* parm - MCTL_KOREA */
  8146. +#define DBE_MCTL_JAMO        0x0002
  8147. +#define DBE_MCTL_HANGEUL    0x0004
  8148. +#define DBE_MCTL_INTERIMREQUEST 0x0080
  8149. +
  8150. +/* parm - MCTL_TCHINESE */
  8151. +#define DBE_MCTL_PHONETIC    0x0002
  8152. +#define DBE_MCTL_TSANGJYE    0x0004
  8153. +
  8154. +/* for MDI support */
  8155. +#define DBE_MCTL_INHERIT_PFRAME 0x0100
  8156. +
  8157. +/* Font Driver Description structure  */
  8158. +
  8159. +typedef struct _FD_DESC {
  8160. +    unsigned long    flType ;
  8161. +    char        xstr64Desc[64] ;
  8162. +} FD_DESC , * PFD_DESC ;
  8163. +
  8164. +/* fd_type definition */
  8165. +
  8166. +#define DBE_FD_DESC_SYSTEM    0x0001
  8167. +#define DBE_FD_DESC_PUBLIC    0x0002
  8168. +#define DBE_FD_DESC_PRIVATE    0x0004
  8169. +#pragma pack(4)
  8170. diff -urP /mule-1.1/src/pmmule.rc ./src/pmmule.rc
  8171. --- /mule-1.1/src/pmmule.rc
  8172. +++ ./src/pmmule.rc    Wed Mar 23 07:17:20 1994
  8173. @@ -0,0 +1,20 @@
  8174. +/* pmemacs.rc -- resource definition file for pmmule.exe
  8175. +   Copyright (C) 1993 O.Sasaki
  8176. +
  8177. +This file is part of GNU Emacs.
  8178. +
  8179. +GNU Emacs is free software; you can redistribute it and/or modify
  8180. +it under the terms of the GNU General Public License as published by
  8181. +the Free Software Foundation; either version 1, or (at your option)
  8182. +any later version.
  8183. +
  8184. +GNU Emacs is distributed in the hope that it will be useful,
  8185. +but WITHOUT ANY WARRANTY; without even the implied warranty of
  8186. +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  8187. +GNU General Public License for more details.
  8188. +
  8189. +You should have received a copy of the GNU General Public License
  8190. +along with GNU Emacs; see the file COPYING.  If not, write to
  8191. +the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  8192. +
  8193. +ICON 1 mule.ico
  8194. diff -urP /mule-1.1/src/pmterm.c ./src/pmterm.c
  8195. --- /mule-1.1/src/pmterm.c
  8196. +++ ./src/pmterm.c    Mon Mar 28 21:05:50 1994
  8197. @@ -0,0 +1,1578 @@
  8198. +/* PM Communication module for the OS/2 Presentation Manager
  8199. +   Copyright (C) 1993 Osamu Sasaki
  8200. +
  8201. +This file is part of GNU Emacs.
  8202. +
  8203. +GNU Emacs is free software; you can redistribute it and/or modify
  8204. +it under the terms of the GNU General Public License as published by
  8205. +the Free Software Foundation; either version 1, or (at your option)
  8206. +any later version.
  8207. +
  8208. +GNU Emacs is distributed in the hope that it will be useful,
  8209. +but WITHOUT ANY WARRANTY; without even the implied warranty of
  8210. +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  8211. +GNU General Public License for more details.
  8212. +
  8213. +You should have received a copy of the GNU General Public License
  8214. +along with GNU Emacs; see the file COPYING.  If not, write to
  8215. +the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  8216. +
  8217. +
  8218. +/*#define PMDEBUG*/
  8219. +
  8220. +#include <stdio.h>
  8221. +#include <stdlib.h>
  8222. +#include <fcntl.h>
  8223. +#include <process.h>
  8224. +#include <sys/ioctl.h>
  8225. +
  8226. +#include "config.h"
  8227. +#include "lisp.h"
  8228. +
  8229. +#include "dispextern.h"
  8230. +#include "termhooks.h"
  8231. +
  8232. +#include "termopts.h"
  8233. +#include "termchar.h"
  8234. +#include "mule.h"
  8235. +#include "codeconv.h"
  8236. +#include "window.h"
  8237. +
  8238. +#include "pmmule.h"
  8239. +
  8240. +#define min( a, b ) ( ( a ) < ( b ) ? ( a ) : ( b ) )
  8241. +#define max( a, b ) ( ( a ) > ( b ) ? ( a ) : ( b ) )
  8242. +
  8243. +extern int quit_char ;
  8244. +extern struct Lisp_Vector *MouseMap ;
  8245. +
  8246. +
  8247. +int        PmPid = -1 ;    /* PM Muleé╠âvâìâZâXID            */
  8248. +int        PmSessionStart = 0 ; /* PMâEâBâôâhâEèJÄnâtâëâO        */
  8249. +Lisp_Object    Vos2pmterm ;    /* PMâEâBâôâhâEâéü[âhâtâëâO        */
  8250. +Lisp_Object    Vx_mouse_pos ;    /* â}âEâXê╩Æu                */
  8251. +Lisp_Object    Vx_mouse_item ; /* â}âEâXâCâxâôâgÅ≤æ╘            */
  8252. +Lisp_Object    Vsuspend_emacs_hook ; /* PMö┼Ä└ìsÄ₧é╠âTâXâyâôâhâtâbâN    */
  8253. +
  8254. +
  8255. +static int    MouseItem = 0 ;    /* PMâ}âEâXâCâxâôâgÅεò±            */
  8256. +
  8257. +
  8258. +static int curs_x ;        /* XâJâîâôâgâJü[â\âïê╩Æu        */
  8259. +static int curs_y ;        /* YâJâîâôâgâJü[â\âïê╩Æu        */
  8260. +
  8261. +static int OutPipe ;        /* PMö┼é╔ôné╖òWÅÇÅoù═é╠ânâôâhâï        */
  8262. +static int DataPipe ;        /* PMö┼é⌐éτé╠âfü[â^ôⁿù═ânâôâhâï        */
  8263. +
  8264. +static int highlight ;        /* ânâCâëâCâgâéü[âhâtâëâO        */
  8265. +
  8266. +static int flexlines ;
  8267. +
  8268. +static int InUpdate ;        /* many of functions here may be invoked
  8269. +                 * even if no update in progress ; when
  8270. +                 * no update is in progress the action
  8271. +                 * can be slightly different */
  8272. +
  8273. +
  8274. +/************************************************************************/
  8275. +/*                                    */
  8276. +/*                                    */
  8277. +/*        PMö┼ MuleâEâBâôâhâEâvâìâZâXÆ╩ÉMÅêù¥îQ            */
  8278. +/*                                    */
  8279. +/*                                    */
  8280. +/************************************************************************/
  8281. +
  8282. +static void pm_send( const void *src, unsigned size )
  8283. +{
  8284. +    const char    *s ;
  8285. +    int        n ;
  8286. +
  8287. +    s = src ;
  8288. +    while ( size ) {
  8289. +    n = write( OutPipe, s, size ) ;
  8290. +    if ( n == -1 || n == 0 )
  8291. +        fatal( "Cannot send message to PM Mule." ) ;
  8292. +    size -= n ;
  8293. +    s += n ;
  8294. +    }
  8295. +}
  8296. +
  8297. +static void receive( int fd, void *dst, size_t size )
  8298. +{
  8299. +    char    *d ;
  8300. +    int        n ;
  8301. +
  8302. +    d = dst ;
  8303. +    while ( size != 0 ) {
  8304. +    n = read( fd, d, size ) ;
  8305. +    if ( n == -1 || n == 0 )
  8306. +        fatal( "Failed to receive data from PM Mule." ) ;
  8307. +    size -= n ;
  8308. +    d += n ;
  8309. +    }
  8310. +}
  8311. +
  8312. +static void pm_receive_data( void *dst, unsigned size )
  8313. +{
  8314. +    receive( DataPipe, dst, size ) ;
  8315. +}
  8316. +
  8317. +/************************************************************************/
  8318. +/*                                    */
  8319. +/*                                    */
  8320. +/*        PMâ^ü[â~âiâïâRâôâgâìü[âïÅêù¥îQ                */
  8321. +/*                                    */
  8322. +/*                                    */
  8323. +/************************************************************************/
  8324. +
  8325. +static void pm_display_cursor( int on )
  8326. +{
  8327. +    pm_request pmr ;
  8328. +
  8329. +    pmr.cursor.header.type = PMR_CURSOR ;
  8330. +    pmr.cursor.x = curs_x ;
  8331. +    pmr.cursor.y = curs_y ;
  8332. +#if 0
  8333. +    pmr.cursor.size = ( MTRX_LC( current_screen->contents[curs_y][curs_x] )
  8334. +               == 0x92 && curs_x < current_screen->used[curs_y] ) ;
  8335. +#endif
  8336. +    pmr.cursor.size = (( current_screen->contents[curs_y][curs_x] & 0x920000 )
  8337. +               == 0x920000 && curs_x < current_screen->used[curs_y] );
  8338. +    pmr.cursor.on = on ;
  8339. +    pm_send( &pmr, sizeof( pmr ) ) ;
  8340. +}
  8341. +
  8342. +static dump_chars( active_screen, numcols, tempX, tempY, tempHL )
  8343. +register struct matrix *active_screen ;
  8344. +register int numcols ;
  8345. +register int tempX, tempY, tempHL ;
  8346. +{
  8347. +    pm_request    pmr,*pmrp ;
  8348. +    char    *buf ;
  8349. +    int        lp ;
  8350. +    char    *start2 ;
  8351. +    int        len2 ;
  8352. +
  8353. +    if ( numcols <= 0 )
  8354. +    return ;
  8355. +
  8356. +    if ( numcols - 1 + tempX > screen_width )
  8357. +    numcols = screen_width - tempX + 1 ;
  8358. +
  8359. +    if ( tempX < 0 || tempX >= screen_width ||
  8360. +    tempY < 0 || tempY >= screen_height )
  8361. +    return ;
  8362. +
  8363. +    while ( tempX > 0 && active_screen->contents[tempY][tempX] & MTRX_REST )
  8364. +    --tempX, ++numcols ;
  8365. +
  8366. +    start2 = get_conversion_buffer( numcols, LINECODE ) ;
  8367. +    len2  = linecode_conversion( numcols,
  8368. +                 &active_screen->contents[tempY][tempX],
  8369. +                 start2 ) ;
  8370. +    buf = alloca( sizeof( pmr ) + len2 ) ;
  8371. +    pmrp =( pm_request * )buf ;
  8372. +    buf += sizeof( pmr ) ;
  8373. +    for ( lp = 0; lp < len2; ++lp )
  8374. +    *buf++ = *start2++ ;
  8375. +    pmrp->outchars.header.type = PMR_OUTCHARS ;
  8376. +    pmrp->outchars.x = tempX ;
  8377. +    pmrp->outchars.y = tempY ;
  8378. +    pmrp->outchars.highlight = tempHL ;
  8379. +    pmrp->outchars.count = len2 ;
  8380. +    pm_send( pmrp, sizeof( pmr ) + len2 ) ;
  8381. +}
  8382. +
  8383. +static void dump_rectangle( int left, int top, int right, int bottom )
  8384. +{
  8385. +    int        cols, rows, y, cursor_flag, i ;
  8386. +    pm_request    pmr ;
  8387. +
  8388. +    if ( right < 0 )    return ;
  8389. +    if ( bottom < 0 )    return ;
  8390. +    if ( left >= screen_width )    return ;
  8391. +    if ( top >= screen_height )    return ;
  8392. +
  8393. +    /* Clip the rectangle to what can be visible.  */
  8394. +    if ( left < 0 )    left = 0 ;
  8395. +    if ( top < 0 )    top = 0 ;
  8396. +    if ( right >= screen_width )
  8397. +    right = screen_width - 1 ;
  8398. +    if ( bottom >= screen_height )
  8399. +    bottom = screen_height - 1 ;
  8400. +
  8401. +    /* Get size in chars of the rectangle.  */
  8402. +    cols = 1 + right - left ;
  8403. +    rows = 1 + bottom - top ;
  8404. +
  8405. +    /* If rectangle has zero area, return.  */
  8406. +    if ( rows <= 0 ) return ;
  8407. +    if ( cols <= 0 ) return ;
  8408. +
  8409. +#if 0
  8410. +    cursor_flag =( f->phys_cursor_x >= 0 ) ;
  8411. +#endif
  8412. +    pm_display_cursor( 0 ) ;
  8413. +
  8414. +    for ( y = top; y <= bottom; ++y ) {
  8415. +    if ( y < 0 || y >= screen_height || 
  8416. +        !current_screen->enable[y] ||
  8417. +        left+1 > current_screen->used[y] )
  8418. +        continue ;
  8419. +    dump_chars( current_screen,
  8420. +            min( cols, current_screen->used[y]-left ),
  8421. +            left, y, current_screen->highlight[y] ) ;
  8422. +    }
  8423. +    pmr.header.type = PMR_PAINTEND ;
  8424. +    pm_send( &pmr, sizeof( pmr ) ) ;
  8425. +
  8426. +#if 0
  8427. +    if ( cursor_flag )
  8428. +#endif
  8429. +    pm_display_cursor( 1 ) ;
  8430. +}
  8431. +
  8432. +static int PM_read_socket( int sd, char *bufp, int numchars )
  8433. +{
  8434. +    int        count = 0 ;
  8435. +    pm_event    pme ;
  8436. +    int        nread ;
  8437. +    Lisp_Object tail, frame ;
  8438. +
  8439. +    if ( numchars <= 0 )
  8440. +    abort( ) ;
  8441. +    if ( ioctl( 0, FIONREAD, &nread ) < 0 || nread < sizeof( pme ) )
  8442. +    return 0 ;
  8443. +    receive( 0, &pme, sizeof( pme ) ) ;
  8444. +
  8445. +    switch( pme.header.type ) {
  8446. +    case PME_PAINT:
  8447. +    dump_rectangle( pme.paint.x0, pme.paint.y0,
  8448. +            pme.paint.x1, pme.paint.y1 ) ;
  8449. +    break ;
  8450. +
  8451. +    case PME_KEY:
  8452. +    /* A key has been pressed. */
  8453. +
  8454. +    switch( pme.key.type ) {
  8455. +    case PMK_ASCII:
  8456. +        *bufp = pme.key.code ;
  8457. +        ++count ;
  8458. +        ++bufp ;
  8459. +        --numchars ;
  8460. +        break ;
  8461. +    case PMK_KANJI:
  8462. +        *bufp++ = pme.key.code % 256 ;
  8463. +        *bufp++ = pme.key.code / 256 ;
  8464. +        count += 2 ;
  8465. +        numchars -= 2 ;
  8466. +        break ;
  8467. +    case PMK_VIRTUAL:
  8468. +#ifdef PMDEBUG
  8469. +        fprintf( stderr,"PMK_VIRTUAL:code=%04x (", pme.key.code ) ;
  8470. +
  8471. +        switch ( pme.key.code ) {
  8472. +        case VK_DBE_FIRST:
  8473. +        fprintf( stderr, "VK_DBE_FIRST or VK_DBE_ALPHANUMERIC)\n" ) ;
  8474. +        break ;
  8475. +        case VK_DBE_LAST:
  8476. +        fprintf( stderr, "VK_DBE_LAST or VK_DBE_IMELAST)\n" ) ;
  8477. +        break ;
  8478. +        case VK_DBE_IMEFIRST:
  8479. +        fprintf( stderr, "VK_DBE_IMEFIRST)\n" ) ;
  8480. +        break ;
  8481. +        case VK_DBE_KATAKANA:
  8482. +        fprintf( stderr, "VK_DBE_KATAKANA)\n" ) ;
  8483. +        break ;
  8484. +        case VK_DBE_HIRAGANA:
  8485. +        fprintf( stderr, "VK_DBE_HIRAGANA)\n" ) ;
  8486. +        break ;
  8487. +        case VK_DBE_SBCSCHAR:
  8488. +        fprintf( stderr, "VK_DBE_SBCSCHAR)\n" ) ;
  8489. +        break ;
  8490. +        case VK_DBE_DBCSCHAR:
  8491. +        fprintf( stderr, "VK_DBE_DBCSCHAR)\n" ) ;
  8492. +        break ;
  8493. +        case VK_DBE_SBCSDBCSCHAR:
  8494. +        fprintf( stderr, "VK_DBE_SBCSDBCSCHAR)\n" ) ;
  8495. +        break ;
  8496. +        case VK_DBE_ROMAN:
  8497. +        fprintf( stderr, "VK_DBE_ROMAN)\n" ) ;
  8498. +        break ;
  8499. +        case VK_DBE_HANJA:
  8500. +        fprintf( stderr, "VK_DBE_HANJA)\n" ) ;
  8501. +        break ;
  8502. +        case VK_DBE_HANGEUL:
  8503. +        fprintf( stderr, "VK_DBE_HANGEUL)\n" ) ;
  8504. +        break ;
  8505. +        case VK_DBE_JAMO:
  8506. +        fprintf( stderr, "VK_DBE_JAMO)\n" ) ;
  8507. +        break ;
  8508. +        case VK_DBE_HANZI:
  8509. +        fprintf( stderr, "VK_DBE_HANZI)\n" ) ;
  8510. +        break ;
  8511. +        case VK_DBE_TSANGJYE:
  8512. +        fprintf( stderr, "VK_DBE_TSANGJYE)\n" ) ;
  8513. +        break ;
  8514. +        case VK_DBE_PHONETIC:
  8515. +        fprintf( stderr, "VK_DBE_PHONETIC)\n" ) ;
  8516. +        break ;
  8517. +        case VK_DBE_IMEACTIVATE:
  8518. +        fprintf( stderr, "VK_DBE_KANJI or VK_DBE_IMEACTIVATE)\n" ) ;
  8519. +        break ;
  8520. +        case VK_DBE_CONV:
  8521. +        fprintf( stderr, "VK_DBE_CONV)\n" ) ;
  8522. +        break ;
  8523. +        case VK_DBE_NOCONV:
  8524. +        fprintf( stderr, "VK_DBE_NOCONV)\n" ) ;
  8525. +        break ;
  8526. +        case VK_DBE_TANGO:
  8527. +        fprintf( stderr, "VK_DBE_TANGO or VK_DBE_WORDREGISTER)\n" ) ;
  8528. +        break ;
  8529. +        case VK_DBE_IMEDIALOG:
  8530. +        fprintf( stderr, "VK_DBE_IMEDIALOG)\n" ) ;
  8531. +        break ;
  8532. +        case VK_DBE_IME_MBSELECTED:
  8533. +        fprintf( stderr, "VK_DBE_IME_MBSELECTED)\n" ) ;
  8534. +        break ;
  8535. +        case VK_DBE_IME_LBSELECTED:
  8536. +        fprintf( stderr, "VK_DBE_IME_LBSELECTED)\n" ) ;
  8537. +        break ;
  8538. +        case VK_DBE_CODEINPUT:
  8539. +        fprintf( stderr, "VK_DBE_CODEINPUT)\n" ) ;
  8540. +        break ;
  8541. +        case VK_DBE_ALLCANDIDATE:
  8542. +        fprintf( stderr, "VK_DBE_ALLCANDIDATE)\n" ) ;
  8543. +        break ;
  8544. +        case VK_DBE_PREVCANDIDATE:
  8545. +        fprintf( stderr, "VK_DBE_PREVCANDIDATE)\n" ) ;
  8546. +        break ;
  8547. +        case VK_DBE_IMEDEACTIVATE:
  8548. +        fprintf( stderr, "VK_DBE_IMEDEACTIVATE)\n" ) ;
  8549. +        break ;
  8550. +        case VK_DBE_IME_WORDREGISTED:
  8551. +        fprintf( stderr, "VK_DBE_IME_WORDREGISTED)\n" ) ;
  8552. +        break ;
  8553. +        case VK_DBE_IMECONTROL:
  8554. +        fprintf( stderr, "VK_DBE_IMECONTROL)\n" ) ;
  8555. +        break ;
  8556. +        case VK_DBE_IME_FREEPS:
  8557. +        fprintf( stderr, "VK_DBE_IME_FREEPS)\n" ) ;
  8558. +        break ;
  8559. +        case VK_DBE_IMEMODEEXIT:
  8560. +        fprintf( stderr, "VK_DBE_IMEMODEEXIT)\n" ) ;
  8561. +        break ;
  8562. +        default:
  8563. +        fprintf( stderr, "?????)\n" ) ;
  8564. +        }
  8565. +#endif
  8566. +        break ;
  8567. +
  8568. +    default:
  8569. +        abort( ) ;
  8570. +    }
  8571. +    break ;
  8572. +      
  8573. +    case PME_BUTTON:
  8574. +    Vx_mouse_pos = Fcons( pme.button.x, Fcons( pme.button.y, Qnil ) ) ;
  8575. +    MouseItem = pme.button.button ;
  8576. +    *bufp++ = 'X' & 0x1f ;
  8577. +    *bufp++ = 0 ;
  8578. +    count += 2 ;
  8579. +    numchars -= 2 ;
  8580. +    break ;
  8581. +
  8582. +    case PME_SIZE:
  8583. +    /* The size of the frame has been changed by the user.  Adjust
  8584. +       frame and set new size. */
  8585. +
  8586. +    if ( pme.size.width != screen_width
  8587. +        || pme.size.height != screen_height )
  8588. +#if 0
  8589. +        change_screen_size( pme.size.height, pme.size.width,
  8590. +                0, !waiting_for_input, 1 ) ;
  8591. +#else
  8592. +        change_screen_size( pme.size.height, pme.size.width,
  8593. +                0, 0, 1 ) ;
  8594. +#endif
  8595. +    break ;
  8596. +
  8597. +    case PME_DEBUG:
  8598. +    {
  8599. +        unsigned char    buf[200] ;
  8600. +        pm_receive_data( buf, pme.debug.len ) ;
  8601. +        fprintf( stderr, "%s\n", buf ) ;
  8602. +    }
  8603. +    break ;
  8604. +
  8605. +    default:
  8606. +    fatal( "Bad event type %d from PM Mule.", pme.header.type ) ;
  8607. +    }
  8608. +    return count ;
  8609. +}
  8610. +
  8611. +static PM_clear_screen( void )
  8612. +{
  8613. +    pm_request pmr ;
  8614. +
  8615. +    curs_x = 0 ;
  8616. +    curs_y = 0 ;
  8617. +    pmr.header.type = PMR_CLEAR ;
  8618. +    pm_send( &pmr, sizeof( pmr ) ) ;
  8619. +}
  8620. +
  8621. +static PM_set_terminal_modes( void )
  8622. +{
  8623. +    pm_request pmr ;
  8624. +
  8625. +    InUpdate = 0 ;
  8626. +    pmr.quitchar.header.type = PMR_QUITCHAR ;
  8627. +    pmr.quitchar.quitchar = quit_char ;
  8628. +    pm_send( &pmr, sizeof( pmr ) ) ;
  8629. +}
  8630. +
  8631. +static int PM_move_cursor( int row, int col )
  8632. +{
  8633. +    curs_x = col ;
  8634. +    curs_y = row ;
  8635. +    if ( InUpdate == 0 )
  8636. +    pm_display_cursor( 1 ) ;
  8637. +}
  8638. +
  8639. +static PM_set_terminal_window( int n )
  8640. +{
  8641. +    if ( n <= 0 || n > screen_height )
  8642. +    flexlines = screen_height ;
  8643. +    else
  8644. +    flexlines = n ;
  8645. +}
  8646. +
  8647. +static PM_ins_del_lines( int vpos, int n )
  8648. +{
  8649. +    pm_request pmr ;
  8650. +
  8651. +    if ( vpos >= flexlines )
  8652. +    return ;
  8653. +    pmr.lines.header.type = PMR_LINES ;
  8654. +    pmr.lines.y = vpos ;
  8655. +    pmr.lines.max_y = flexlines ;
  8656. +    pmr.lines.count = n ;
  8657. +    pm_send( &pmr, sizeof( pmr ) ) ;
  8658. +}
  8659. +
  8660. +static PM_update_begin( VOID )
  8661. +{
  8662. +    InUpdate = 1 ;
  8663. +    flexlines = screen_height ;
  8664. +    highlight = 0 ;
  8665. +    pm_display_cursor( 0 ) ;
  8666. +}
  8667. +
  8668. +static PM_update_end( VOID )
  8669. +{
  8670. +    InUpdate = 0 ;
  8671. +    pm_display_cursor( 1 ) ;
  8672. +}
  8673. +
  8674. +static PM_clear_end_of_line( int first_unused )
  8675. +{
  8676. +  pm_request pmr ;
  8677. +
  8678. +  if ( curs_y < 0 || curs_y >= screen_height )
  8679. +    return ;
  8680. +  if ( first_unused <= 0 )
  8681. +    return ;
  8682. +  if ( first_unused >= screen_width )
  8683. +    first_unused = screen_width ;
  8684. +
  8685. +  pmr.clreol.header.type = PMR_CLREOL ;
  8686. +  pmr.clreol.y = curs_y ;
  8687. +  pmr.clreol.x0 = curs_x ;
  8688. +  pmr.clreol.x1 = first_unused ;
  8689. +  pm_send( &pmr, sizeof( pmr ) ) ;
  8690. +}
  8691. +
  8692. +static PM_reassert_line_highlight( int new, int vpos )
  8693. +{
  8694. +    highlight = new ;
  8695. +}
  8696. +
  8697. +static PM_change_line_highlight( int new_highlight, int vpos,
  8698. +                                 int first_unused_hpos )
  8699. +{
  8700. +    highlight = new_highlight ;
  8701. +    PM_move_cursor( vpos, 0 ) ;
  8702. +    PM_clear_end_of_line( screen_width ) ;
  8703. +}
  8704. +
  8705. +static PM_ring_bell( )
  8706. +{
  8707. +    pm_request pmr ;
  8708. +
  8709. +    pmr.bell.header.type = PMR_BELL ;
  8710. +    pmr.bell.visible = visible_bell ;
  8711. +    pm_send( &pmr, sizeof( pmr ) ) ;
  8712. +}
  8713. +
  8714. +static int PM_output_chars( unsigned int *start, int len )
  8715. +{
  8716. +    pm_request    pmr,*pmrp ;
  8717. +    char    *buf ;
  8718. +    int        lp ;
  8719. +    char    *start2 = get_conversion_buffer( len, LINECODE ) ;
  8720. +    int        len2 = linecode_conversion( len, start, start2 ) ;
  8721. +
  8722. +#if 0
  8723. +    pm_display_cursor( 0 ) ;
  8724. +#endif
  8725. +
  8726. +    buf = alloca( sizeof( pmr ) + len2 ) ;
  8727. +    pmrp =( pm_request * )buf ;
  8728. +    buf += sizeof( pmr ) ;
  8729. +    memcpy( buf, start2, len2 ) ;
  8730. +    pmrp->outchars.header.type = PMR_OUTCHARS ;
  8731. +    pmrp->outchars.x = curs_x ;
  8732. +    pmrp->outchars.y = curs_y ;
  8733. +    pmrp->outchars.highlight = highlight ;
  8734. +    pmrp->outchars.count = len2 ;
  8735. +    pm_send( pmrp, sizeof( pmr ) + len2 ) ;
  8736. +    if ( !InUpdate )
  8737. +    PM_move_cursor( curs_y, curs_x+len2 ) ;
  8738. +}
  8739. +
  8740. +void os2pm_term_init( void )
  8741. +{
  8742. +    int            i, in_pipe[2], out_pipe[2], data_pipe[2] ;
  8743. +    char        arg1[12], arg2[12], arg3[12], arg4[12] ;
  8744. +    pm_request        pmr ;
  8745. +    extern Lisp_Object    Vkill_emacs_hook ;
  8746. +    Lisp_Object        tmp ;
  8747. +
  8748. +    for ( i = 0; i < 64; ++i )
  8749. +    fcntl( i, F_SETFD, 1 ) ;
  8750. +
  8751. +    sprintf( arg1, "%d", getpid( ) ) ;
  8752. +
  8753. +    if ( pipe( out_pipe ) != 0 )
  8754. +    fatal( "Cannot open pipe for PM Mule." ) ;
  8755. +    fcntl( out_pipe[1], F_SETFD, 1 ) ; /* Don't pass write end to child */
  8756. +    OutPipe = out_pipe[1] ;
  8757. +    setmode( OutPipe, O_BINARY ) ;
  8758. +    sprintf( arg2, "%d", out_pipe[0] ) ;
  8759. +
  8760. +    if ( pipe( in_pipe ) != 0 )
  8761. +    fatal( "Cannot open pipe for PM Mule." ) ;
  8762. +    dup2( in_pipe[0], 0 ) ;         /* Replace stdin with pipe */
  8763. +    close( in_pipe[0] ) ;
  8764. +    fcntl( 0, F_SETFD, 1 ) ;        /* Don't pass read end to child */
  8765. +    setmode( 0, O_BINARY ) ;
  8766. +    sprintf( arg3, "%d", in_pipe[1] ) ;
  8767. +
  8768. +    if ( pipe( data_pipe ) != 0 )
  8769. +    fatal( "Cannot open pipe for PM Mule." ) ;
  8770. +    DataPipe = data_pipe[0] ;
  8771. +    fcntl( DataPipe, F_SETFD, 1 ) ; /* Don't pass read end to child */
  8772. +    setmode( DataPipe, O_BINARY ) ;
  8773. +    sprintf( arg4, "%d", data_pipe[1] ) ;
  8774. +
  8775. +    PmPid = spawnlp( P_SESSION | P_FOREGROUND,
  8776. +              "pmmule.exe", "pmmule.exe",
  8777. +              arg1, arg2, arg3, arg4, 0 ) ;
  8778. +
  8779. +    if ( PmPid == -1 )
  8780. +    fatal( "Cannot start PM Mule." ) ;
  8781. +
  8782. +    close( out_pipe[0] ) ;
  8783. +    close( in_pipe[1] ) ;
  8784. +    close( data_pipe[1] ) ;
  8785. +    PmSessionStart = 1 ;
  8786. +
  8787. +    clear_screen_hook         = PM_clear_screen ;
  8788. +    clear_end_of_line_hook     = PM_clear_end_of_line ;
  8789. +    ins_del_lines_hook         = PM_ins_del_lines ;
  8790. +    set_terminal_window_hook     = PM_set_terminal_window ;
  8791. +    change_line_highlight_hook     = PM_change_line_highlight ;
  8792. +    reassert_line_highlight_hook = PM_reassert_line_highlight ;
  8793. +    ring_bell_hook         = PM_ring_bell ;
  8794. +    set_terminal_modes_hook     = PM_set_terminal_modes ;
  8795. +    update_begin_hook         = PM_update_begin ;
  8796. +    update_end_hook         = PM_update_end ;
  8797. +    move_cursor_hook         = PM_move_cursor ;
  8798. +    read_socket_hook         = PM_read_socket ;
  8799. +    output_chars_hook         = PM_output_chars ;
  8800. +
  8801. +    visible_bell = 1;
  8802. +    scroll_region_ok = 0 ;        /* we won't scroll partial frames */
  8803. +    char_ins_del_ok = 0 ;        /* just as fast to write the line */
  8804. +    line_ins_del_ok = 1 ;        /* use GpiBitBlt */
  8805. +    fast_clear_end_of_line = 1 ;    /* PM does this well */
  8806. +    memory_below_screen = 0 ;        /* we don't remember what scrolls 
  8807. +                       off the bottom */
  8808. +    dont_calculate_costs = 1 ;
  8809. +
  8810. +    baud_rate = 38400 ;
  8811. +
  8812. +    screen_width = 80 ;
  8813. +    screen_height = 25 ;
  8814. +
  8815. +    /* ÅIù╣âtâbâNâZâbâg */
  8816. +    Vkill_emacs_hook = intern( "pm-kill-emacs" ) ;
  8817. +
  8818. +    /* âTâXâyâôâhâtâbâNâZâbâg */
  8819. +    Vsuspend_emacs_hook = intern( "suspend-hook" ) ;
  8820. +    XSYMBOL( Vsuspend_emacs_hook )->value = intern( "pm-suspend" ) ;
  8821. +}
  8822. +
  8823. +
  8824. +/************************************************************************/
  8825. +/************************************************************************/
  8826. +/************************************************************************/
  8827. +/************************************************************************/
  8828. +
  8829. +static void check_pmterm( )
  8830. +{
  8831. +  if ( NULL( Vos2pmterm ) )
  8832. +    error( "Terminal does not understand PM protocol." ) ;
  8833. +}
  8834. +
  8835. +
  8836. +/************************************************************************/
  8837. +/*                                    */
  8838. +/*                                    */
  8839. +/*        â}âEâXâCâxâôâgÅêù¥îQ                    */
  8840. +/*                                    */
  8841. +/*                                    */
  8842. +/************************************************************************/
  8843. +
  8844. +DEFUN( "x-mouse-events", Fx_mouse_events, Sx_mouse_events, 0, 0, 0,
  8845. +  "Return number of pending mouse events from PM window system." )
  8846. + ( )
  8847. +{
  8848. +    register Lisp_Object tem ;
  8849. +
  8850. +    check_pmterm( ) ;
  8851. +    if ( MouseItem )
  8852. +    XSET( tem, Lisp_Int, 1 ) ;
  8853. +    else
  8854. +    XSET( tem, Lisp_Int, 0 ) ;
  8855. +    return tem ;
  8856. +}
  8857. +
  8858. +DEFUN( "x-proc-mouse-event", Fx_proc_mouse_event, Sx_proc_mouse_event,
  8859. +  0, 0, 0,
  8860. +  "Pulls a mouse event out of the mouse event buffer and dispatches\n\
  8861. +the appropriate function to act upon this event." )
  8862. + ( )
  8863. +{
  8864. +    register Lisp_Object Mouse_Cmd, ret ;
  8865. +
  8866. +    check_pmterm( ) ;
  8867. +    Vx_mouse_item = make_number( MouseItem ) ;
  8868. +    Mouse_Cmd = get_keyelt( access_keymap( MouseMap, MouseItem ) ) ;
  8869. +    if ( NULL( Mouse_Cmd ) ) {
  8870. +    Vx_mouse_pos = Qnil ;
  8871. +    ret = Qnil ;
  8872. +    } else {
  8873. +    ret = call1( Mouse_Cmd, Vx_mouse_pos ) ;
  8874. +    }
  8875. +    MouseItem = 0 ;
  8876. +    return ret ;
  8877. +}
  8878. +
  8879. +DEFUN( "x-get-mouse-p", Fx_get_mouse_p, Sx_get_mouse_p,
  8880. +       0, 0, 0,
  8881. +       "Return the current mouse position." )
  8882. +( )
  8883. +{
  8884. +    pmd_mousepos result ;
  8885. +    pm_request pmr ;
  8886. +
  8887. +    pmr.header.type = PMR_MOUSEPOS ;
  8888. +    pm_send( &pmr, sizeof( pmr ) ) ;
  8889. +    pm_receive_data( &result, sizeof( result ) ) ;
  8890. +    return( Fcons( result.x, Fcons( result.y, Qnil ) ) ) ;
  8891. +}
  8892. +
  8893. +DEFUN( "coordinates-in-window-p", Fcoordinates_in_window_p,
  8894. +  Scoordinates_in_window_p, 2, 2, 0,
  8895. +  "Return non-nil if POSITIONS( a list,( SCREEN-X SCREEN-Y ) ) is in WINDOW.\n\
  8896. +Returned value is list of positions expressed\n\
  8897. +relative to window upper left corner." )
  8898. + ( coordinate, window )
  8899. +     register Lisp_Object coordinate, window ;
  8900. +{
  8901. +    register Lisp_Object xcoord, ycoord ;
  8902. +    
  8903. +    if ( !CONSP( coordinate ) )
  8904. +    wrong_type_argument( Qlistp, coordinate ) ;
  8905. +    CHECK_WINDOW( window, 2 ) ;
  8906. +    xcoord = Fcar( coordinate ) ;
  8907. +    ycoord = Fcar( Fcdr( coordinate ) ) ;
  8908. +    CHECK_NUMBER( xcoord, 0 ) ;
  8909. +    CHECK_NUMBER( ycoord, 1 ) ;
  8910. +    if ( ( XINT( xcoord ) < XINT( XWINDOW( window )->left ) ) ||
  8911. +    ( XINT( xcoord ) >=( XINT( XWINDOW( window )->left ) +
  8912. +               XINT( XWINDOW( window )->width ) ) ) )
  8913. +    {
  8914. +        return Qnil ;
  8915. +    } 
  8916. +    XFASTINT( xcoord ) -= XFASTINT( XWINDOW( window )->left ) ;
  8917. +    if ( XINT( ycoord ) ==( screen_height - 1 ) )
  8918. +    return Qnil ;
  8919. +    if ( ( XINT( ycoord ) < XINT( XWINDOW( window )->top ) ) ||
  8920. +    ( XINT( ycoord ) >=( XINT( XWINDOW( window )->top ) +
  8921. +               XINT( XWINDOW( window )->height ) ) - 1 ) )
  8922. +    {
  8923. +        return Qnil ;
  8924. +    }
  8925. +    XFASTINT( ycoord ) -= XFASTINT( XWINDOW( window )->top ) ;
  8926. +    return Fcons( xcoord, Fcons( ycoord, Qnil ) ) ;
  8927. +}
  8928. +
  8929. +
  8930. +/************************************************************************/
  8931. +/*                                    */
  8932. +/*                                    */
  8933. +/*        â|âbâvâAâbâvâüâjâàü[Åêù¥îQ                */
  8934. +/*                                    */
  8935. +/*                                    */
  8936. +/************************************************************************/
  8937. +
  8938. +#define NUL 0
  8939. +
  8940. +Lisp_Object PmPopupMenu( x, y, line_list, pane_list,
  8941. +             line_cnt, pane_cnt, item_list, title, error )
  8942. +int        x, y ;
  8943. +char        **line_list[] ;    /* list of strings for items */
  8944. +char        *pane_list[] ;    /* list of pane titles */
  8945. +char        *title ;
  8946. +int        pane_cnt ;    /* total number of panes */
  8947. +Lisp_Object    *item_list[] ;    /* All items */
  8948. +int        line_cnt[] ;    /* Lines in each pane */
  8949. +char        **error ;    /* Error returned */
  8950. +{
  8951. +    int last, panes, selidx, lpane, status ;
  8952. +    int lines, sofar ;
  8953. +    int total_size ;
  8954. +    Lisp_Object entry ;
  8955. +    pm_request pmr ;
  8956. +    pm_popup_menu popupmenu ;
  8957. +    pm_menu_pane pmp ;
  8958. +    pm_menu_line pml ;
  8959. +    char *buf, *p ;
  8960. +
  8961. +    *error =( char * ) 0 ;        /* Initialize error pointer to null */
  8962. +
  8963. +    if ( title == 0 )
  8964. +    title = "untitled" ;
  8965. +
  8966. +    total_size = strlen( title ) ;
  8967. +    for ( panes = 0, lines = 0; panes < pane_cnt;
  8968. +      lines += line_cnt[panes], ++panes ) {
  8969. +    total_size += sizeof( pmp ) + strlen( pane_list[panes] ) ;
  8970. +    for ( selidx = 0; selidx < line_cnt[panes]; ++selidx )
  8971. +        total_size += sizeof( pml ) + strlen( line_list[panes][selidx] ) ;
  8972. +    }
  8973. +
  8974. +    buf = p = alloca( total_size ) ;
  8975. +
  8976. +    pmr.header.type = PMR_POPUPMENU ;
  8977. +    pm_send( &pmr, sizeof( pmr ) ) ;
  8978. +    popupmenu.panes = pane_cnt ;
  8979. +    popupmenu.lines = lines ;
  8980. +    popupmenu.button =( MouseItem & 3 ) ;
  8981. +    popupmenu.x = x ;
  8982. +    popupmenu.y = y ;
  8983. +    popupmenu.title_size = strlen( title ) ;
  8984. +    popupmenu.size = total_size ;
  8985. +    pm_send( &popupmenu, sizeof( popupmenu ) ) ;
  8986. +    strcpy( p, title ) ; p += strlen( title ) ;
  8987. +
  8988. +    for ( panes = 0, sofar = 0; panes < pane_cnt;
  8989. +      sofar += line_cnt[panes], ++panes ) {
  8990. +    pmp.lines = line_cnt[panes] ;
  8991. +    pmp.size = strlen( pane_list[panes] ) ;
  8992. +    memcpy( p, &pmp, sizeof( pmp ) ) ; p += sizeof( pmp ) ;
  8993. +    strcpy( p, pane_list[panes] ) ; p += strlen( pane_list[panes] ) ;
  8994. +    for ( selidx = 0; selidx < line_cnt[panes]; ++selidx ) {
  8995. +        pml.item =( unsigned long )( ( panes << 16 ) |( selidx + 1 ) ) ;
  8996. +        pml.enable = 1 ;
  8997. +        pml.size = strlen( line_list[panes][selidx] ) ;
  8998. +        memcpy( p, &pml, sizeof( pml ) ) ; p += sizeof( pml ) ;
  8999. +        strcpy( p, line_list[panes][selidx] ) ;
  9000. +        p += strlen( line_list[panes][selidx] ) ;
  9001. +    }
  9002. +    }
  9003. +    pm_send( buf, total_size ) ;
  9004. +
  9005. +    pm_receive_data( &entry, sizeof( entry ) ) ;
  9006. +    if ( entry == 0 )
  9007. +    entry = Qnil ;
  9008. +    else {
  9009. +    panes = entry >> 16 ;
  9010. +    selidx =( entry & 0xffff ) - 1 ;
  9011. +    entry = item_list[panes][selidx] ;
  9012. +    }
  9013. +    pmr.header.type = PMR_POPUPMENUDESTROY ;
  9014. +    pm_send( &pmr, sizeof( pmr ) ) ;
  9015. +    return( entry ) ;
  9016. +}
  9017. +
  9018. +list_of_panes( vector, panes, names, items, menu )
  9019. +Lisp_Object    ***vector ;    /* RETURN all menu objects */
  9020. +char        ***panes ;    /* RETURN pane names */
  9021. +char        ****names ;    /* RETURN all line names */
  9022. +int        **items ;    /* RETURN number of items per pane */
  9023. +Lisp_Object    menu ;
  9024. +{
  9025. +    Lisp_Object tail, item, item1 ;
  9026. +    int i, len ;
  9027. +    coding_type code ;
  9028. +  
  9029. +    CODE_TYPE_SET( &code, SJIS ) ;
  9030. +    CODE_CNTL( &code ) |= CC_END ;
  9031. +
  9032. +    if ( XTYPE( menu ) != Lisp_Cons )
  9033. +    menu = wrong_type_argument( Qlistp, menu ) ;
  9034. +  
  9035. +    i= XFASTINT( Flength( menu,1 ) ) ;
  9036. +
  9037. +    *vector =( Lisp_Object ** ) malloc( i * sizeof( Lisp_Object * ) ) ;
  9038. +    *panes =( char ** ) malloc( i * sizeof( char * ) ) ;
  9039. +    *items =( int * ) malloc( i * sizeof( int ) ) ;
  9040. +    *names =( char *** ) malloc( i * sizeof( char ** ) ) ;
  9041. +
  9042. +    for ( i = 0, tail = menu; !NULL( tail ); tail = Fcdr( tail ), ++i ) {
  9043. +    item = Fcdr( Fcar( tail ) ) ;
  9044. +    if ( XTYPE( item ) != Lisp_Cons )
  9045. +       ( void ) wrong_type_argument( Qlistp, item ) ;
  9046. +    item1 = Fcar( Fcar( tail ) ) ;
  9047. +    CHECK_STRING( item1, 1 ) ;
  9048. +    len = XSTRING( item1 )->size + 1 ;
  9049. +    ( *panes )[i] =( unsigned char * ) malloc( CONV_BUF_SIZE( len, SJIS ) ) ;
  9050. +    len = decode( &code,
  9051. +            ( char * ) XSTRING( item1 )->data,
  9052. +            ( *panes )[i],
  9053. +             len ) ;
  9054. +    ( *items )[i] = list_of_items( ( *vector )+i,( *names )+i, item ) ;
  9055. +    }
  9056. +    return i ;
  9057. +}
  9058. +
  9059. +list_of_items( vector,names,pane )  /* get list from emacs and put to vector */
  9060. +Lisp_Object    **vector ;    /* RETURN menu "objects" */
  9061. +char        ***names ;    /* RETURN line names */
  9062. +Lisp_Object    pane ;
  9063. +{
  9064. +    Lisp_Object tail, item, item1 ;
  9065. +    int i, len ;
  9066. +    coding_type code ;
  9067. +
  9068. +    CODE_TYPE_SET( &code, SJIS ) ;
  9069. +    CODE_CNTL( &code ) |= CC_END ;
  9070. +
  9071. +    if ( XTYPE( pane ) != Lisp_Cons )
  9072. +    pane = wrong_type_argument( Qlistp, pane ) ;
  9073. +  
  9074. +    i= XFASTINT( Flength( pane,1 ) ) ;
  9075. +
  9076. +    *vector =( Lisp_Object * ) malloc( i * sizeof( Lisp_Object ) ) ;
  9077. +    *names =( char ** ) malloc( i * sizeof( char * ) ) ;
  9078. +
  9079. +    for ( i = 0, tail = pane; !NULL( tail ); tail = Fcdr( tail ), ++i ) {
  9080. +    item = Fcar( tail ) ;
  9081. +    if ( XTYPE( item ) != Lisp_Cons )
  9082. +       ( void ) wrong_type_argument( Qlistp, item ) ;
  9083. +    ( *vector )[i] =  Fcdr( item ) ;
  9084. +    item1 = Fcar( item ) ;
  9085. +    CHECK_STRING( item1, 1 ) ;
  9086. +    len = XSTRING( item1 )->size + 1 ;
  9087. +    ( *names )[i] =( char * ) malloc( CONV_BUF_SIZE( len, SJIS ) ) ;
  9088. +    len = decode( &code,
  9089. +            ( char * )XSTRING( item1 )->data,
  9090. +            ( *names )[i],
  9091. +             len ) ;
  9092. +    }
  9093. +    return i ;
  9094. +}
  9095. +
  9096. +DEFUN( "x-popup-menu",Fx_popup_menu, Sx_popup_menu, 1, 2, 0,
  9097. +       "Interface to XMenu library ; permits creation and use of\n\
  9098. +deck-of-cards pop-up menus.\n\
  9099. +\n\
  9100. +ARG is a position specification ; it is a list of( Xoffset, Yoffset )\n\
  9101. +from the top-left corner of the editor window.  Note that this offset\n\
  9102. +is relative to the center of the first line in the first pane of the\n\
  9103. +menu, not the top left of the menu as a whole.\n\
  9104. +\n\
  9105. +MENU is a specifier for a menu.  It is a list of the form\n\
  9106. +( title pane1 pane2... ), and each pane is a list of form\n\
  9107. +( title( line item )... ).  Each line should be a string, and item should\n\
  9108. +be the return value for that line( i. e. if it is selected." )
  9109. +      ( arg,menu )
  9110. +     Lisp_Object arg,menu ;
  9111. +{
  9112. +    int        number_of_panes ;
  9113. +    Lisp_Object    XMenu_return ;
  9114. +    int        XMenu_xpos,XMenu_ypos ;
  9115. +    char    **menus ;
  9116. +    char    ***names ;
  9117. +    Lisp_Object    **obj_list ;
  9118. +    int        *items ;
  9119. +    char    *title ;
  9120. +    char    *error_name ;
  9121. +    Lisp_Object    ltitle, selection ;
  9122. +    int        i, j ;
  9123. +    coding_type code ;
  9124. +
  9125. +    check_pmterm( ) ;
  9126. +    if ( Vx_mouse_pos != Qnil ) {
  9127. +    XMenu_xpos = Fcar( Vx_mouse_pos ) ;
  9128. +    XMenu_ypos = Fcar( Fcdr( Vx_mouse_pos ) ) ;
  9129. +    } else {
  9130. +    XMenu_xpos = 0 ;
  9131. +    XMenu_ypos = 0 ;
  9132. +    }
  9133. +
  9134. +    CODE_TYPE_SET( &code, SJIS ) ;
  9135. +    CODE_CNTL( &code ) |= CC_END ;
  9136. +
  9137. +    ltitle = Fcar( menu ) ;
  9138. +    CHECK_STRING( ltitle,1 ) ;
  9139. +
  9140. +    i = strlen( ( char * )XSTRING( ltitle )->data ) + 1 ;
  9141. +    title =( char * ) malloc( CONV_BUF_SIZE( i, SJIS ) ) ;
  9142. +    i = decode( &code,( char * )XSTRING( ltitle )->data, title, i ) ;
  9143. +
  9144. +    number_of_panes=list_of_panes( &obj_list, &menus, &names, &items,
  9145. +                  Fcdr( menu ) ) ;
  9146. +
  9147. +#ifdef PMDEBUG
  9148. +    fprintf( stderr,"Title= \"%s\"\n", title ) ;
  9149. +    fprintf( stderr,"Panes= %d\n", number_of_panes ) ;
  9150. +    for ( i=0; i < number_of_panes; ++i ) {
  9151. +    fprintf( stderr,"Pane %d lines %d title \"%s\"\n",
  9152. +         i, items[i], menus[i] ) ;
  9153. +    for ( j = 0; j < items[i]; ++j ) {
  9154. +        fprintf( stderr,"    Item %d \"%s\"\n", j, names[i][j] ) ;
  9155. +    }
  9156. +    }
  9157. +#endif
  9158. +    selection = PmPopupMenu( XMenu_xpos, XMenu_ypos, names, menus,
  9159. +                 items, number_of_panes, obj_list, title,
  9160. +                 &error_name ) ;
  9161. +#ifdef PMDEBUG
  9162. +    fprintf( stderr,"selection = %x\n",selection ) ;
  9163. +#endif
  9164. +    if ( selection != NUL ) {
  9165. +    /* selected something */
  9166. +    XMenu_return = selection ;
  9167. +    } else {
  9168. +    /* nothing selected */
  9169. +    XMenu_return = Qnil ;
  9170. +    }
  9171. +    /* now free up the strings */
  9172. +    for ( i = 0; i < number_of_panes; ++i ) {
  9173. +    free( menus[i] ) ;
  9174. +    for ( j = 0; j < items[i]; ++j )
  9175. +        free( names[i][j] ) ;
  9176. +    free( names[i] ) ;
  9177. +    free( obj_list[i] ) ;
  9178. +    }
  9179. +    free( menus ) ;
  9180. +    free( obj_list ) ;
  9181. +    free( names ) ;
  9182. +    free( items ) ;
  9183. +    free( title ) ;
  9184. +    if ( error_name ) error( error_name ) ;
  9185. +    return XMenu_return ;
  9186. +}
  9187. +
  9188. +
  9189. +/************************************************************************/
  9190. +/*                                    */
  9191. +/*                                    */
  9192. +/*        âNâïâbâvâ{ü[âhÅêù¥îQ                    */
  9193. +/*                                    */
  9194. +/*                                    */
  9195. +/************************************************************************/
  9196. +
  9197. +DEFUN( "x-store-cut-buffer", Fx_store_cut_buffer, Sx_store_cut_buffer,
  9198. +  1, 1, 0,
  9199. +  "Store contents of STRING into the clipboard of the PM window system." )
  9200. + ( string )
  9201. +     Lisp_Object string ;
  9202. +{
  9203. +    pm_request    pmr ;
  9204. +    int        len ;
  9205. +    char    *buf ;
  9206. +    coding_type    code ;
  9207. +
  9208. +    CHECK_STRING( string, 0 ) ;
  9209. +    CODE_TYPE_SET( &code, SJIS ) ;
  9210. +    CODE_CNTL( &code ) |= CC_END ;
  9211. +
  9212. +    len = XSTRING( string )->size + 1 ;
  9213. +    buf = ( char * ) alloca( CONV_BUF_SIZE( len, SJIS ) ) ;
  9214. +    len = decode( &code, ( char * )XSTRING( string )->data, buf , len ) ;
  9215. +    pmr.cut.header.type = PMR_CUT ;
  9216. +    pmr.cut.size = len ;
  9217. +    pm_send( &pmr, sizeof( pmr ) ) ;
  9218. +    pm_send( buf, len ) ;
  9219. +    return Qnil ;
  9220. +}
  9221. +
  9222. +DEFUN( "x-get-cut-buffer", Fx_get_cut_buffer, Sx_get_cut_buffer, 0, 0, 0,
  9223. +  "Return contents of clipboard of the PM window system, as a string." )
  9224. + ( )
  9225. +{
  9226. +    pm_request    pmr ;
  9227. +    int        size ;
  9228. +    char    *buf, *sendbuf ;
  9229. +    coding_type    code ;
  9230. +    Lisp_Object    dummy ;
  9231. +
  9232. +    pmr.paste.header.type = PMR_PASTE ;
  9233. +    pmr.paste.get_text = 1 ;
  9234. +    pm_send( &pmr, sizeof( pmr ) ) ;
  9235. +    pm_receive_data( &size, sizeof( size ) ) ;
  9236. +    buf = alloca( size ) ;
  9237. +    pm_receive_data( buf, size ) ;
  9238. +    CODE_TYPE_SET( &code, SJIS ) ;
  9239. +    CODE_CHAR_SET( &code, 0 ) ;
  9240. +    CODE_FORM( &code ) = CODE_EOL_CRLF ;
  9241. +    CODE_CNTL( &code ) |= CC_END ;
  9242. +    sendbuf = ( char * ) alloca( CONV_BUF_SIZE( size, ITNCODE ) ) ;
  9243. +    size = encode( &code, buf, sendbuf, size, &dummy) ;
  9244. +    return make_string( sendbuf, size ) ;
  9245. +}
  9246. +
  9247. +
  9248. +/************************************************************************/
  9249. +/*                                    */
  9250. +/*                                    */
  9251. +/*        éoélö┼éléòéîéàÉΩùpâtâbâNÅêù¥îQ                */
  9252. +/*                                    */
  9253. +/*                                    */
  9254. +/************************************************************************/
  9255. +
  9256. +DEFUN( "pm-kill-emacs", Fpm_kill_emacs, Spm_kill_emacs, 0, 0, 0,
  9257. +  "Kill PM Mule process and pipe handle closed." )
  9258. + ( )
  9259. +{
  9260. +    pm_request pmr ;
  9261. +
  9262. +    pmr.header.type = PMR_DESTROY ;
  9263. +    pm_send( &pmr, sizeof( pmr ) ) ;
  9264. +    PmSessionStart = 0 ;
  9265. +    close( OutPipe ) ;
  9266. +    close( DataPipe ) ;
  9267. +    close( 0 ) ;
  9268. +}
  9269. +
  9270. +DEFUN( "pm-suspend", Fpm_suspend, Spm_suspend, 0, 0, 0,
  9271. +  "Suspend PM window system." )
  9272. + ( )
  9273. +{
  9274. +    pm_request pmr ;
  9275. +
  9276. +    /* î╗ì▌Ä└î╗é╖éΘéóéóò√û@é¬î⌐é┬é⌐é┴é─éóé╚éóé»éΩé╟üAĵéΦè╕éªé╕üA
  9277. +       âCâxâôâgé═æùé┴é─é¿é¡ */
  9278. +    pmr.header.type = PMR_SUSPEND ;
  9279. +    pm_send( &pmr, sizeof( pmr ) ) ;
  9280. +    message1( "Suspending an Mule running under PM isn't a good idea" ) ;
  9281. +    return Qt ;
  9282. +}
  9283. +
  9284. +/************************************************************************/
  9285. +/*                                    */
  9286. +/*                                    */
  9287. +/*        âtâHâôâgè╓ÿAÅêù¥îQ                    */
  9288. +/*                                    */
  9289. +/*                                    */
  9290. +/************************************************************************/
  9291. +
  9292. +DEFUN( "pm-list-fonts", Fpm_list_fonts, Spm_list_fonts, 1, 1, 0,
  9293. +       "Return a list of the names of available fonts matching PATTERN.\n\
  9294. +\n\
  9295. +PATTERN is a string, perhaps with wildcard characters ;\n\
  9296. +  the * character matches any substring, and\n\
  9297. +  the ? character matches any single character.\n\
  9298. +  PATTERN is case-insensitive.\n\
  9299. +\n\
  9300. +The return value is a list of strings, suitable as arguments to\n\
  9301. +pm-set-font.\n\
  9302. +\n\
  9303. +The list does not include fonts Emacs can't use( i.e.  proportional\n\
  9304. +fonts ), even if they match PATTERN." )
  9305. +   ( pattern )
  9306. +    Lisp_Object pattern ;
  9307. +{
  9308. +    pm_request        pmr ;
  9309. +    pmd_fontlist    answer ;
  9310. +    unsigned char    *buf ;
  9311. +    Lisp_Object        *list ;
  9312. +    int            lp, len ;
  9313. +
  9314. +    check_pmterm( ) ;
  9315. +    len = XSTRING( pattern )->size ;
  9316. +    if ( len > 511 ) len = 511 ;
  9317. +    pmr.fontlist.header.type = PMR_FONTLIST ;
  9318. +    pmr.fontlist.pattern_length = len ;
  9319. +    pm_send( &pmr, sizeof( pmr ) ) ;
  9320. +    pm_send( XSTRING( pattern )->data, len ) ;
  9321. +    pm_receive_data( &answer, sizeof( answer ) ) ;
  9322. +    buf = alloca( answer.size ) ;
  9323. +    pm_receive_data( buf, answer.size ) ;
  9324. +    list = alloca( answer.count * sizeof( Lisp_Object ) ) ;
  9325. +    for ( lp = 0; lp < answer.count; ++lp ) {
  9326. +    len = *buf++ ;
  9327. +    list[lp] = make_string( buf, len ) ;
  9328. +    buf += len ;
  9329. +    }
  9330. +    return Flist( lp, list ) ;
  9331. +}
  9332. +
  9333. +DEFUN( "pm-set-font", Fpm_set_font, Spm_set_font, 1, 1, "sFont Name: ",
  9334. +      "At initialization sets the font to be used for the PM window." )
  9335. +   ( fontname )
  9336. +    Lisp_Object fontname ;
  9337. +{
  9338. +    pm_request pmr ;
  9339. +    pmd_fontlist answer ;
  9340. +    unsigned char *buf, *p ;
  9341. +    Lisp_Object *list ;
  9342. +    int i, len, n, count ;
  9343. +
  9344. +    check_pmterm( ) ;
  9345. +    CHECK_STRING( fontname, 0 ) ;
  9346. +    len = XSTRING( fontname )->size ;
  9347. +    if ( len > 511 ) len = 511 ;
  9348. +
  9349. +    pmr.setfont.header.type = PMR_SETFONT ;
  9350. +    pmr.setfont.fontname_length = len ;
  9351. +    pm_send( &pmr, sizeof( pmr ) ) ;
  9352. +    pm_send( XSTRING( fontname )->data, len ) ;
  9353. +    return Qt ;
  9354. +}
  9355. +
  9356. +
  9357. +/************************************************************************/
  9358. +/*                                    */
  9359. +/*                                    */
  9360. +/*        âtâîü[âÇâRâôâgâìü[âïÉ▌ÆΦÅêù¥îQ                */
  9361. +/*                                    */
  9362. +/*                                    */
  9363. +/************************************************************************/
  9364. +
  9365. +static int ConvertColor( Lisp_Object dat )
  9366. +{
  9367. +    char    *col ;
  9368. +    int        red, blue, green ;
  9369. +
  9370. +    col =( char * ) alloca( XSTRING( dat )->size + 1 ) ;
  9371. +    bcopy( XSTRING( dat )->data, col, XSTRING( dat )->size + 1 ) ;
  9372. +    col[XSTRING( dat )->size] = 0 ;
  9373. +    sscanf( col, "%d %d %d", &red, &green, &blue ) ;
  9374. +    return ( ( red << 16 ) | ( green << 8 ) | blue ) ;
  9375. +}
  9376. +
  9377. +DEFUN( "pm-set-foreground-color", Fpm_set_foreground_color,
  9378. +       Spm_set_foreground_color, 1, 1, "sSet foregroud color: ",
  9379. +       "Set foreground ( text ) color to COLOR." )
  9380. + ( arg )
  9381. +     Lisp_Object arg ;
  9382. +{
  9383. +    pm_request    pmr ;
  9384. +
  9385. +    check_pmterm( ) ;
  9386. +    CHECK_STRING( arg,1 ) ;
  9387. +    pmr.setcolor.header.type    = PMR_SETCOLOR ;
  9388. +    pmr.setcolor.fore = ConvertColor( arg ) ;
  9389. +    pmr.setcolor.back = COLOR_NONE ;
  9390. +    pm_send( &pmr, sizeof( pmr ) ) ;
  9391. +    return Qt ;
  9392. +}
  9393. +
  9394. +DEFUN( "pm-set-background-color", Fpm_set_background_color,
  9395. +       Spm_set_background_color, 1, 1, "sSet background color: ",
  9396. +       "Set background ( text ) color to COLOR." )
  9397. + ( arg )
  9398. +     Lisp_Object arg ;
  9399. +{
  9400. +    pm_request    pmr ;
  9401. +
  9402. +    check_pmterm( ) ;
  9403. +    CHECK_STRING( arg,1 ) ;
  9404. +    pmr.setcolor.header.type = PMR_SETCOLOR ;
  9405. +    pmr.setcolor.fore = COLOR_NONE ;
  9406. +    pmr.setcolor.back = ConvertColor( arg ) ;
  9407. +    pm_send( &pmr, sizeof( pmr ) ) ;
  9408. +    return Qt ;
  9409. +}
  9410. +
  9411. +DEFUN( "pm-set-highlight-foreground-color", Fpm_set_highlight_foreground_color,
  9412. +       Spm_set_highlight_foreground_color, 1, 1,
  9413. +      "sSet highlight foregroud color: ",
  9414. +       "Set foreground ( highlight text ) color to COLOR." )
  9415. + ( arg )
  9416. +     Lisp_Object arg ;
  9417. +{
  9418. +    pm_request    pmr ;
  9419. +
  9420. +    check_pmterm( ) ;
  9421. +    CHECK_STRING( arg,1 ) ;
  9422. +    pmr.setcolor.header.type    = PMR_SETHICOLOR ;
  9423. +    pmr.setcolor.fore = ConvertColor( arg ) ;
  9424. +    pmr.setcolor.back = COLOR_NONE ;
  9425. +    pm_send( &pmr, sizeof( pmr ) ) ;
  9426. +    return Qt ;
  9427. +}
  9428. +
  9429. +DEFUN( "pm-set-highlight-background-color", Fpm_set_highlight_background_color,
  9430. +       Spm_set_highlight_background_color, 1, 1,
  9431. +      "sSet highlight background color: ",
  9432. +       "Set background color to COLOR." )
  9433. + ( arg )
  9434. +     Lisp_Object arg ;
  9435. +{
  9436. +    pm_request    pmr ;
  9437. +
  9438. +    check_pmterm( ) ;
  9439. +    CHECK_STRING( arg,1 ) ;
  9440. +    pmr.setcolor.header.type    = PMR_SETHICOLOR ;
  9441. +    pmr.setcolor.fore = COLOR_NONE ;
  9442. +    pmr.setcolor.back = ConvertColor( arg ) ;
  9443. +    pm_send( &pmr, sizeof( pmr ) ) ;
  9444. +    return Qt ;
  9445. +}
  9446. +
  9447. +DEFUN( "pm-set-cursor-type", Fpm_set_cursor_type,
  9448. +       Spm_set_cursor_type, 1, 1, "sSet cursor type: ",
  9449. +       "Set cursor type.\n\
  9450. +TYPE Pattern is box, bar, frame, underline, and halftone." )
  9451. + ( arg )
  9452. +     Lisp_Object arg ;
  9453. +{
  9454. +    pm_request    pmr ;
  9455. +    char    *cursor_type ;
  9456. +    int        type ;
  9457. +
  9458. +    check_pmterm( ) ;
  9459. +    CHECK_STRING( arg,1 ) ;
  9460. +
  9461. +    cursor_type =( char * ) alloca( XSTRING( arg )->size + 1 ) ;
  9462. +    bcopy( XSTRING( arg )->data, cursor_type, XSTRING( arg )->size + 1 ) ;
  9463. +    cursor_type[XSTRING( arg )->size] = 0 ;
  9464. +    if ( strcmp( cursor_type, "box" ) == 0 ) {
  9465. +    type = CURSORTYPE_BOX ;
  9466. +    } else if ( strcmp( cursor_type, "bar" ) == 0 ) {
  9467. +    type = CURSORTYPE_BAR ;
  9468. +    } else if ( strcmp( cursor_type, "frame" ) == 0 ) {
  9469. +    type = CURSORTYPE_FRAME ;
  9470. +    } else if ( strcmp( cursor_type, "underline" ) == 0 ) {
  9471. +    type = CURSORTYPE_UNDERLINE ;
  9472. +    } else if ( strcmp( cursor_type, "halftone" ) == 0 ) {
  9473. +    type = CURSORTYPE_HALFTONE ;
  9474. +    } else {
  9475. +    error( "cursor type undefin" ) ;
  9476. +    return Qnil ;
  9477. +    }
  9478. +    pmr.cursortype.header.type = PMR_CURSORTYPE ;
  9479. +    pmr.cursortype.type  = type ;
  9480. +    pmr.cursortype.blink = 0 ;
  9481. +    pm_send( &pmr, sizeof( pmr ) ) ;
  9482. +    return Qt ;
  9483. +}
  9484. +    
  9485. +DEFUN( "pm-set-cursor-blink", Fpm_set_cursor_blink,
  9486. +       Spm_set_cursor_blink, 1, 1, "sSet cursor blink: ",
  9487. +       "Set cursor blink flag." )
  9488. + ( arg )
  9489. +     Lisp_Object arg ;
  9490. +{
  9491. +    pm_request    pmr ;
  9492. +    char    *cursor_type ;
  9493. +    int        type ;
  9494. +
  9495. +    check_pmterm( ) ;
  9496. +    CHECK_STRING( arg,1 ) ;
  9497. +
  9498. +    cursor_type =( char * ) alloca( XSTRING( arg )->size + 1 ) ;
  9499. +    bcopy( XSTRING( arg )->data, cursor_type, XSTRING( arg )->size + 1 ) ;
  9500. +    cursor_type[XSTRING( arg )->size] = 0 ;
  9501. +    if ( strcmp( cursor_type, "yes" ) == 0 ) {
  9502. +    type = PMR_TRUE ;
  9503. +    } else {
  9504. +    type = PMR_FALSE ;
  9505. +    }
  9506. +    pmr.cursortype.header.type = PMR_CURSORTYPE ;
  9507. +    pmr.cursortype.type = 0 ;
  9508. +    pmr.cursortype.blink = type ;
  9509. +    pm_send( &pmr, sizeof( pmr ) ) ;
  9510. +    return Qt ;
  9511. +}
  9512. +    
  9513. +DEFUN( "pm-set-mouse-button-alias", Fpm_set_mouse_button_alias,
  9514. +       Spm_set_mouse_button_alias, 1, 1,
  9515. +      "sSet mouse button alias: ",
  9516. +       "Set mouse button event alias." )
  9517. + ( arg )
  9518. +     Lisp_Object arg ;
  9519. +{
  9520. +    pm_request    pmr ;
  9521. +
  9522. +    check_pmterm( ) ;
  9523. +    CHECK_STRING( arg, 1 ) ;
  9524. +    pmr.mouse.header.type = PMR_MOUSE ;
  9525. +    strncpy( pmr.mouse.button, XSTRING( arg )->data, 3 ) ;
  9526. +    pm_send( &pmr, sizeof( pmr ) ) ;
  9527. +    return Qt ;
  9528. +}
  9529. +
  9530. +DEFUN( "pm-set-window-pos", Fpm_set_window_pos,
  9531. +       Spm_set_window_pos, 1, 1,
  9532. +      "sSet window left & top position: ",
  9533. +       "Set window left & top position." )
  9534. + ( arg )
  9535. +     Lisp_Object arg ;
  9536. +{
  9537. +    pm_request    pmr ;
  9538. +    char    *dat ;
  9539. +    int        left, top ;
  9540. +
  9541. +    check_pmterm( ) ;
  9542. +    CHECK_STRING( arg, 1 ) ;
  9543. +
  9544. +    dat =( char * ) alloca( XSTRING( arg )->size + 1 ) ;
  9545. +    bcopy( XSTRING( arg )->data, dat, XSTRING( arg )->size + 1 ) ;
  9546. +    dat[XSTRING( arg )->size] = 0 ;
  9547. +    sscanf( dat,"%d %d", &left, &top ) ;
  9548. +    pmr.setpos.header.type = PMR_SETPOS ;
  9549. +    pmr.setpos.left = left ;
  9550. +    pmr.setpos.top  = top ;
  9551. +    pm_send( &pmr, sizeof( pmr ) ) ;
  9552. +    return Qt ;
  9553. +}
  9554. +
  9555. +DEFUN( "pm-set-window-size", Fpm_set_window_size,
  9556. +       Spm_set_window_size, 1, 1,
  9557. +      "sSet window size: ",
  9558. +       "Set window size." )
  9559. + ( arg )
  9560. +     Lisp_Object arg ;
  9561. +{
  9562. +    pm_request    pmr ;
  9563. +    char    *dat ;
  9564. +    int        width, height ;
  9565. +
  9566. +    check_pmterm( ) ;
  9567. +    CHECK_STRING( arg, 1 ) ;
  9568. +
  9569. +    dat =( char * ) alloca( XSTRING( arg )->size + 1 ) ;
  9570. +    bcopy( XSTRING( arg )->data, dat, XSTRING( arg )->size + 1 ) ;
  9571. +    dat[XSTRING( arg )->size] = 0 ;
  9572. +    sscanf( dat,"%d %d", &width, &height ) ;
  9573. +    if ( width < 1 )    width = 1 ;
  9574. +    if ( height < 1 )    height = 1 ;
  9575. +    pmr.setsize.header.type = PMR_SETSIZE ;
  9576. +    pmr.setsize.width = width ;
  9577. +    pmr.setsize.height = height ;
  9578. +    pm_send( &pmr, sizeof( pmr ) ) ;
  9579. +    return Qt ;
  9580. +}
  9581. +
  9582. +DEFUN( "pm-set-title-name", Fpm_set_title_name,
  9583. +       Spm_set_title_name, 1, 1,
  9584. +      "sSet window title name: ",
  9585. +       "Set window title name." )
  9586. + ( arg )
  9587. +     Lisp_Object arg ;
  9588. +{
  9589. +    pm_request    pmr ;
  9590. +    char    *dat ;
  9591. +    int        len ;
  9592. +    coding_type code ;
  9593. +
  9594. +    check_pmterm( ) ;
  9595. +    CHECK_STRING( arg, 1 ) ;
  9596. +
  9597. +    CODE_TYPE_SET( &code, SJIS ) ;
  9598. +    CODE_CNTL( &code ) |= CC_END ;
  9599. +    len = XSTRING( arg )->size + 1 ;
  9600. +    dat = ( char * ) alloca( CONV_BUF_SIZE( len, SJIS ) ) ;
  9601. +    len = decode( &code, ( char * )XSTRING( arg )->data, dat , len ) ;
  9602. +    pmr.titlename.header.type = PMR_TITLENAME ;
  9603. +    pmr.titlename.count = len ;
  9604. +    pm_send( &pmr, sizeof( pmr ) ) ;
  9605. +    pm_send( dat, len ) ;
  9606. +    return Qt ;
  9607. +}
  9608. +
  9609. +DEFUN( "pm-get-config", Fpm_get_config,
  9610. +       Spm_get_config, 0, 0, 0,
  9611. +       "Get PM window configration." )
  9612. + ( arg )
  9613. +     Lisp_Object arg ;
  9614. +{
  9615. +    pm_request        pmr ;
  9616. +    pmd_config        config ;
  9617. +    unsigned char    *buf, *convbuf ;
  9618. +    Lisp_Object        *list ;
  9619. +    int            lp, len, convlen ;
  9620. +    coding_type        code ;
  9621. +    Lisp_Object        dummy ;
  9622. +
  9623. +    CODE_TYPE_SET( &code, SJIS ) ;
  9624. +    CODE_CHAR_SET( &code, 0 ) ;
  9625. +    CODE_FORM( &code ) = CODE_EOL_CRLF ;
  9626. +    CODE_CNTL( &code ) |= CC_END ;
  9627. +    pmr.header.type = PMR_CONFIG ;
  9628. +    pm_send( &pmr, sizeof( pmr ) ) ;
  9629. +    pm_receive_data( &config, sizeof( config ) ) ;
  9630. +    buf = alloca( config.size ) ;
  9631. +    pm_receive_data( buf, config.size ) ;
  9632. +    list = alloca( config.count * sizeof( Lisp_Object ) ) ;
  9633. +    for ( lp = 0; lp < config.count; ++lp ) {
  9634. +    len = *buf++ ;
  9635. +    convbuf = get_conversion_buffer( len, SJIS ) ;
  9636. +    convlen = encode( &code, buf, convbuf, len, &dummy) ;
  9637. +    list[lp] = make_string( convbuf, convlen ) ;
  9638. +    buf += len ;
  9639. +    }
  9640. +    return Flist( lp, list ) ;
  9641. +}
  9642. +
  9643. +DEFUN( "pm-set-function-menu", Fpm_set_function_menu,
  9644. +       Spm_set_function_menu, 1, 1, "sSet function key menu display: ",
  9645. +       "Set function menu display flag." )
  9646. + ( arg )
  9647. +     Lisp_Object arg ;
  9648. +{
  9649. +    pm_request    pmr ;
  9650. +    char    *function_menu ;
  9651. +    int        type ;
  9652. +
  9653. +    check_pmterm( ) ;
  9654. +    CHECK_STRING( arg,1 ) ;
  9655. +
  9656. +    function_menu =( char * ) alloca( XSTRING( arg )->size + 1 ) ;
  9657. +    bcopy( XSTRING( arg )->data, function_menu, XSTRING( arg )->size + 1 ) ;
  9658. +    function_menu[XSTRING( arg )->size] = 0 ;
  9659. +
  9660. +    if ( strcmp( function_menu, "yes" ) == 0 )
  9661. +    type = PMR_TRUE ;
  9662. +    else
  9663. +    type = PMR_FALSE ;
  9664. +    pmr.funcmenu.header.type = PMR_FUNCMENU ;
  9665. +    pmr.funcmenu.display = type ;
  9666. +    pm_send( &pmr, sizeof( pmr ) ) ;
  9667. +    return Qt ;
  9668. +}
  9669. +    
  9670. +DEFUN( "pm-set-function-menu-item", Fpm_set_function_menu_item,
  9671. +      Spm_set_function_menu_item, 1, 1,
  9672. +      "sSet function key menu iterm: ",
  9673. +      "Set function menu iterm." )
  9674. + ( arg )
  9675. +     Lisp_Object arg ;
  9676. +{
  9677. +    pm_request    pmr ;
  9678. +    char    *dat ;
  9679. +    int        len ;
  9680. +    coding_type code ;
  9681. +
  9682. +    check_pmterm( ) ;
  9683. +    CHECK_STRING( arg, 1 ) ;
  9684. +
  9685. +    CODE_TYPE_SET( &code, SJIS ) ;
  9686. +    CODE_CNTL( &code ) |= CC_END ;
  9687. +    len = XSTRING( arg )->size + 1 ;
  9688. +    dat = ( char * ) alloca( CONV_BUF_SIZE( len, SJIS ) ) ;
  9689. +    len = decode( &code, ( char * )XSTRING( arg )->data, dat , len ) ;
  9690. +    pmr.funcmenumsg.header.type = PMR_FUNCMENUMSG ;
  9691. +    pmr.funcmenumsg.funcmenu_length = len ;
  9692. +    pm_send( &pmr, sizeof( pmr ) ) ;
  9693. +    pm_send( dat, len ) ;
  9694. +    return Qt ;
  9695. +}
  9696. +
  9697. +DEFUN( "pm-set-shortcut", Fpm_set_shortcut,
  9698. +       Spm_set_shortcut, 1, 1, "sSet short cut: ",
  9699. +       "Set system key short cut mode." )
  9700. + ( arg )
  9701. +     Lisp_Object arg ;
  9702. +{
  9703. +    pm_request    pmr ;
  9704. +    char    *shortcut ;
  9705. +    int        type ;
  9706. +
  9707. +    check_pmterm( ) ;
  9708. +    CHECK_STRING( arg,1 ) ;
  9709. +
  9710. +    shortcut =( char * ) alloca( XSTRING( arg )->size + 1 ) ;
  9711. +    bcopy( XSTRING( arg )->data, shortcut, XSTRING( arg )->size + 1 ) ;
  9712. +    shortcut[XSTRING( arg )->size] = 0 ;
  9713. +
  9714. +    if ( strcmp( shortcut, "yes" ) == 0 )
  9715. +    type = PMR_TRUE ;
  9716. +    else
  9717. +    type = PMR_FALSE ;
  9718. +    pmr.funcmenu.header.type = PMR_SHORTCUT ;
  9719. +    pmr.shortcut.shortcut = type ;
  9720. +    pm_send( &pmr, sizeof( pmr ) ) ;
  9721. +    return Qt ;
  9722. +}
  9723. +
  9724. +/************************************************************************/
  9725. +/************************************************************************/
  9726. +/************************************************************************/
  9727. +/************************************************************************/
  9728. +syms_of_os2pmterm( )
  9729. +{
  9730. +    /* If not dumping, init_display ran before us, so don't override it.  */
  9731. +    DEFVAR_LISP( "x-mouse-item", &Vx_mouse_item,
  9732. +     "Encoded representation of last mouse click, corresponding to\n\
  9733. +numerical entries in x-mouse-map." ) ;
  9734. +    Vx_mouse_item = Qnil ;
  9735. +
  9736. +    DEFVAR_LISP( "x-mouse-pos", &Vx_mouse_pos,
  9737. +         "Current x-y position of mouse by row, column as specified by font." ) ;
  9738. +    Vx_mouse_pos = Qnil ;
  9739. +
  9740. +    DEFVAR_LISP( "PMTERM", &Vos2pmterm, "" ) ;
  9741. +
  9742. +    defsubr( &Sx_mouse_events ) ;
  9743. +    defsubr( &Sx_proc_mouse_event ) ;
  9744. +    defsubr( &Sx_get_mouse_p ) ;
  9745. +    defsubr( &Scoordinates_in_window_p ) ;
  9746. +    defsubr( &Sx_popup_menu ) ;
  9747. +    defsubr( &Sx_store_cut_buffer ) ;
  9748. +    defsubr( &Sx_get_cut_buffer ) ;
  9749. +
  9750. +    defsubr( &Spm_kill_emacs ) ;
  9751. +    defsubr( &Spm_suspend ) ;
  9752. +    defsubr( &Spm_list_fonts ) ;
  9753. +    defsubr( &Spm_set_font ) ;
  9754. +
  9755. +    defsubr( &Spm_set_foreground_color ) ;
  9756. +    defsubr( &Spm_set_background_color ) ;
  9757. +    defsubr( &Spm_set_highlight_foreground_color ) ;
  9758. +    defsubr( &Spm_set_highlight_background_color ) ;
  9759. +    defsubr( &Spm_set_cursor_type ) ;
  9760. +    defsubr( &Spm_set_cursor_blink ) ;
  9761. +    defsubr( &Spm_set_window_pos ) ;
  9762. +    defsubr( &Spm_set_window_size ) ;
  9763. +    defsubr( &Spm_set_title_name ) ;
  9764. +
  9765. +    defsubr( &Spm_set_mouse_button_alias ) ;
  9766. +    defsubr( &Spm_get_config ) ;
  9767. +    defsubr( &Spm_set_function_menu ) ;
  9768. +    defsubr( &Spm_set_function_menu_item ) ;
  9769. +    defsubr( &Spm_set_shortcut ) ;
  9770. +
  9771. +#ifdef CANNOT_DUMP
  9772. +    if ( noninteractive )
  9773. +#endif
  9774. +    Vos2pmterm = Qnil ;
  9775. +}
  9776. diff -urP /mule-1.1/src/process.c ./src/process.c
  9777. --- /mule-1.1/src/process.c    Mon Mar 14 14:46:14 1994
  9778. +++ ./src/process.c    Tue Mar 15 05:05:28 1994
  9779. @@ -117,6 +117,12 @@
  9780.  #define EWOULDBLOCK 1035
  9781.  #endif
  9782.  
  9783. +/* 93.8.20 by O.Sasaki */
  9784. +#ifdef OS2
  9785. +#include <fcntl.h>
  9786. +#endif
  9787. +/* end of patch */
  9788. +
  9789.  #ifdef NEED_BSDTTY
  9790.  #include <sys/bsdtty.h>
  9791.  #endif
  9792. @@ -274,7 +280,8 @@
  9793.  extern sys_nerr;
  9794.  extern char *sys_errlist[];
  9795.  
  9796. -#if !defined(BSD4_1) && !defined(WIN32) /* 93.2.17 by M.Higashida */
  9797. +/* 93.2.17 by M.Higashida, 93.8.20 by O.Sasaki */
  9798. +#if !defined(BSD4_1) && !defined(WIN32) && !defined(OS2)
  9799.  extern char *sys_siglist[];
  9800.  #else
  9801.  char *sys_siglist[] =
  9802. @@ -1107,7 +1114,13 @@
  9803.    if (new_argv[0][0] != '/')
  9804.      {
  9805.        tem = Qnil;
  9806. +/* 93.8.23 by O.Sasaki */
  9807. +#ifdef OS2
  9808. +      openp (Vexec_path, program, ".exe:.com:", &tem, 1);
  9809. +#else
  9810.        openp (Vexec_path, program, "", &tem, 1);
  9811. +#endif
  9812. +/* end of patch */
  9813.        if (NULL (tem))
  9814.      report_file_error ("Searching for program", Fcons (program, Qnil));
  9815.        new_argv[0] = XSTRING (tem)->data;
  9816. @@ -1492,6 +1505,12 @@
  9817.        if (temp < 0) goto io_failure;
  9818.        outchannel = sv[1];
  9819.        forkin = sv[0];
  9820. +/* 93.8.20 by O.Sasaki */
  9821. +#ifdef OS2
  9822. +      setmode (inchannel, O_TEXT);
  9823. +      setmode (outchannel, O_TEXT);
  9824. +#endif
  9825. +/* end of patch */
  9826.      }
  9827.  #endif /* not SKTPAIR */
  9828.  
  9829. @@ -1681,6 +1700,11 @@
  9830.  #endif /* SIGCHLD */
  9831.      if (pty_flag)
  9832.        child_setup_tty (xforkout);
  9833. +/* 93.8.20 by O.Sasaki */
  9834. +#ifdef OS2
  9835. +        pid =
  9836. +#endif
  9837. +/* end of patch */
  9838.      child_setup (xforkin, xforkout, xforkout, new_argv, env);
  9839.        }
  9840.      environ = save_environ;
  9841. @@ -1980,6 +2004,10 @@
  9842.  close_process_descs ()
  9843.  {
  9844.    int i;
  9845. +#ifdef OS2 /* 93.8.20 by O.Sasaki */
  9846. +  for (i = 3; i < MAXDESC; ++i)
  9847. +    fcntl (i, F_SETFD, 1);
  9848. +#else
  9849.    for (i = 0; i < MAXDESC; i++)
  9850.      {
  9851.        Lisp_Object process;
  9852. @@ -1997,6 +2025,8 @@
  9853.          close (XFASTINT (XPROCESS (process)->subtty));
  9854.      }
  9855.      }
  9856. +#endif    /* not OS2 */
  9857. +/* end of patch */
  9858.  }
  9859.  
  9860.  DEFUN ("accept-process-output", Faccept_process_output, Saccept_process_output,
  9861. @@ -2074,7 +2104,11 @@
  9862.    if (time_limit)
  9863.      {
  9864.  #ifdef HAVE_TIMEVAL
  9865. +#ifdef OS2 /* 93.8.20 by O.Sasaki */
  9866. +      gettimeofday (&end_time, 0);
  9867. +#else
  9868.        gettimeofday (&end_time, &garbage);
  9869. +#endif
  9870.        end_time.tv_sec += time_limit;
  9871.  #else /* not HAVE_TIMEVAL */
  9872.        time (&end_time);
  9873. @@ -2149,8 +2183,11 @@
  9874.        else if (time_limit)
  9875.      {
  9876.  #ifdef HAVE_TIMEVAL
  9877. +#ifdef OS2 /* 93.8.20 by O.Sasaki */
  9878. +      gettimeofday (&timeout, 0);
  9879. +#else
  9880.        gettimeofday (&timeout, &garbage);
  9881. -
  9882. +#endif
  9883.        /* In effect, timeout = end_time - timeout.
  9884.           Break if result would be negative.  */
  9885.        if (timeval_subtract (&timeout, end_time, timeout))
  9886. @@ -2551,6 +2588,9 @@
  9887.    register struct Lisp_Process *p = XPROCESS (proc);
  9888.    register int opoint;
  9889.  
  9890. +#ifdef OS2 /* 93.8.20 by O.Sasaki */
  9891. +  fcntl (channel, F_SETFL, O_NDELAY);
  9892. +#endif
  9893.    if (proc_buffered_char[channel] < 0)
  9894.  #ifdef WIN32 /* 93.2.17 by M.Higashida */
  9895.      if (channel < 32)
  9896. @@ -3280,6 +3320,11 @@
  9897.        errno = old_errno;
  9898.        return;
  9899.  #endif /* USG, but not HPUX with WNOHANG */
  9900. +#ifdef OS2 /* 93.8.20 by O.Sasaki */
  9901. +      signal (signo, SIG_ACK);
  9902. +      errno = old_errno;
  9903. +      return;
  9904. +#endif
  9905.      }
  9906.  #endif /* not WIN32 */
  9907.  }
  9908. diff -urP /mule-1.1/src/s-os2.h ./src/s-os2.h
  9909. --- /mule-1.1/src/s-os2.h
  9910. +++ ./src/s-os2.h    Tue Dec 14 13:33:30 1993
  9911. @@ -0,0 +1,149 @@
  9912. +/* Definitions file for GNU Emacs running on IBM's OS/2 2.x
  9913. +   Copyright (C) 1987 Free Software Foundation, Inc.
  9914. +
  9915. +This file is part of GNU Emacs.
  9916. +
  9917. +GNU Emacs is free software; you can redistribute it and/or modify
  9918. +it under the terms of the GNU General Public License as published by
  9919. +the Free Software Foundation; either version 1, or (at your option)
  9920. +any later version.
  9921. +
  9922. +GNU Emacs is distributed in the hope that it will be useful,
  9923. +but WITHOUT ANY WARRANTY; without even the implied warranty of
  9924. +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  9925. +GNU General Public License for more details.
  9926. +
  9927. +You should have received a copy of the GNU General Public License
  9928. +along with GNU Emacs; see the file COPYING.  If not, write to
  9929. +the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  9930. +
  9931. +
  9932. +/*
  9933. + *    Define symbols to identify the version of Unix this is.
  9934. + *    Define all the symbols that apply correctly.
  9935. + */
  9936. +
  9937. +#ifndef OS2       /* avoid problem if OS2 is defined on gcc command line */
  9938. +#define OS2
  9939. +#endif
  9940. +
  9941. +#ifndef OS2PM
  9942. +#define OS2PM
  9943. +#endif
  9944. +
  9945. +/* SYSTEM_TYPE should indicate the kind of system you are using.
  9946. + It sets the Lisp variable system-type.  */
  9947. +
  9948. +#define SYSTEM_TYPE "OS/2"
  9949. +
  9950. +/* nomultiplejobs should be defined if your system's shell
  9951. + does not have "job control" (the ability to stop a program,
  9952. + run some other program, then continue the first one).  */
  9953. +
  9954. +#define NOMULTIPLEJOBS
  9955. +
  9956. +/* Default is to set interrupt_input to 0: don't do input buffering within Emacs */
  9957. +
  9958. +/* #define INTERRUPT_INPUT */
  9959. +
  9960. +/*
  9961. + *    Define HAVE_TERMIO if the system provides sysV-style ioctls
  9962. + *    for terminal control.
  9963. + */
  9964. +
  9965. +#define HAVE_TERMIO
  9966. +
  9967. +/*
  9968. + *    Define HAVE_TIMEVAL if the system supports the BSD style clock values.
  9969. + *    Look in <sys/time.h> for a timeval structure.
  9970. + */
  9971. +
  9972. +#define HAVE_TIMEVAL
  9973. +/*
  9974. + *    Define HAVE_SELECT if the system supports the `select' system call.
  9975. + */
  9976. +
  9977. +#define HAVE_SELECT
  9978. +
  9979. +/* Define HAVE_SOCKETS if system supports 4.2-compatible sockets.  */
  9980. +
  9981. +/* #define HAVE_SOCKETS */
  9982. +
  9983. +/*
  9984. + *    Define NONSYSTEM_DIR_LIBRARY to make Emacs emulate
  9985. + *      The 4.2 opendir, etc., library functions.
  9986. + */
  9987. +
  9988. +/* #define NONSYSTEM_DIR_LIBRARY */
  9989. +
  9990. +/*
  9991. + *     Define SYSV_SYSTEM_DIR to use the V.3 getdents/readir
  9992. + *    library functions.  Almost, but not quite the same as
  9993. + *    the 4.2 functions
  9994. + */
  9995. +/* #define SYSV_SYSTEM_DIR */
  9996. +
  9997. +/* Define this symbol if your system has the functions bcopy, etc. */
  9998. +
  9999. +#define BSTRING
  10000. +
  10001. +/* subprocesses should be defined if you want to
  10002. + have code for asynchronous subprocesses
  10003. + (as used in M-x compile and M-x shell).
  10004. + This is supposed to work now on system V release 2.  */
  10005. +
  10006. +#define subprocesses
  10007. +
  10008. +/* If your system uses COFF (Common Object File Format) then define the
  10009. +   preprocessor symbol "COFF". */
  10010. +
  10011. +/* #define COFF */
  10012. +
  10013. +/* define MAIL_USE_FLOCK if the mailer uses flock
  10014. +   to interlock access to /usr/spool/mail/$USER.
  10015. +   The alternative is that a lock file named
  10016. +   /usr/spool/mail/$USER.lock.  */
  10017. +
  10018. +/* #define MAIL_USE_FLOCK */
  10019. +
  10020. +/* Define CLASH_DETECTION if you want lock files to be written
  10021. +   so that Emacs can tell instantly when you try to modify
  10022. +   a file that someone else has modified in his Emacs.  */
  10023. +
  10024. +/* #define CLASH_DETECTION */
  10025. +
  10026. +
  10027. +/* Text or Binary file translation is done by Emacs. */
  10028. +/* #define FILE_TRANSLATION_MODE */
  10029. +
  10030. +
  10031. +/* Special hacks needed to make Emacs run on this system.  */
  10032. +
  10033. +/*
  10034. + *    Make the sigsetmask function go away.  Don't know what the
  10035. + *    ramifications of this are, but doesn't seem possible to
  10036. + *    emulate it properly anyway at this point.
  10037. + */
  10038. +
  10039. +#define sigsetmask(mask)    /* Null expansion */
  10040. +
  10041. +/* setjmp and longjmp can safely replace _setjmp and _longjmp,
  10042. +   but they will run slower.  */
  10043. +
  10044. +#define _setjmp setjmp
  10045. +#define _longjmp longjmp
  10046. +
  10047. +/* Some variants have TIOCGETC, but the structures to go with it
  10048. +   are not declared.  */
  10049. +
  10050. +#define BROKEN_TIOCGETC
  10051. +
  10052. +#define USE_UTIME
  10053. +
  10054. +
  10055. +#define    PENDING_OUTPUT_COUNT(FILE) ((FILE)->ptr - (FILE)->buffer)
  10056. +#define SYSTEM_MALLOC
  10057. +#define CANNOT_UNEXEC
  10058. +#define SYMS_SYSTEM    syms_of_os2()
  10059. +#define OBJECTS_SYSTEM os2.o
  10060. diff -urP /mule-1.1/src/sysdep.c ./src/sysdep.c
  10061. --- /mule-1.1/src/sysdep.c    Mon Jul 26 14:55:34 1993
  10062. +++ ./src/sysdep.c    Thu Mar 17 12:32:16 1994
  10063. @@ -62,6 +62,10 @@
  10064.  #include "lisp.h"
  10065.  #undef NULL
  10066.  
  10067. +#ifdef OS2 /* 93.8.20 by O.Sasaki */
  10068. +#include <sys/ioctl.h>
  10069. +#endif
  10070. +
  10071.  #define min(x,y) ((x) > (y) ? (y) : (x))
  10072.  
  10073.  /* In this file, open, read and write refer to the system calls,
  10074. @@ -288,7 +292,9 @@
  10075.  #endif /* not HAVE_TERMIO */
  10076.  
  10077.  #ifdef USG
  10078. +#ifndef OS2 /* 93.8.20 by O.Sasaki */
  10079.  #include <sys/utsname.h>
  10080. +#endif
  10081.  #include <string.h>
  10082.  #ifndef MEMORY_IN_STRING_H
  10083.  #include <memory.h>
  10084. @@ -832,6 +838,13 @@
  10085.  
  10086.  sys_suspend ()
  10087.  {
  10088. +#ifdef OS2 /* 93.8.20, 94.3.17 by O.Sasaki */
  10089. +    char *sh ;
  10090. +
  10091. +    if ((sh = getenv("SHELL")) == 0 )
  10092. +    sh = "";
  10093. +    system(sh);
  10094. +#else
  10095.  #ifndef WIN32 /* 93.2.17 by M.Higashida */
  10096.  #ifdef VMS
  10097.    unsigned long parent_id;
  10098. @@ -955,6 +968,7 @@
  10099.  #endif /* no SIGTSTP */
  10100.  #endif /* not VMS */
  10101.  #endif /* not WIN32 */
  10102. +#endif /* not OS2 */
  10103.  }
  10104.  
  10105.  save_signal_handlers (saved_handlers)
  10106. @@ -1156,6 +1170,10 @@
  10107.  #ifdef ISTRIP
  10108.        tty.c_iflag &= ~ISTRIP;    /* don't strip 8th bit on input */
  10109.  #endif
  10110. +#ifdef OS2 /* 93.8.20 by O.Sasaki */
  10111. +      tty.c_lflag &= ~IDEFAULT; /* Enable termio */
  10112. +      tty.c_iflag |= IDELETE;   /* let backspace generate del */
  10113. +#endif
  10114.        tty.c_lflag &= ~ECHO;    /* Disable echo */
  10115.        tty.c_lflag &= ~ICANON;    /* Disable erase/kill processing */
  10116.  #ifdef IEXTEN
  10117. @@ -1452,6 +1470,11 @@
  10118.  #endif /* Sun */
  10119.  #endif /* nec_ews_svr2 */
  10120.  
  10121. +#ifdef OS2 /* 93.8.20 by O.Sasaki */
  10122. +  int sz[2];
  10123. +  _scrsize (sz);
  10124. +  *widthp = sz[0]; *heightp = sz[1];
  10125. +#else
  10126.  /* Do it using the 4.3 names if possible.  */
  10127.  #ifdef TIOCGWINSZ
  10128.    struct winsize size;
  10129. @@ -1497,6 +1520,7 @@
  10130.  /* end of patch */
  10131.  #endif /* system does not know size */
  10132.  #endif /* not TIOCGWINSZ */
  10133. +#endif /* not OS2 */
  10134.  }
  10135.  
  10136.  reset_sys_modes ()
  10137. @@ -1859,6 +1883,8 @@
  10138.  #endif /* VMS */
  10139.  
  10140.  /* Note that VMS compiler won't accept defined (CANNOT_DUMP).  */
  10141. +/* 93.8.20 by O.Sasaki */
  10142. +#ifndef OS2
  10143.  /* 92.11.4 by M.Higashida */
  10144.  #if !(defined(MSDOS) && defined(EMX))
  10145.  #ifndef CANNOT_DUMP
  10146. @@ -1985,6 +2011,7 @@
  10147.  
  10148.  #endif /* not CANNOT_DUMP */
  10149.  #endif /* not MSDOS and EMX */
  10150. +#endif /* OS2 */
  10151.  /* end if patch */
  10152.  
  10153.  /* Get_system_name returns as its value
  10154. @@ -2008,6 +2035,14 @@
  10155.  char *
  10156.  get_system_name ()
  10157.  {
  10158. +#ifdef OS2 /* 93.8.20 by O.Sasaki */
  10159. +static char system_name_saved[255];
  10160. +  char *sp;
  10161. +  if ((sp = getenv ("SYSTEMNAME")) == 0)
  10162. +    sp = "My-System";
  10163. +  strcpy (system_name_saved, sp);
  10164. +  return system_name_saved;
  10165. +#else /* not OS2 */
  10166.  #ifdef USG
  10167.  #ifdef HAVE_GETHOSTNAME
  10168.    gethostname (get_system_name_name, sizeof (get_system_name_name));
  10169. @@ -2039,6 +2074,7 @@
  10170.    return system_name_saved;
  10171.  #endif /* not USG, not 4.1 */
  10172.  #endif /* not USG */
  10173. +#endif /* not OS2 */
  10174.  }
  10175.  
  10176.  /* 91.10.16 by S.Hirano, 93.6.1 by M.Higashida */
  10177. @@ -2070,10 +2106,28 @@
  10178.  #else /* not BSD4_1 */
  10179.    signal (SIGALRM, SIG_IGN);
  10180.  #endif /* not BSD4_1 */
  10181. +#ifdef OS2 /* 93.8.20 by O.Sasaki */
  10182. +  signal(SIGALRM, SIG_ACK);
  10183. +#endif
  10184.    if (read_alarm_should_throw)
  10185.      longjmp (read_alarm_throw, 1);
  10186.  }
  10187.  
  10188. +#ifdef OS2 /* 93.8.20 by O.Sasaki */
  10189. +int request_file_io(int fd, char *buf)
  10190. +{
  10191. +FILE *fp;
  10192. +
  10193. +   fp = fdopen(fd, "b");
  10194. +   if (fp->rcount==0)
  10195. +     return -1;
  10196. +   else
  10197. +     return fp->rcount;  
  10198. +
  10199. +}
  10200. +#endif    /* OS2 */
  10201. +/* end of patch */
  10202. +
  10203.  /* Only rfds are checked.  */
  10204.  int
  10205.  select (nfds, rfds, wfds, efds, timeout)
  10206. @@ -4701,6 +4755,8 @@
  10207.  /* end of patch */
  10208.  
  10209.  
  10210. +/* 93.8.20 by O.Sasaki */
  10211. +#ifndef OS2
  10212.  /* 93.7.26 by K.Handa */
  10213.  #ifndef HAVE_CLOCK
  10214.  #if defined (USG) || defined (VMS)
  10215. @@ -4725,3 +4781,97 @@
  10216.    return RUSAGE_TOTAL (&rusage);
  10217.  }
  10218.  #endif /* not HAVE_CLOCK */
  10219. +#endif /* not OS2 */
  10220. +
  10221. +/*
  10222. + The follwing is entirely for OS/2 93.8.20 by O.Sasaki
  10223. +*/
  10224. +#ifdef OS2
  10225. +
  10226. +#include <fcntl.h>
  10227. +
  10228. +croak (badfunc)
  10229. +     char *badfunc;
  10230. +{
  10231. +  printf ("%s not yet implemented\r\n", badfunc);
  10232. +  reset_sys_modes ();
  10233. +  exit (1);
  10234. +}
  10235. +
  10236. +long
  10237. +random ()
  10238. +{
  10239. +  /* Arrange to return a range centered on zero.  */
  10240. +  return rand () - (1 << 30);
  10241. +}
  10242. +
  10243. +srandom (seed)
  10244. +{
  10245. +  srand (seed);
  10246. +}
  10247. +
  10248. +ulimit ()
  10249. +{}
  10250. +
  10251. +setpriority ()
  10252. +{}
  10253. +
  10254. +setpgrp ()
  10255. +{}
  10256. +
  10257. +execvp (char *cmd, char **arg)
  10258. +{
  10259. +  return execve(cmd, arg, NULL);
  10260. +}
  10261. +/* very poor version */
  10262. +execlp (char *cmd, char *arg0, char *arg1)
  10263. +{
  10264. +char *args[3];
  10265. +
  10266. +    args[0] = arg0;
  10267. +    args[1] = arg1;
  10268. +    args[2] = NULL;
  10269. +
  10270. +    execvp(cmd, args);
  10271. +}
  10272. +
  10273. +request_sigio ()
  10274. +{
  10275. +  croak ("request_sigio");
  10276. +}
  10277. +
  10278. +unrequest_sigio ()
  10279. +{
  10280. +  croak ("unrequest_sigio");
  10281. +}
  10282. +
  10283. +pause(void)
  10284. +{}    
  10285. +
  10286. +vfork( void )
  10287. +{
  10288. +    return fork();
  10289. +}
  10290. +
  10291. +/*
  10292. +   Make Emacs always think, he's the subprocess now.
  10293. +   Hoping he will always call child_setup().
  10294. +*/
  10295. +fork( void )
  10296. +{
  10297. +    return 0;
  10298. +}
  10299. +
  10300. +char *
  10301. +dostounix_filename (p)
  10302. +     register char *p;
  10303. +{
  10304. +  char *ret = p;
  10305. +  while (p && *p) {
  10306. +    if (*p == '\\')
  10307. +      *p = '/';
  10308. +    p++;
  10309. +  }
  10310. +  return ret;
  10311. +}
  10312. +#endif /* OS2 */
  10313. diff -urP /mule-1.1/src/termcap.c ./src/termcap.c
  10314. --- /mule-1.1/src/termcap.c    Fri Jul 23 14:12:32 1993
  10315. +++ ./src/termcap.c    Tue Mar 15 05:13:06 1994
  10316. @@ -303,6 +303,9 @@
  10317.  #include <fcntl.h>
  10318.  #define O_TEXT _O_TEXT
  10319.  #endif
  10320. +#ifdef OS2 /* 93.8.20 by O.Sasaki */
  10321. +#include <fcntl.h>
  10322. +#endif
  10323.  /* end of patch */
  10324.  
  10325.  #ifdef VMS
  10326. @@ -360,8 +363,8 @@
  10327.  #ifdef VMS
  10328.    filep = tem && legal_filename_p (tem);
  10329.  #else
  10330. -/* 91.10.20, 93.2.17 by M.Higashida */
  10331. -#if defined(MSDOS) || defined(WIN32)
  10332. +/* 91.10.20, 93.2.17 by M.Higashida, 93.8.20 by O.Sasaki */
  10333. +#if defined(MSDOS) || defined(WIN32) || defined(OS2)
  10334.    if (tem != 0 && (*tem == '\\' || *tem == '/' || tem[1] == ':')) {
  10335.      dostounix_filename (tem);
  10336.    }
  10337. @@ -407,8 +410,8 @@
  10338.  
  10339.    /* Here we know we must search a file and tem has its name.  */
  10340.  
  10341. -/* 91.10.16 by S.Hirano, 93.2.17 by M.Higashida */
  10342. -#if defined(MSDOS) || defined(WIN32)
  10343. +/* 91.10.16 by S.Hirano, 93.2.17 by M.Higashida,93.8.20 by O.Sasaki */
  10344. +#if defined(MSDOS) || defined(WIN32) || defined(OS2)
  10345.    fd = open (tem, O_TEXT, 0);
  10346.  #else
  10347.    fd = open (tem, 0, 0);
  10348.