DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download
Index: ┃ m

⟦21a2713e9⟧

    Length: 2751 (0xabf)
    Names: »message.c«

Derivation

└─⟦a0efdde77⟧ Bits:30001252 EUUGD11 Tape, 1987 Spring Conference Helsinki
    └─ ⟦this⟧ »EUUGD11/gnu-31mar87/chess/Xchess/message.c« 

Hex Dump

0x000…020 2f 2a 20 54 68 69 73 20 66 69 6c 65 20 63 6f 6e 74 61 69 6e 73 20 63 6f 64 65 20 66 6f 72 20 58   ┆/* This file contains code for X┆
0x020…040 2d 43 48 45 53 53 2e 0a 20 20 20 43 6f 70 79 72 69 67 68 74 20 28 43 29 20 31 39 38 36 20 46 72   ┆-CHESS.    Copyright (C) 1986 Fr┆
0x040…060 65 65 20 53 6f 66 74 77 61 72 65 20 46 6f 75 6e 64 61 74 69 6f 6e 2c 20 49 6e 63 2e 0a 0a 54 68   ┆ee Software Foundation, Inc.  Th┆
0x060…080 69 73 20 66 69 6c 65 20 69 73 20 70 61 72 74 20 6f 66 20 58 2d 43 48 45 53 53 2e 0a 0a 58 2d 43   ┆is file is part of X-CHESS.  X-C┆
0x080…0a0 48 45 53 53 20 69 73 20 64 69 73 74 72 69 62 75 74 65 64 20 69 6e 20 74 68 65 20 68 6f 70 65 20   ┆HESS is distributed in the hope ┆
0x0a0…0c0 74 68 61 74 20 69 74 20 77 69 6c 6c 20 62 65 20 75 73 65 66 75 6c 2c 0a 62 75 74 20 57 49 54 48   ┆that it will be useful, but WITH┆
0x0c0…0e0 4f 55 54 20 41 4e 59 20 57 41 52 52 41 4e 54 59 2e 20 20 4e 6f 20 61 75 74 68 6f 72 20 6f 72 20   ┆OUT ANY WARRANTY.  No author or ┆
0x0e0…100 64 69 73 74 72 69 62 75 74 6f 72 0a 61 63 63 65 70 74 73 20 72 65 73 70 6f 6e 73 69 62 69 6c 69   ┆distributor accepts responsibili┆
0x100…120 74 79 20 74 6f 20 61 6e 79 6f 6e 65 20 66 6f 72 20 74 68 65 20 63 6f 6e 73 65 71 75 65 6e 63 65   ┆ty to anyone for the consequence┆
0x120…140 73 20 6f 66 20 75 73 69 6e 67 20 69 74 0a 6f 72 20 66 6f 72 20 77 68 65 74 68 65 72 20 69 74 20   ┆s of using it or for whether it ┆
0x140…160 73 65 72 76 65 73 20 61 6e 79 20 70 61 72 74 69 63 75 6c 61 72 20 70 75 72 70 6f 73 65 20 6f 72   ┆serves any particular purpose or┆
0x160…180 20 77 6f 72 6b 73 20 61 74 20 61 6c 6c 2c 0a 75 6e 6c 65 73 73 20 68 65 20 73 61 79 73 20 73 6f   ┆ works at all, unless he says so┆
0x180…1a0 20 69 6e 20 77 72 69 74 69 6e 67 2e 20 20 52 65 66 65 72 20 74 6f 20 74 68 65 20 58 2d 43 48 45   ┆ in writing.  Refer to the X-CHE┆
0x1a0…1c0 53 53 20 47 65 6e 65 72 61 6c 20 50 75 62 6c 69 63 0a 4c 69 63 65 6e 73 65 20 66 6f 72 20 66 75   ┆SS General Public License for fu┆
0x1c0…1e0 6c 6c 20 64 65 74 61 69 6c 73 2e 0a 0a 45 76 65 72 79 6f 6e 65 20 69 73 20 67 72 61 6e 74 65 64   ┆ll details.  Everyone is granted┆
0x1e0…200 20 70 65 72 6d 69 73 73 69 6f 6e 20 74 6f 20 63 6f 70 79 2c 20 6d 6f 64 69 66 79 20 61 6e 64 20   ┆ permission to copy, modify and ┆
0x200…220 72 65 64 69 73 74 72 69 62 75 74 65 0a 58 2d 43 48 45 53 53 2c 20 62 75 74 20 6f 6e 6c 79 20 75   ┆redistribute X-CHESS, but only u┆
0x220…240 6e 64 65 72 20 74 68 65 20 63 6f 6e 64 69 74 69 6f 6e 73 20 64 65 73 63 72 69 62 65 64 20 69 6e   ┆nder the conditions described in┆
0x240…260 20 74 68 65 0a 58 2d 43 48 45 53 53 20 47 65 6e 65 72 61 6c 20 50 75 62 6c 69 63 20 4c 69 63 65   ┆ the X-CHESS General Public Lice┆
0x260…280 6e 73 65 2e 20 20 20 41 20 63 6f 70 79 20 6f 66 20 74 68 69 73 20 6c 69 63 65 6e 73 65 20 69 73   ┆nse.   A copy of this license is┆
0x280…2a0 0a 73 75 70 70 6f 73 65 64 20 74 6f 20 68 61 76 65 20 62 65 65 6e 20 67 69 76 65 6e 20 74 6f 20   ┆ supposed to have been given to ┆
0x2a0…2c0 79 6f 75 20 61 6c 6f 6e 67 20 77 69 74 68 20 58 2d 43 48 45 53 53 20 73 6f 20 79 6f 75 0a 63 61   ┆you along with X-CHESS so you ca┆
0x2c0…2e0 6e 20 6b 6e 6f 77 20 79 6f 75 72 20 72 69 67 68 74 73 20 61 6e 64 20 72 65 73 70 6f 6e 73 69 62   ┆n know your rights and responsib┆
0x2e0…300 69 6c 69 74 69 65 73 2e 20 20 49 74 20 73 68 6f 75 6c 64 20 62 65 20 69 6e 20 61 0a 66 69 6c 65   ┆ilities.  It should be in a file┆
0x300…320 20 6e 61 6d 65 64 20 43 4f 50 59 49 4e 47 2e 20 20 41 6d 6f 6e 67 20 6f 74 68 65 72 20 74 68 69   ┆ named COPYING.  Among other thi┆
0x320…340 6e 67 73 2c 20 74 68 65 20 63 6f 70 79 72 69 67 68 74 20 6e 6f 74 69 63 65 0a 61 6e 64 20 74 68   ┆ngs, the copyright notice and th┆
0x340…360 69 73 20 6e 6f 74 69 63 65 20 6d 75 73 74 20 62 65 20 70 72 65 73 65 72 76 65 64 20 6f 6e 20 61   ┆is notice must be preserved on a┆
0x360…380 6c 6c 20 63 6f 70 69 65 73 2e 20 20 2a 2f 0a 0a 0a 2f 2a 20 52 43 53 20 49 6e 66 6f 3a 20 24 52   ┆ll copies.  */   /* RCS Info: $R┆
0x380…3a0 65 76 69 73 69 6f 6e 3a 20 31 2e 34 20 24 20 6f 6e 20 24 44 61 74 65 3a 20 38 36 2f 31 31 2f 32   ┆evision: 1.4 $ on $Date: 86/11/2┆
0x3a0…3c0 36 20 31 32 3a 31 30 3a 32 32 20 24 0a 20 2a 20 20 20 20 20 20 20 20 20 20 20 24 53 6f 75 72 63   ┆6 12:10:22 $  *           $Sourc┆
0x3c0…3e0 65 3a 20 2f 75 73 65 72 73 2f 66 61 75 73 74 75 73 2f 78 63 68 65 73 73 2f 52 43 53 2f 6d 65 73   ┆e: /users/faustus/xchess/RCS/mes┆
0x3e0…400 73 61 67 65 2e 63 2c 76 20 24 0a 20 2a 20 43 6f 70 79 72 69 67 68 74 20 28 63 29 20 31 39 38 36   ┆sage.c,v $  * Copyright (c) 1986┆
0x400…420 20 57 61 79 6e 65 20 41 2e 20 43 68 72 69 73 74 6f 70 68 65 72 2c 20 55 2e 20 43 2e 20 42 65 72   ┆ Wayne A. Christopher, U. C. Ber┆
0x420…440 6b 65 6c 65 79 20 43 41 44 20 47 72 6f 75 70 0a 20 2a 09 50 65 72 6d 69 73 73 69 6f 6e 20 69 73   ┆keley CAD Group  * Permission is┆
0x440…460 20 67 72 61 6e 74 65 64 20 74 6f 20 64 6f 20 61 6e 79 74 68 69 6e 67 20 77 69 74 68 20 74 68 69   ┆ granted to do anything with thi┆
0x460…480 73 20 63 6f 64 65 20 65 78 63 65 70 74 20 73 65 6c 6c 20 69 74 0a 20 2a 09 6f 72 20 72 65 6d 6f   ┆s code except sell it  * or remo┆
0x480…4a0 76 65 20 74 68 69 73 20 6d 65 73 73 61 67 65 2e 0a 20 2a 0a 20 2a 20 44 6f 20 73 74 75 66 66 20   ┆ve this message.  *  * Do stuff ┆
0x4a0…4c0 77 69 74 68 20 74 68 65 20 6d 65 73 73 61 67 65 20 77 69 6e 64 6f 77 2e 20 20 46 6f 6e 74 20 30   ┆with the message window.  Font 0┆
0x4c0…4e0 20 69 73 20 74 68 65 20 6e 6f 72 6d 61 6c 20 66 6f 6e 74 2c 20 66 6f 6e 74 20 31 0a 20 2a 20 69   ┆ is the normal font, font 1  * i┆
0x4e0…500 73 20 6c 61 72 67 65 2c 20 61 6e 64 20 66 6f 6e 74 20 33 20 69 73 20 6e 6f 72 6d 61 6c 20 72 65   ┆s large, and font 3 is normal re┆
0x500…520 64 2e 0a 20 2a 2f 0a 0a 23 69 6e 63 6c 75 64 65 20 22 78 63 68 65 73 73 2e 68 22 0a 0a 23 64 65   ┆d.  */  #include "xchess.h"  #de┆
0x520…540 66 69 6e 65 20 4d 45 53 53 41 47 45 5f 48 45 41 44 45 52 09 22 06 31 20 20 58 43 68 65 73 73 20   ┆fine MESSAGE_HEADER " 1  XChess ┆
0x540…560 4d 65 73 73 61 67 65 73 06 30 5c 6e 5c 6e 22 0a 0a 76 6f 69 64 0a 6d 65 73 73 61 67 65 5f 69 6e   ┆Messages 0\n\n"  void message_in┆
0x560…580 69 74 28 77 69 6e 29 0a 09 77 69 6e 64 61 74 61 20 2a 77 69 6e 3b 0a 7b 0a 09 54 78 74 47 72 61   ┆it(win)  windata *win; {  TxtGra┆
0x580…5a0 62 28 77 69 6e 2d 3e 6d 65 73 73 61 67 65 77 69 6e 2c 20 22 78 63 68 65 73 73 22 2c 20 77 69 6e   ┆b(win->messagewin, "xchess", win┆
0x5a0…5c0 2d 3e 6d 65 64 69 75 6d 2c 20 0a 09 09 09 77 69 6e 2d 3e 74 65 78 74 62 61 63 6b 2e 70 69 78 65   ┆->medium,     win->textback.pixe┆
0x5c0…5e0 6c 2c 20 77 69 6e 2d 3e 74 65 78 74 63 6f 6c 6f 72 2e 70 69 78 65 6c 2c 0a 09 09 09 09 77 69 6e   ┆l, win->textcolor.pixel,     win┆
0x5e0…600 2d 3e 63 75 72 73 6f 72 63 6f 6c 6f 72 2e 70 69 78 65 6c 29 3b 0a 09 54 78 74 41 64 64 46 6f 6e   ┆->cursorcolor.pixel);  TxtAddFon┆
0x600…620 74 28 77 69 6e 2d 3e 6d 65 73 73 61 67 65 77 69 6e 2c 20 31 2c 20 77 69 6e 2d 3e 6c 61 72 67 65   ┆t(win->messagewin, 1, win->large┆
0x620…640 2c 20 77 69 6e 2d 3e 74 65 78 74 63 6f 6c 6f 72 2e 70 69 78 65 6c 29 3b 0a 09 54 78 74 41 64 64   ┆, win->textcolor.pixel);  TxtAdd┆
0x640…660 46 6f 6e 74 28 77 69 6e 2d 3e 6d 65 73 73 61 67 65 77 69 6e 2c 20 32 2c 20 77 69 6e 2d 3e 6d 65   ┆Font(win->messagewin, 2, win->me┆
0x660…680 64 69 75 6d 2c 20 77 69 6e 2d 3e 65 72 72 6f 72 74 65 78 74 2e 70 69 78 65 6c 29 3b 0a 09 54 78   ┆dium, win->errortext.pixel);  Tx┆
0x680…6a0 74 41 64 64 46 6f 6e 74 28 77 69 6e 2d 3e 6d 65 73 73 61 67 65 77 69 6e 2c 20 33 2c 20 77 69 6e   ┆tAddFont(win->messagewin, 3, win┆
0x6a0…6c0 2d 3e 6d 65 64 69 75 6d 2c 20 77 69 6e 2d 3e 70 6c 61 79 65 72 74 65 78 74 2e 70 69 78 65 6c 29   ┆->medium, win->playertext.pixel)┆
0x6c0…6e0 3b 0a 0a 09 54 78 74 57 72 69 74 65 53 74 72 28 77 69 6e 2d 3e 6d 65 73 73 61 67 65 77 69 6e 2c   ┆;   TxtWriteStr(win->messagewin,┆
0x6e0…700 20 4d 45 53 53 41 47 45 5f 48 45 41 44 45 52 29 3b 0a 09 72 65 74 75 72 6e 3b 0a 7d 0a 0a 76 6f   ┆ MESSAGE_HEADER);  return; }  vo┆
0x700…720 69 64 0a 6d 65 73 73 61 67 65 5f 61 64 64 28 77 69 6e 2c 20 73 74 72 69 6e 67 2c 20 65 72 72 29   ┆id message_add(win, string, err)┆
0x720…740 0a 09 77 69 6e 64 61 74 61 20 2a 77 69 6e 3b 0a 09 63 68 61 72 20 2a 73 74 72 69 6e 67 3b 0a 09   ┆  windata *win;  char *string;  ┆
0x740…760 62 6f 6f 6c 20 65 72 72 3b 0a 7b 0a 09 58 53 65 74 44 69 73 70 6c 61 79 28 77 69 6e 2d 3e 64 69   ┆bool err; {  XSetDisplay(win->di┆
0x760…780 73 70 6c 61 79 29 3b 0a 09 69 66 20 28 65 72 72 29 20 7b 0a 09 09 54 78 74 57 72 69 74 65 53 74   ┆splay);  if (err) {   TxtWriteSt┆
0x780…7a0 72 28 77 69 6e 2d 3e 6d 65 73 73 61 67 65 77 69 6e 2c 20 22 06 32 22 29 3b 0a 09 09 54 78 74 57   ┆r(win->messagewin, " 2");   TxtW┆
0x7a0…7c0 72 69 74 65 53 74 72 28 77 69 6e 2d 3e 6d 65 73 73 61 67 65 77 69 6e 2c 20 73 74 72 69 6e 67 29   ┆riteStr(win->messagewin, string)┆
0x7c0…7e0 3b 0a 09 09 54 78 74 57 72 69 74 65 53 74 72 28 77 69 6e 2d 3e 6d 65 73 73 61 67 65 77 69 6e 2c   ┆;   TxtWriteStr(win->messagewin,┆
0x7e0…800 20 22 06 30 22 29 3b 0a 09 09 58 46 65 65 70 28 30 29 3b 0a 09 7d 20 65 6c 73 65 0a 09 09 54 78   ┆ " 0");   XFeep(0);  } else   Tx┆
0x800…820 74 57 72 69 74 65 53 74 72 28 77 69 6e 2d 3e 6d 65 73 73 61 67 65 77 69 6e 2c 20 73 74 72 69 6e   ┆tWriteStr(win->messagewin, strin┆
0x820…840 67 29 3b 0a 09 72 65 74 75 72 6e 3b 0a 7d 0a 0a 76 6f 69 64 0a 6d 65 73 73 61 67 65 5f 73 65 6e   ┆g);  return; }  void message_sen┆
0x840…860 64 28 77 69 6e 2c 20 65 76 65 6e 74 29 0a 09 77 69 6e 64 61 74 61 20 2a 77 69 6e 3b 0a 09 58 45   ┆d(win, event)  windata *win;  XE┆
0x860…880 76 65 6e 74 20 2a 65 76 65 6e 74 3b 0a 7b 0a 09 58 4b 65 79 4f 72 42 75 74 74 6f 6e 45 76 65 6e   ┆vent *event; {  XKeyOrButtonEven┆
0x880…8a0 74 20 2a 65 76 20 3d 20 28 58 4b 65 79 4f 72 42 75 74 74 6f 6e 45 76 65 6e 74 20 2a 29 20 65 76   ┆t *ev = (XKeyOrButtonEvent *) ev┆
0x8a0…8c0 65 6e 74 3b 0a 09 77 69 6e 64 61 74 61 20 2a 6f 77 20 3d 20 28 77 69 6e 20 3d 3d 20 77 69 6e 31   ┆ent;  windata *ow = (win == win1┆
0x8c0…8e0 29 20 3f 20 77 69 6e 32 20 3a 20 77 69 6e 31 3b 0a 09 63 68 61 72 20 62 75 66 5b 42 53 49 5a 45   ┆) ? win2 : win1;  char buf[BSIZE┆
0x8e0…900 5d 2c 20 2a 73 3b 0a 09 69 6e 74 20 69 3b 0a 0a 09 73 20 3d 20 58 4c 6f 6f 6b 75 70 4d 61 70 70   ┆], *s;  int i;   s = XLookupMapp┆
0x900…920 69 6e 67 28 65 76 2c 20 26 69 29 3b 0a 09 73 74 72 6e 63 70 79 28 62 75 66 2c 20 73 2c 20 69 29   ┆ing(ev, &i);  strncpy(buf, s, i)┆
0x920…940 3b 0a 09 62 75 66 5b 69 5d 20 3d 20 27 5c 30 27 3b 0a 09 66 6f 72 20 28 73 20 3d 20 62 75 66 3b   ┆;  buf[i] = '\0';  for (s = buf;┆
0x940…960 20 2a 73 3b 20 73 2b 2b 29 0a 09 09 69 66 20 28 2a 73 20 3d 3d 20 27 5c 72 27 29 0a 09 09 09 2a   ┆ *s; s++)   if (*s == '\r')    *┆
0x960…980 73 20 3d 20 27 5c 6e 27 3b 0a 09 09 65 6c 73 65 20 69 66 20 28 2a 73 20 3d 3d 20 27 5c 31 37 37   ┆s = '\n';   else if (*s == '\177┆
0x980…9a0 27 29 0a 09 09 09 2a 73 20 3d 20 27 08 27 3b 0a 0a 09 58 53 65 74 44 69 73 70 6c 61 79 28 77 69   ┆')    *s = ' ';   XSetDisplay(wi┆
0x9a0…9c0 6e 2d 3e 64 69 73 70 6c 61 79 29 3b 0a 09 54 78 74 57 72 69 74 65 53 74 72 28 77 69 6e 2d 3e 6d   ┆n->display);  TxtWriteStr(win->m┆
0x9c0…9e0 65 73 73 61 67 65 77 69 6e 2c 20 22 06 33 22 29 3b 0a 09 54 78 74 57 72 69 74 65 53 74 72 28 77   ┆essagewin, " 3");  TxtWriteStr(w┆
0x9e0…a00 69 6e 2d 3e 6d 65 73 73 61 67 65 77 69 6e 2c 20 62 75 66 29 3b 0a 09 54 78 74 57 72 69 74 65 53   ┆in->messagewin, buf);  TxtWriteS┆
0xa00…a20 74 72 28 77 69 6e 2d 3e 6d 65 73 73 61 67 65 77 69 6e 2c 20 22 06 30 22 29 3b 0a 09 69 66 20 28   ┆tr(win->messagewin, " 0");  if (┆
0xa20…a40 6f 77 29 20 7b 0a 09 09 58 53 65 74 44 69 73 70 6c 61 79 28 6f 77 2d 3e 64 69 73 70 6c 61 79 29   ┆ow) {   XSetDisplay(ow->display)┆
0xa40…a60 3b 0a 09 09 54 78 74 57 72 69 74 65 53 74 72 28 6f 77 2d 3e 6d 65 73 73 61 67 65 77 69 6e 2c 20   ┆;   TxtWriteStr(ow->messagewin, ┆
0xa60…a80 22 06 33 22 29 3b 0a 09 09 54 78 74 57 72 69 74 65 53 74 72 28 6f 77 2d 3e 6d 65 73 73 61 67 65   ┆" 3");   TxtWriteStr(ow->message┆
0xa80…aa0 77 69 6e 2c 20 62 75 66 29 3b 0a 09 09 54 78 74 57 72 69 74 65 53 74 72 28 6f 77 2d 3e 6d 65 73   ┆win, buf);   TxtWriteStr(ow->mes┆
0xaa0…abf 73 61 67 65 77 69 6e 2c 20 22 06 30 22 29 3b 0a 09 7d 0a 09 72 65 74 75 72 6e 3b 0a 7d 0a 0a   ┆sagewin, " 0");  }  return; }  ┆