home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / sys / sgi / 19165 < prev    next >
Encoding:
Internet Message Format  |  1993-01-28  |  26.9 KB

  1. Path: sparky!uunet!inmos!fulcrum!bham!warwick!doc.ic.ac.uk!sot-ecs!tpm
  2. From: tpm@ecs (TP Monks)
  3. Newsgroups: comp.sys.sgi
  4. Subject: Re: CRISP editor for IRIX 4.0.X
  5. Message-ID: <14327@ecs.soton.ac.uk>
  6. Date: 28 Jan 93 09:49:29 GMT
  7. References: <1993Jan19.190155.21652@ramon.bgu.ac.il> <14276@ecs.soton.ac.uk>
  8. Sender: news@ecs.soton.ac.uk
  9. Lines: 614
  10. Nntp-Posting-Host: elstar
  11.  
  12.  
  13. I've had a lot of mail from people asking how to compile Crisp2.2e
  14. (the last shareware version) on sgi machines.
  15.  
  16. Here's how to do it, its quite easy, but BEWARE, my implementation 
  17. occasionally crashes without dumping core, and losing my work.
  18. This is infrequent enough for me not to mind too much, but I do always
  19. keep backups of the file I'm editing, and periodically save it and back
  20. it up.  Apart from this, crisp is an excellent editor
  21.  
  22. 1) Use s-machine.h and machine.h from below.  I'm told this compiles.
  23. 2) compile!
  24. 3) If you try running it now, it'll crash - do the stuff below first.
  25. 4) Put the file sgi.cf below in /usr/local/crisp_inst/src/crunch/tty/sgi.cf
  26.    or your equivalent install directory.  Move to that directory and do:
  27.    crunch sgi.cf.  This builds sgi.cm which tells crisp what escape
  28.    codes your keyboard uses.  Next, set the vars below so that crisp
  29.    knows where everything lives and what macro to use.
  30. 5) BPATH=/usr/local/crisp/macros
  31.    BTERM=sgi
  32.    BVERSION=6
  33.    BHELP=/usr/local/crisp/help
  34. 6) Mail me if this doesn't work - nobodys perfect
  35. 7) Mail me if it works, and you start using crisp. It would be good to
  36.    know how many other users there are.   Also send me any fixes/improvements
  37.    you may make.
  38.  
  39. Tim
  40.    
  41.          
  42. ******************************************************
  43. s-machine.h
  44. ******************************************************
  45.  
  46. #! /bin/sh
  47. # Machine dependent environment variables to control 
  48. # making of CRISP sources.
  49. #
  50. # This file is for generic System V systems. It has been tested under
  51. # Interactive Unix V.3 rel 2.2. If you have a pre-V.3 system (i.e. without
  52. # shared libraries) then you should comment out the SHLIB= definition
  53. # below.
  54. #
  55. SHLIB="-lc -lbsd -lsun -lgen"
  56. ########
  57. # Uncomment out the following line if you don't want the floating point
  58. # library to be included. This disables the sin(), cos(), tan(), etc
  59. # functions but otherwise doesn't affect crisp (except the floating
  60. # point calculator).
  61. #NO_FLOAT_MATH=-DNO_FLOAT_MATH
  62. ########
  63. #  Select one of following for your system.
  64. # another tpm hack... ld complains about -systype ...
  65. CC="cc -cckr"
  66. #CC="cc -systype sysv"
  67. #CC="gcc -ansi -W -Wall -pedantic"
  68. ########
  69. #  Select one of following for your system.
  70. #G=-g; export G
  71. G=-O; export G
  72. ########
  73. DIR=`pwd`
  74. PATH=$DIR:$DIR/crunch:$PATH
  75. export SHLIB CC PATH NO_FLOAT_MATH
  76.  
  77.  
  78. ******************************************************
  79. machine.h
  80. ******************************************************
  81.  
  82. /************************************************************************
  83.  *                                                                      *
  84.  *        CRISP - Custom Reduced Instruction Set Programmers Editor     *
  85.  *                                                                      *
  86.  *        (C) Paul Fox, 1989, 1991                                      *
  87.  *                                                                      * 
  88.  *  File:  machine.h                                                    * 
  89.  *                                                                      * 
  90.  *  This file contains the #defines necessary to configure different    *
  91.  *  machine architectures.                                              *
  92.  *                                                                      *
  93.  ************************************************************************/
  94.  
  95. # define        CR_ACORN        0       /* Acorn running Risc IX        */
  96. # define        CR_AIX_3        0       /* AIX v3 -- not tested.        */
  97. # define        CR_DOS          0       /* MS-DOS C5.1 and OS2          */
  98. # define        CR_SUN_OS3      0       /* Sun running SunOS 3.x        */
  99. # define        CR_SUN_OS40     0       /* Sun running SunOS 4.0        */
  100. # define        CR_SUN_OS41     0       /* Sun running SunOS 4.1        */
  101. # define        CR_SYSV         1       /* Generic System V.            */
  102. # define        CR_SYSV_3_2     0       /* Generic System V.3.2         */
  103. # define        CR_SYSV_32_PTY  0       /* Generic System V.3.2 with PTY*/
  104. # define        CR_VMS          0       /* VMS 4.7 and above.           */
  105. # define        CR_XENIX        0       /* Xenix 2.2 and above.         */
  106.  
  107. /************************************************************************
  108.  *                                                                      *
  109.  *    The  following  describes  the various parameters which control   *
  110.  *    compilation   of   CRISP.   After  the  comments  are  separate   *
  111.  *    sections    for    the   different   machine/operating   system   *
  112.  *    conbinations  already  supported. If you are producing your own   *
  113.  *    description  then  you  should  first  try to determine whether   *
  114.  *    your machine is a mostly System V variant or BSD variant.         *
  115.  *                                                                      *
  116.  *   BSD                This is used to indicate that the system is     *
  117.  *                      more a BSD derivative than a System V. It       *
  118.  *                      affects certain features which may actually     *
  119.  *                      only be true of SunOS.                          *
  120.  *                                                                      *
  121.  *   CANNOT_UNLINK_OPEN_FILES                                           *
  122.  *                      System doesnt support Unix unlink() on an open  *
  123.  *                      file semantic.                                  *
  124.  *                                                                      *
  125.  *   DIRSIZ_DEFINED     This should be define'd if the POSIX directory  *
  126.  *                      access include files are wrong. (Are they wrong *
  127.  *                      or right ? - I'm not sure - basically if you    *
  128.  *                      have problems with this defined try undeffing it. *
  129.  *                                                                      *
  130.  *   EGA43              If this is defined, then code for supporting    *
  131.  *                      the EGA in 43 line mode on a PC is compiled in. *
  132.  *                      This is only supported for Unix V.3.2.          *
  133.  *                                                                      *
  134.  *   HAVE_MOUSE         Define this if you want the mouse code compiled *
  135.  *                      in. (Only do this if the mouse code is          *
  136.  *                      supported for your system).                     *
  137.  *                                                                      *
  138.  *   HAVE_PTY           This is used to compline in the code for        *
  139.  *                      process buffers. If your machine has the        *
  140.  *                      Berkeley /dev/pty driver, then define this.     *
  141.  *                      Otherwise CRISP will try and used pipes.        *
  142.  *                                                                      *
  143.  *   HAVE_SGTTY         System supports old style terminal interface.   *
  144.  *                                                                      *
  145.  *   HAVE_SIGINTERRUPT  System supports Sun compatible siginterrupt()   *
  146.  *                      system call.                                    *
  147.  *                                                                      *
  148.  *   HAVE_SIGSETMASK    The system call sigsetmask is defined. TRUE     *
  149.  *                      under some versions of SunOS. Used for job      *
  150.  *                      control.                                        *
  151.  *                                                                      *
  152.  *   HAVE_TERMIO        System supports old style terminal interface    *
  153.  *                      System V terminal interface.                    *
  154.  *                                                                      *
  155.  *   HAVE_TERMIOS       System supports POSIX style terminal interface. *
  156.  *                                                                      *
  157.  *   HAVE_WAITPID       System has System V (POSIX) waitpid() call with *
  158.  *                      <sys/wait.h> to get the definitions.            *
  159.  *                      On systems which dont have this, CRISP may hang *
  160.  *                      if we get SIGCHLD signals when we're not        *
  161.  *                      expecting them. Please read comment in def.h    *
  162.  *                      about why we don't actually include the         *
  163.  *                      include file.                                   *
  164.  *                                                                      *
  165.  *   LINEFEED_DOES_CR   Defined on systems where \n outputs a \r as well*
  166.  *                                                                      *
  167.  *   MONOCASE_FILENAMES Define this if operating system ignores case    *
  168.  *                      in filenames.                                   *
  169.  *                                                                      *
  170.  *   NO_FLOAT_MATH      Define this if you dont want the floating       *
  171.  *                      point primitives to be included, i.e. sin(),    *
  172.  *                      cos(), etc. (You still have access to raw       *
  173.  *                      floating point). This setting should be machine *
  174.  *                      independent so you shoudl check your s-machine  *
  175.  *                      file first.                                     *
  176.  *                                                                      *
  177.  *   NO_SYS_DIR_H       The file <sys/dir.h> does not exist.            *
  178.  *                                                                      *
  179.  *   ONLY_ONE_EXTENSION System only allows one '.' in filename.         *
  180.  *                                                                      *
  181.  *   MALLOC             This tells the code that there is no            *
  182.  *                      <malloc.h> file and that the malloc() library   *
  183.  *                      may behave in strange ways which may force us   *
  184.  *                      to optimise our usage. It is really only        *
  185.  *                      necessary if your system doesn't support the    *
  186.  *                      SVID mallopt() call.                            *
  187.  *                                                                      *
  188.  *   OPCODE             This is used to control the use of the enum     *
  189.  *                      OPCODE typedef in the list.h. It doesn't matter *
  190.  *                      if you set this to 'int' as below, but if it is *
  191.  *                      undefined then it is easier to debug the CRISP  *
  192.  *                      lisp-code. Older Unix C compilers do not treat  *
  193.  *                      enum's and int's as the same type and will      *
  194.  *                      complain during compilation.                    *
  195.  *                                                                      *
  196.  *   SELECT             SELECT should be defined if we can do a         *
  197.  *                      select() on the keyboard and on the process     *
  198.  *                      pty's/pipes. This will tend to be true on BSD   *
  199.  *                      systems, and Sys V.4. Alas, poll() isn't        *
  200.  *                      generally applicable on V.3 because the         *
  201.  *                      standard pipe and tty drivers are streams       *
  202.  *                      modules.                                        *
  203.  *                                                                      *
  204.  *   SPAWN              System supports a 'spawn' primitive rather      *
  205.  *                      than fork/exec.                                 *
  206.  *                                                                      *
  207.  *   SUN                Operating system is SunOS 3.x or SunOS 4.x.     *
  208.  *                                                                      *
  209.  *   SYSV               Operating is a System V derivative.             *
  210.  *                                                                      *
  211.  *   U_CHAR             CRISP defines a typedef called u_char. Some     *
  212.  *                      Unix systems also define this type in one of    *
  213.  *                      the system header files (<sys/types.h>) which   *
  214.  *                      causes a compilation error. If you have this    *
  215.  *                      typedef in your system header file, then        *
  216.  *                      #define U_CHAR.                                 *
  217.  *                                                                      *
  218.  *   VERSION            Set this to a number representing the operating *
  219.  *                      system version number. Used for major           *
  220.  *                      differences in working, eg Xenix versions.      *
  221.  *                                                                      *
  222.  *   WANT_SYS_SOCKET_H  Interactive Unix wants <sys/socket.h> when      *
  223.  *                      using the select() system call.                 *
  224.  *                                                                      *
  225.  *   WANT_GETCWD        This define causes us to load our own getcwd()  *
  226.  *                      function. The standard Unix/Xenix one works     *
  227.  *                      by forking a '/bin/pwd' process and reading     *
  228.  *                      the output from it. This is not only bloody     *
  229.  *                      awful, but causes problems with process buffers *
  230.  *                      when the sub-process dies. (We get an unwanted  *
  231.  *                      SIGCHLD).                                       *
  232.  *                                                                      *
  233.  *   WINDOW_SIZE_SUPPORTED                                              *
  234.  *                      Define this if system supports TIOCGWINSZ       *
  235.  *                      ioctl to get size of pty window.                *
  236.  *                                                                      *
  237.  *   WORD_SIZE_16       TRUE for 16 bit machines. It simply restricts   *
  238.  *                      the size of chunks read in from input files.    *
  239.  *                                                                      *
  240.  ************************************************************************/
  241.  
  242. # if CR_AIX_3
  243.         /***********************************************/
  244.         /*   This  entry  not  tested  but  based  on  */
  245.         /*   updates  I  received  for  v1.9  & v2 by  */
  246.         /*   Warren Jones                              */
  247.         /***********************************************/
  248. #       define  DIRSIZ_DEFINED
  249. #       define  GOT_STDLIB
  250. #       define  HAVE_PTY
  251. #       define  HAVE_TERMIO
  252. #       define  SELECT 
  253. #       define  SYSV
  254. #       define  U_CHAR
  255. #       define  VERSION 31
  256. #       define  WANT_GETCWD
  257. #       define  WINDOW_SIZE_SUPPORTED
  258. # endif
  259.  
  260. # if    CR_DOS
  261. #       define  CANNOT_UNLINK_OPEN_FILES
  262. #       define  DIRSIZ_DEFINED
  263. #       define  FOPEN_R_BINARY  "rb"
  264. #       define  FOPEN_W_BINARY  "wb"
  265. #       define  LINEFEED_DOES_CR
  266. #       define  MONOCASE_FILENAMES
  267. #       define  OPEN_R_BINARY   O_BINARY
  268. #       define  OPEN_W_BINARY   O_BINARY
  269. #       define  SYSV 
  270. #       define  ONLY_ONE_EXTENSION
  271. #       define  SPAWN
  272. #       define  WORD_SIZE_16
  273. #       define  GOT_STDLIB
  274. # endif  
  275.  
  276. # if    CR_SUN_OS3
  277.         /***********************************************/
  278.         /*   This  entry  has  not been verified, and  */
  279.         /*   is subject to removal.                    */
  280.         /***********************************************/
  281. #       define  SUN
  282. #       define  BSD
  283. #       define  HAVE_SIGINTERRUPT
  284. #       define  DIRSIZ_DEFINED
  285. #       define  OPCODE  int 
  286. /*#     define  HAVE_PTY        *//* Not tried under SunOS 3.x */ 
  287. #       define  WINDOW_SIZE_SUPPORTED
  288. #       define  SELECT 
  289. #       define  U_CHAR
  290. #       define  WANT_GETCWD
  291. #       define  HAVE_SGTTY
  292. # endif 
  293.  
  294. # if    CR_ACORN
  295. #       define  BSD
  296. #       define  HAVE_PTY
  297. #       define  HAVE_SGTTY
  298. #       define  HAVE_SIGSETMASK
  299. #       define  NO_SYS_DIR_H
  300. #       define  SELECT 
  301. #       define  SUN
  302. #       define  WANT_GETCWD
  303. #       define  WINDOW_SIZE_SUPPORTED
  304. #       define  U_CHAR
  305. # endif 
  306. # if    CR_SUN_OS40
  307. #       define  BSD
  308. #       define  DIRSIZ_DEFINED
  309. #       define  HAVE_PTY
  310. #       define  HAVE_SIGINTERRUPT
  311. #       define  HAVE_SIGSETMASK
  312. #       define  HAVE_TERMIO
  313. #       define  SELECT 
  314. #       define  SUN
  315. #       define  U_CHAR
  316. #       define  WANT_GETCWD
  317. #       define  WINDOW_SIZE_SUPPORTED
  318. # endif 
  319.  
  320. # if    CR_SUN_OS41
  321. #       define  BSD
  322. #       define  DIRSIZ_DEFINED
  323. #       define  GOT_STDLIB
  324. #       define  HAVE_PTY
  325. #       define  HAVE_SIGINTERRUPT
  326. #       define  HAVE_SIGSETMASK
  327. #       define  SELECT 
  328. #       define  SUN
  329. #       define  WINDOW_SIZE_SUPPORTED
  330. #       define  WANT_GETCWD
  331. #       define  HAVE_TERMIO
  332. #       define  HAVE_WAITPID
  333. #       define  U_CHAR
  334. # endif 
  335.  
  336. # if    CR_SYSV
  337. #       define  SYSV 
  338. #       define  HAVE_TERMIO
  339. #       define  WANT_GETCWD
  340. #       define  GOT_STDLIB
  341. /* the following are mods - tpm 8/91 */
  342. #       define  HAVE_MOUSE
  343. #       define  HAVE_WAITPID
  344. #       define  SELECT
  345. #       define  U_CHAR
  346. #       define  DIRSIZ_DEFINED
  347. # endif 
  348.  
  349. # if    CR_SYSV_3_2
  350. #       define  SYSV
  351. #       define  WANT_GETCWD
  352. #       define  HAVE_TERMIO
  353. #       define  EGA43
  354. #       define  GOT_STDLIB
  355. # endif 
  356.  
  357. /**********************************************************************/
  358. /*   Following  entry  works  for  Interactive  Unix  V.3.2 with TCP  */
  359. /*   support.                                                         */
  360. /**********************************************************************/
  361. # if    CR_SYSV_32_PTY
  362. #       define  EGA43
  363. #       define  GOT_STDLIB
  364. #       define  HAVE_MOUSE
  365. #       define  SELECT
  366. #       define  SYSV
  367. #       define  WANT_GETCWD
  368. #       define  HAVE_PTY
  369. #       define  HAVE_TERMIO
  370. #       define  HAVE_WAITPID
  371. #       define  WANT_SYS_SOCKET_H
  372. #       define  U_CHAR
  373. # endif
  374.  
  375. # if    CR_VMS
  376. #       define  VMS
  377. #       define  DIRSIZ_DEFINED
  378. #       define  MALLOC
  379. #       define  CANNOT_UNLINK_OPEN_FILES
  380. # endif
  381.  
  382. # if    CR_XENIX
  383. #       define  WANT_GETCWD
  384. #       define  SYSV
  385. #       define  OPCODE  int 
  386. #       define  HAVE_TERMIO
  387. #       define  VERSION 23
  388. #       if      VERSION < 23
  389. #               define  DIRSIZ_DEFINED
  390. #       else
  391. #               define  SELECT
  392. #               define  PTY
  393. #       endif
  394. # endif 
  395.  
  396. /**********************************************************************/ 
  397. /*   This section gives some default values to various definitions.   */
  398. /**********************************************************************/
  399.  
  400. # if    !defined(OPEN_W_BINARY)
  401. #       define  OPEN_W_BINARY   0
  402. #       define  OPEN_R_BINARY   0
  403. # endif
  404. # if    !defined(FOPEN_W_BINARY)
  405. #       define  FOPEN_W_BINARY  "w"
  406. #       define  FOPEN_R_BINARY  "r"
  407. # endif
  408.  
  409.  
  410.  
  411.  
  412. ******************************************************
  413. sgi.cf
  414. ******************************************************
  415.  
  416.  
  417. /********************************************************************
  418.  *                                                                  *
  419.  *    CRISP - Custom Reduced Instruction Set Programmers Editor     *
  420.  *                                                                  *
  421.  *    This is the terminal description file for SGITERM, SGI's      *
  422.  *    version of XTERM.  Crisp works quite nicely in this           *
  423.  *    environment, since SGITERM returns escape sequences for       *
  424.  *    all Alt-key combinations, and many Ctrl-Key combinations      *
  425.  *    that are not usually available on ASCII terminals.            *
  426.  ********************************************************************/
  427.  
  428. # include   "tty.h"
  429. void 
  430. main() 
  431. {
  432.       
  433.     /***********************************************/
  434.     /*   Set   characters   used   for   extended  */
  435.     /*   graphics support when drawing windows.    */
  436.     /***********************************************/
  437.     set_term_characters(
  438.         '+',        /* Top left of window.                */
  439.         '+',        /* Top right of window.                */
  440.         '+',        /* Bottom left of window.            */
  441.         '+',        /* Bottom right of window.            */
  442.         '|',        /* Vertical bar for window sides.        */
  443.         '-',        /* Top and bottom horizontal bar for window.*/
  444.         '+',         /* Top join.                    */
  445.         '+',         /* Bottom join.                    */
  446.         '+',         /* Window 4-way intersection.            */
  447.         '+',         /* Left hand join.                */
  448.         '+'         /* Right hand join.                */
  449.         );
  450.       
  451.          /***********************************************/
  452.          /*   Define   escape   sequences   used   for  */
  453.          /*   special optimisations on output.        */
  454.          /***********************************************/
  455.     set_term_features(
  456.             NULL,         /* Sequence to clear 'n' spaces.      */
  457.                           /* ("\x1B[%dX" almost works, but      */
  458.                           /* doesn't preserve standout mode,      */
  459.                           /* so help menus don't look right.)      */
  460.             NULL,         /* Sequence to print characters with top*/
  461.                           /* bit set.                  */
  462.             NULL,         /* Insert-mode cursor.          */
  463.             NULL,         /* Overwrite-mode cursor.          */
  464.             NULL,         /* Insert-mode cursor (on virtual space)*/
  465.             NULL,         /* Overwrite-mode cursor (on virtual space)*/
  466.             NULL,         /* Print ESCAPE character graphically.  */
  467.             NULL,         /* Escape sequence to repeat last character*/
  468.             FALSE,        /* ESC [0m resets color.          */
  469.             FALSE,        /* Terminal supports color.          */
  470.            "\x1B[%dC"     /* Sequence to move cursor on same line.*/
  471.             );
  472.                     
  473.          /***********************************************/
  474.          /*   Define  keyboard  layout  for  non-ascii  */
  475.          /*   characters.  These  can only be used for  */
  476.          /*   the console).                */
  477.          /***********************************************/
  478.           set_term_keyboard(
  479.          F1_F12, quote_list(
  480.                     "\x1B[001q", "\x1B[002q", "\x1B[003q", "\x1B[004q",
  481.                         "\x1B[005q", "\x1B[006q", "\x1B[007q", "\x1B[008q",
  482.                         "\x1B[009q", "\x1B[010q", "\x1B[011q", "\x1B[012q" ),
  483.  
  484.          CTRL_F1_F12, quote_list(
  485.                     "\x1B[025q", "\x1B[026q", "\x1B[027q", "\x1B[028q",
  486.                         "\x1B[029q", "\x1B[030q", "\x1B[031q", "\x1B[032q",
  487.                         "\x1B[033q", "\x1B[034q", "\x1B[035q", "\x1B[036q"),
  488.    
  489.          SHIFT_F1_F12, quote_list(
  490.                     "\x1B[013q", "\x1B[014q", "\x1B[015q", "\x1B[016q",
  491.                         "\x1B[017q", "\x1B[018q", "\x1B[019q", "\x1B[020q",
  492.                         "\x1B[021q", "\x1B[022q", "\x1B[023q", "\x1B[024q"),
  493.                                   
  494.      /* added tpm 9/91 */
  495.          ALT_F1_F12, quote_list(
  496.                         "\x1b[037q", "\x1b[038q", "\x1b[039q", "\x1b[040q",
  497.                         "\x1b[041q", "\x1b[042q", "\x1b[043q", "\x1b[044q",
  498.                         "\x1b[045q", "\x1b[046q", "\x1b[047q", "\x1b[048q"),
  499.  
  500.  
  501.          ALT_A_Z, quote_list(
  502.                     "\x1B[087q", "\x1B[105q", "\x1B[103q", "\x1B[089q",
  503.                         "\x1B[076q", "\x1B[090q", "\x1B[091q", "\x1B[092q",
  504.                         "\x1B[081q", "\x1B[093q", "\x1B[094q", "\x1B[095q",
  505.                         "\x1B[107q", "\x1B[106q", "\x1B[082q", "\x1B[083q",
  506.                         "\x1B[074q", "\x1B[077q", "\x1B[088q", "\x1B[078q",
  507.                         "\x1B[080q", "\x1B[104q", "\x1B[075q", "\x1B[102q",
  508.                         "\x1B[079q", "\x1B[101q" ),
  509.                               
  510.      /* modified tpm 9/91 */
  511.          ALT_0_9, quote_list(      
  512.              "\x1b[067q","\x1b[058q","\x1b[059q","\x1b[060q",
  513.             "\x1b[061q","\x1b[062q","\x1b[063q","\x1b[064q",
  514.             "\x1b[065q","\x1b[066q"),
  515.                           
  516.      /* changed KEYPAD_5 from NULL to "\x1b[000q" - no difference I
  517.         guess - tpm 9/91 */
  518.          KEYPAD_0_9, quote_list(
  519.              "\x1b[139q", "\x1b[146q", "\x1b[B", "\x1b[154q",
  520.             "\x1b[D",    "\x1b[000q", "\x1b[C", "\x1b[H",
  521.             "\x1b[A",    "\x1b[150q"),
  522.  
  523.      /* everything after here has been updated tpm 9/91 */
  524.                        
  525.          CTRL_KEYPAD_0_9, quote_list(
  526.                     "\x1B[178q", "\x1B[176q", "\x1B[186q", "\x1B[194q",
  527.                         "\x1B[174q", "\x1B[184q", "\x1B[192q", "\x1B[172q",
  528.                         "\x1B[182q", "\x1B[190q" ),
  529.  
  530.          ALT_KEYPAD_END, "\x01",
  531.          ALT_KEYPAD_HOME, "\x07",
  532.  
  533.      ALT_KEYPAD_MINUS, "\x1b[048q",  /* these three use F11=+,F12=- */
  534.      CTRL_KEYPAD_MINUS, "\x1b[036q",
  535.       CTRL_KEYPAD_PLUS,  "\x1b[035q",
  536.      
  537.      KEYPAD_PRTSC,    "\x1b[209q",
  538.      KEYPAD_SCROLL,    "\x1b[213q",
  539.  
  540.          DEL,            quote_list("\x1B[P"),  /* del on the numerical pad */
  541.          COPY,    "\x1b[011q",  /* f11 */
  542.          CUT,    "\x1b[012q"  /* f12 */
  543.      
  544.      /* other bits that should be included are SHIFT_ARROWKEYS. I'm
  545.      not sure how to define these - presumably they should be used for
  546.      shifting from window to window.
  547.      SHIFT_LEFT  = "\x1b[158q"
  548.      SHIFT_RIGHT = "\x1b[167q"
  549.      SHIFT_UP    = "\x1b[161q"
  550.      SHIFT_DOWN  = "\x1b[164q"
  551.  
  552.      PAGE_UP     = ?
  553.      PAGE_DOWN   = ?
  554.          HOME         = ?
  555.      END         = ?    */
  556.      
  557.          );
  558. }
  559. /**********************************************************************/
  560. /*   Following  function  should  be  appended  to  BTERM  when  the  */
  561. /*   hpfont is figured out on your system.                            */
  562. /**********************************************************************/
  563. void
  564. hpfont()
  565. {
  566.     /***********************************************/
  567.     /*   Set   characters   used   for   extended  */
  568.     /*   graphics support when drawing windows.    */
  569.     /***********************************************/
  570.     set_term_characters(
  571.         0xF5,            /* Top left of window.                */
  572.         0xF6,            /* Top right of window.                */
  573.         0xF4,            /* Bottom left of window.            */
  574.         0xF7,            /* Bottom right of window.            */
  575.         0xF9,            /* Vertical bar for window sides.        */
  576.         0xFA,            /* Top and bottom horizontal bar for window.*/
  577.         0xFD,            /* Top join.                */
  578.         0xFE,            /* Bottom join.                    */
  579.         0xF8,            /* Window 4-way intersection.            */
  580.         0xFB,            /* Left hand join.                  */
  581.         0xFC            /* Right hand join.                  */
  582.         );
  583. }
  584.  
  585. /**********************************************************************/
  586. /*   Macro  called  when  a  mouse  button is hit from an Xterm when  */
  587. /*   the mouse option is enabled in the window.                  */
  588. /**********************************************************************/
  589. int    mouse_cnt = 0;
  590. void
  591. xterm_mouse()
  592. {    int    ch1, ch2, ch3;
  593.  
  594.     ch1 = read_char(0);
  595.     ch2 = read_char(0);
  596.     ch3 = read_char(0);
  597.     message("Mouse hit %d! %s%s%s (%d,%d)", 
  598.         mouse_cnt++,
  599.         ch1 == ' ' ? "o" : "-",
  600.         ch1 == '!' ? "o" : "-",
  601.         ch1 == '"' ? "o" : "-",
  602.         ch2 - ' ', ch3 - ' '
  603.         );
  604.     /***********************************************/
  605.     /*   Let  CRISP  do  the real work of working  */
  606.     /*   out whats happened to the mouse keys.     */
  607.     /***********************************************/
  608.     process_mouse(ch1 == ' ', ch1 == '!', ch1 == '"', 
  609.         ch2 - ' ' - 1, 
  610.         ch3 - ' ' - 1);
  611. }
  612.  
  613.  
  614.  
  615.  
  616.  
  617.  
  618.  
  619.  
  620.  
  621. --
  622. -----------------------------------------------------------------------------
  623. Tim Monks                                Vision, Speech and Signal Processing
  624. tpm@ecs.soton.ac.uk                                    Southampton University
  625. Tel: +44 (703) 592774                                   Fax: +44 (703) 592895
  626.