Path: utzoo!attcan!uunet!bbn.com!rsalz From: rsalz@uunet.uu.net (Rich Salz) Newsgroups: comp.sources.unix Subject: v17i034: MGR, Bellcore window manager, Part33/61 Message-ID: <1391@papaya.bbn.com> Date: 25 Jan 89 21:38:53 GMT Lines: 1171 Approved: rsalz@uunet.UU.NET Submitted-by: Stephen A. Uhler Posting-number: Volume 17, Issue 34 Archive-name: mgr/part33 #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh 'font-16/Uoldeng22x30rI' <<'END_OF_FILE' Xbegin 644 oldeng22x30rI.fnt XM%A8>"%L@ #______________________?_________________________ XM____________________________________________________________ XM__________PO_'/S__N_8 /_',.^.=W_^[_'(?^;__\?\-Q__ __@?O\[G_W<__/Y\_G]WQW/^___________________ XM___?______[______________\______]__________]___W____________ XM_________________________________________\ #____________ XM_________^/_________________________________________________ XM______________________________________________@'^ ?!_W0_ '^ XM 8 \ X'_=#^ 0-]-__X!G^ 0/X! W_\:+ _ _QP_@4%_\ /^)Q_!./_B8..QX/ U#^ /____ XM______________]?______C______[_______,/_____C__________C__^/ XM____________________________]_______?__]_____________\ # XM_____________________^'________________________________\__\W XM__^?__Y___Q__P!__WW_^_/__/__\_____________________________?# XM^YSQ_-A_FOA^YOQ]SF/\V'^Y'G_$__[G'^Y?![D>?_F#&\=A^(/_@XN/QX?8SC_ ?__________________\/______C_ XM_____Y______^./_____C__________C__^/________________________ XM____[______^___[_____________\ #______________________7_ XM_______________________________X+_X/__\%__P7__Q__P!__@'_\ ?_ XM^"__X+____________________________^C_\GQ^9W_\OQ_^?__]'?YGO_^ XM'O_B___]'_^?C_X>_^6+'\?W\Q>/\7C_,7C_%\?[_Q_[]_^+Q_Q>/_BXN/XW XM_XWC_P ___________________\'______C______P______^/______C___ XM_______C__^/____________________________C______\___S________ XM_____\ #______________________O_________________________ XM______^$'_T?__"#_\(/__C__@#_^ /_X ?_A!_^$'__________________ XM__________BQ_S'Q\QW_XOQ_Y?__S'?S'?_Y'__B___S'_Y?W_D>_\6+'\/W XM\Q?'\7C_,7Q_%\?Y_[_W=_^+Q_Q>/_BXN/XW_XWC__]_________________ XM__^/______C______X?_____^/______C__________C__^/____________ XM________________C______Y___G_____________\ #____________ XM__________?_______________________________^/'_\?__'C_\>/__C_ XM_O__^(?__ __CQ_^/'____________________________!Q_C'Q\QW_XOQ_ XMQ?__C'?S&__Q'__B___C'_Q?__$>_\6+'\/WXQ?'\7C^,7Q_%\?P/__F=_^+ XMQ_Q>/_BXN/\/_XWC__]____________________?______C______\/_____ XM^/______C___O__^___C__^/____________________________C______Y XM___G_____________\ #____________________________________ XM__________________^/'_\?__'C_\>/__G__O__^/___]__CQ_^/'______ XM______________________!X_C%SYQW_XGA_Q?__C'?G%__Q%W_B___C'_Q> XM/_$>_\6+']'WYQ?C\7C^<7X_%\?D!\?,=_^+Q_Q>/_BXN/\/_XWC__[_____ XM______________________C______^'_____^/______C___'__\?__C__^/ XM____________________________C______Q___'_____________\ # XM______________________________________________________^/'_\? XM__'C_\>/__'__O__^/___]__CQ_^/'_]___W______________________]X XM_#%GYQW_PH1_A8__# ?G#__A%#_"___#'_A9'^$>_X0('Y'WQQ?CX0#\<7X^ XM%X_F "/,=_\(!_A /_BXN/P!_PP#__W___________________________C_ XM______#_____^/______C___O__^___C__^/________________________ XM____C______Q___'_____________\ #________________________ XM______________________________^/'_\?__/C_\^/__+__O__^/___[__ XMCQ_^/'_X___C______________________[X^#$3QQW_@OQ_!07^# ?' ?_! XM$C^"__^#'_!''\$>_P0('QCWQQ?CP7C\<7X\%C_CP#><=_X+Q_!>/_" @/P! XM_@WC__O___________________________C_______A?____^!______C___ XM_______C__^/____________________________@?_____Q___'________ XM_____\ #________________________________________________ XM______^/'_\?___C__^/_^3__''_^/___W__CQ_^/'_P?__!____________ XM__________X >#!QQQW_@OQ_! /^# ?'%G_!!C^"__^#'_!?C\$>_P0('Q@' XMQQ #P7C\<0 \$!_P^!^<=_X+Q_!>/^"XN/P!_@WC_X#_________________ XM______[/__B?__Y___0__^?_^!___S__C/__-__\W__CO_^/__]]]_WW__]_ XM_^[___?__-O__GO_@?__??_X]__CWW_'M_\TW_P??\ #____________ XM__________________________________________^/'_\?___#__\?_^C_ XM_ "_^/?__W__@!_^.'_X___C______________________P >#%QQQW_@H1_ XM!??^# ?'%S_!%C^"__^#'_!?C\$>_P0('P!WQQ?CP7C\<7X\ Q_X&P\<=_X( XM!_! /^"XN/^'_@WC_X#_______________________P"__@%__P/_XX__X/_ XM^#___-O_B%_^#__X/__B'_^/__XPP?C!__P__\!__\/_^ /_^ ?_@__^./_X XM0O_A#"^#!_X(/_@ _\ #____________________________________ XM__________________^/'_\?__\#__X__]C__&!_^(+__G__P#_]!'_]___W XM______________________P /C%QQQW_XGA_Q??_C'?'$#_Q$#_B___C'_Q? XMG_$>_\6+']QWQQ?C\0#\<7X_!Q_\ \\<=_^+Q_Q>/^" @/]C_XWC_X#_____ XM__________________Y!__B#_^ /_XX__#/_^/__X\/_AC_]'__\?__AC_^/ XM__P((_ C_^,7_X8O_C%_]$/_X@__C__^,'_\,?_PPQ^P#_T/_$>_\6+']XWQQ #\7C\<0 _ XM%X__ $\<=_^+Q_Q>/_BXN/]C_XP#_]________________________]Q__CC XM_^&?_XX__C'_^/__X\?_CC__'__\?__CS_^/__XXX_CC_^./_\_\6+']XWYQ?G\7C^<7Y_%X__X \<=_^+Q_Q>/_BXN/[Q XM_XWC_]________________________\Q__CC_^/__XX__CC_^/__X\?_CC__ XM'__\?__CG_^/__XXX_CC_^./_\/_BXN/[Q_XWC_[__________________ XM______Y1__CC_^/__XX__CG_^/__X\?_CC__'__\?__B'_^/__XXX_CC_^./ XM_\/_BXN/WX_XWC_W________________________QQ__CC_^/__XX__B?_ XM^/__X\?_CC__'__\?__A'_^/__XXX_CC_^./_\ XMC_ ^_\6+'X^'\_?/\7C_/WS_#\?_WL_#]/^#Q_Q>/_@XN/CX_XWC_O______ XM__________________QQ__CC_^/__XX__A__^/__X\?_CC__'__\?__C'_^/ XM__XXX_CC_^./_\'F '_P!_X<(_X?_^&$/X<>/W '^ /________________ XM______\9__X?__@__^'__P'__A__P ?_CG__C__^/__XC__C__XXX_CC__A_ XM_P#__X#_^A__X!__X__\"/_Z#__H"/\!#_\ ?_@ _\ #____________ XM____________________________U______]_______S__^?__'[_]]___S_ XM_/O__S___?__\__^^__]___U_____________________/[_Z?X__PW_/\?\ XM_^/S^??_#_\_G?W#__/X_\_OYS_X_____]_W______]___W___G__________________________________ XM_________________^/__W______'____________________\?___C_____ XM______________________]X_____\ #________________________ XM____________________________________________________________ XM_________________________________?__^_____W_?__]___W__?___]_ XM_G^?__?__]___W___O__]_______\7___\_W___N____]_W______]___W__ XM_GX/__________________________________________________/__S__ XM____G____________________\?___C___________________________]P XM?____\ #________________________________________________ XM____________________________________________________________ XM_________?__^_____W_?__]___W__?___]__C____?__]___W___O__]___ XM____\7___\]W___Q____]_W______]___W___P '____________________ XM____________________________Y_/__Q______G___________________ XM_\?___C___________________________\ ?____\ #____________ XM____________________________________________________________ XM_____________________________________________?__^_____W_?__] XM_]_W__?___]__C____?__]___W_W_S__]_______\7___\=W________]_W_ XM_____]___W___P #____________________________________________ XM____R>?__Q_____X/____________________\?___A_________________ XM__________\'?____\ #____________________________________ XM____________________________________________________________ XM_____________________O___?____G_O__^_S_[_^?___^__#____O__^__ XM_[_/_\?_^_______\?___^#[________Y_[______^___[___X'[________ XM________________________________________TH___A_____P?_______ XM_____________\____C___________________________^/?____\ # XM____________________________________________________________ XM_________________________________________________________S__ XM_F____'_S___//_\_\?____/_'____S___/__\\______/______\O____#\ XM________Q_\_______/__\_____[________________________________ XM_________________1___C_____P_____________________]____G_____ XM________________________?____\ #________________________ XM____________________________________________________________ XM_________________________________\___Y____O_\___P___/^_____S XM_/____\___S___#______S______]_____G_/_______[__/______S___/_ XM_____________________________________________________G___G__ XM___V_____________________[____O____________________________\ X&_____\ X Xend END_OF_FILE # end of 'font-16/Uoldeng22x30rI' fi if test -f 'font-32/Uoldeng22x30rI' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'font-32/Uoldeng22x30rI'\" else echo shar: Extracting \"'font-32/Uoldeng22x30rI'\" \(10460 characters\) sed "s/^X//" >'font-32/Uoldeng22x30rI' <<'END_OF_FILE' Xbegin 644 oldeng22x30rI.fnt XM&!8>"%L@ #______________________?_________________________ XM____________________________________________________________ XM__________PO_'/S__N_8 /_',.^.=W_^[_'(?^;__\?\-Q__ __@?O\[G_W<__/Y\_G]WQW/^___________________ XM___?______[______________\______]__________]___W____________ XM_________________________________________\ #____________ XM_________^/_________________________________________________ XM______________________________________________@'^ ?!_W0_ '^ XM 8 \ X'_=#^ 0-]-__X!G^ 0/X! W_\:+ _ _QP_@4%_\ /^)Q_!./_B8..QX/ U#^ /____ XM______________]?______C______[_______,/_____C__________C__^/ XM____________________________]_______?__]_____________\ # XM_____________________^'________________________________\__\W XM__^?__Y___Q__P!__WW_^_/__/__\_____________________________?# XM^YSQ_-A_FOA^YOQ]SF/\V'^Y'G_$__[G'^Y?![D>?_F#&\=A^(/_@XN/QX?8SC_ ?__________________\/______C_ XM_____Y______^./_____C__________C__^/________________________ XM____[______^___[_____________\ #______________________7_ XM_______________________________X+_X/__\%__P7__Q__P!__@'_\ ?_ XM^"__X+____________________________^C_\GQ^9W_\OQ_^?__]'?YGO_^ XM'O_B___]'_^?C_X>_^6+'\?W\Q>/\7C_,7C_%\?[_Q_[]_^+Q_Q>/_BXN/XW XM_XWC_P ___________________\'______C______P______^/______C___ XM_______C__^/____________________________C______\___S________ XM_____\ #______________________O_________________________ XM______^$'_T?__"#_\(/__C__@#_^ /_X ?_A!_^$'__________________ XM__________BQ_S'Q\QW_XOQ_Y?__S'?S'?_Y'__B___S'_Y?W_D>_\6+'\/W XM\Q?'\7C_,7Q_%\?Y_[_W=_^+Q_Q>/_BXN/XW_XWC__]_________________ XM__^/______C______X?_____^/______C__________C__^/____________ XM________________C______Y___G_____________\ #____________ XM__________?_______________________________^/'_\?__'C_\>/__C_ XM_O__^(?__ __CQ_^/'____________________________!Q_C'Q\QW_XOQ_ XMQ?__C'?S&__Q'__B___C'_Q?__$>_\6+'\/WXQ?'\7C^,7Q_%\?P/__F=_^+ XMQ_Q>/_BXN/\/_XWC__]____________________?______C______\/_____ XM^/______C___O__^___C__^/____________________________C______Y XM___G_____________\ #____________________________________ XM__________________^/'_\?__'C_\>/__G__O__^/___]__CQ_^/'______ XM______________________!X_C%SYQW_XGA_Q?__C'?G%__Q%W_B___C'_Q> XM/_$>_\6+']'WYQ?C\7C^<7X_%\?D!\?,=_^+Q_Q>/_BXN/\/_XWC__[_____ XM______________________C______^'_____^/______C___'__\?__C__^/ XM____________________________C______Q___'_____________\ # XM______________________________________________________^/'_\? XM__'C_\>/__'__O__^/___]__CQ_^/'_]___W______________________]X XM_#%GYQW_PH1_A8__# ?G#__A%#_"___#'_A9'^$>_X0('Y'WQQ?CX0#\<7X^ XM%X_F "/,=_\(!_A /_BXN/P!_PP#__W___________________________C_ XM______#_____^/______C___O__^___C__^/________________________ XM____C______Q___'_____________\ #________________________ XM______________________________^/'_\?__/C_\^/__+__O__^/___[__ XMCQ_^/'_X___C______________________[X^#$3QQW_@OQ_!07^# ?' ?_! XM$C^"__^#'_!''\$>_P0('QCWQQ?CP7C\<7X\%C_CP#><=_X+Q_!>/_" @/P! XM_@WC__O___________________________C_______A?____^!______C___ XM_______C__^/____________________________@?_____Q___'________ XM_____\ #________________________________________________ XM______^/'_\?___C__^/_^3__''_^/___W__CQ_^/'_P?__!____________ XM__________X >#!QQQW_@OQ_! /^# ?'%G_!!C^"__^#'_!?C\$>_P0('Q@' XMQQ #P7C\<0 \$!_P^!^<=_X+Q_!>/^"XN/P!_@WC_X#_________________ XM______[/__B?__Y___0__^?_^!___S__C/__-__\W__CO_^/__]]]_WW__]_ XM_^[___?__-O__GO_@?__??_X]__CWW_'M_\TW_P??\ #____________ XM__________________________________________^/'_\?___#__\?_^C_ XM_ "_^/?__W__@!_^.'_X___C______________________P >#%QQQW_@H1_ XM!??^# ?'%S_!%C^"__^#'_!?C\$>_P0('P!WQQ?CP7C\<7X\ Q_X&P\<=_X( XM!_! /^"XN/^'_@WC_X#_______________________P"__@%__P/_XX__X/_ XM^#___-O_B%_^#__X/__B'_^/__XPP?C!__P__\!__\/_^ /_^ ?_@__^./_X XM0O_A#"^#!_X(/_@ _\ #____________________________________ XM__________________^/'_\?__\#__X__]C__&!_^(+__G__P#_]!'_]___W XM______________________P /C%QQQW_XGA_Q??_C'?'$#_Q$#_B___C'_Q? XMG_$>_\6+']QWQQ?C\0#\<7X_!Q_\ \\<=_^+Q_Q>/^" @/]C_XWC_X#_____ XM__________________Y!__B#_^ /_XX__#/_^/__X\/_AC_]'__\?__AC_^/ XM__P((_ C_^,7_X8O_C%_]$/_X@__C__^,'_\,?_PPQ^P#_T/_$>_\6+']XWQQ #\7C\<0 _ XM%X__ $\<=_^+Q_Q>/_BXN/]C_XP#_]________________________]Q__CC XM_^&?_XX__C'_^/__X\?_CC__'__\?__CS_^/__XXX_CC_^./_\_\6+']XWYQ?G\7C^<7Y_%X__X \<=_^+Q_Q>/_BXN/[Q XM_XWC_]________________________\Q__CC_^/__XX__CC_^/__X\?_CC__ XM'__\?__CG_^/__XXX_CC_^./_\/_BXN/[Q_XWC_[__________________ XM______Y1__CC_^/__XX__CG_^/__X\?_CC__'__\?__B'_^/__XXX_CC_^./ XM_\/_BXN/WX_XWC_W________________________QQ__CC_^/__XX__B?_ XM^/__X\?_CC__'__\?__A'_^/__XXX_CC_^./_\ XMC_ ^_\6+'X^'\_?/\7C_/WS_#\?_WL_#]/^#Q_Q>/_@XN/CX_XWC_O______ XM__________________QQ__CC_^/__XX__A__^/__X\?_CC__'__\?__C'_^/ XM__XXX_CC_^./_\'F '_P!_X<(_X?_^&$/X<>/W '^ /________________ XM______\9__X?__@__^'__P'__A__P ?_CG__C__^/__XC__C__XXX_CC__A_ XM_P#__X#_^A__X!__X__\"/_Z#__H"/\!#_\ ?_@ _\ #____________ XM____________________________U______]_______S__^?__'[_]]___S_ XM_/O__S___?__\__^^__]___U_____________________/[_Z?X__PW_/\?\ XM_^/S^??_#_\_G?W#__/X_\_OYS_X_____]_W______]___W___G__________________________________ XM_________________^/__W______'____________________\?___C_____ XM______________________]X_____\ #________________________ XM____________________________________________________________ XM_________________________________?__^_____W_?__]___W__?___]_ XM_G^?__?__]___W___O__]_______\7___\_W___N____]_W______]___W__ XM_GX/__________________________________________________/__S__ XM____G____________________\?___C___________________________]P XM?____\ #________________________________________________ XM____________________________________________________________ XM_________?__^_____W_?__]___W__?___]__C____?__]___W___O__]___ XM____\7___\]W___Q____]_W______]___W___P '____________________ XM____________________________Y_/__Q______G___________________ XM_\?___C___________________________\ ?____\ #____________ XM____________________________________________________________ XM_____________________________________________?__^_____W_?__] XM_]_W__?___]__C____?__]___W_W_S__]_______\7___\=W________]_W_ XM_____]___W___P #____________________________________________ XM____R>?__Q_____X/____________________\?___A_________________ XM__________\'?____\ #____________________________________ XM____________________________________________________________ XM_____________________O___?____G_O__^_S_[_^?___^__#____O__^__ XM_[_/_\?_^_______\?___^#[________Y_[______^___[___X'[________ XM________________________________________TH___A_____P?_______ XM_____________\____C___________________________^/?____\ # XM____________________________________________________________ XM_________________________________________________________S__ XM_F____'_S___//_\_\?____/_'____S___/__\\______/______\O____#\ XM________Q_\_______/__\_____[________________________________ XM_________________1___C_____P_____________________]____G_____ XM________________________?____\ #________________________ XM____________________________________________________________ XM_________________________________\___Y____O_\___P___/^_____S XM_/____\___S___#______S______]_____G_/_______[__/______S___/_ XM_____________________________________________________G___G__ XM___V_____________________[____O____________________________\ X&_____\ X Xend END_OF_FILE # end of 'font-32/Uoldeng22x30rI' fi if test -f 'src/cut.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'src/cut.c'\" else echo shar: Extracting \"'src/cut.c'\" \(10755 characters\) sed "s/^X//" >'src/cut.c' <<'END_OF_FILE' X/* Copyright (c) 1987 Bellcore X * All Rights Reserved X * Permission is granted to copy or use this program, EXCEPT that it X * may not be sold for profit, the copyright notice must be reproduced X * on copies, and credit should be given to Bellcore where it is due. X * BELLCORE MAKES NO WARRANTY AND ACCEPTS NO LIABILITY FOR THIS PROGRAM. X */ X/* $Header: cut.c,v 4.2 88/06/27 11:13:00 bianchi Exp $ X $Source: /tmp/mgrsrc/src/RCS/cut.c,v $ X*/ Xstatic char RCSid_[] = "$Source: /tmp/mgrsrc/src/RCS/cut.c,v $$Revision: 4.2 $"; X X/* cut and paste text */ X X#include X#include "bitmap.h" X#include "defs.h" X#include "font.h" X#include "window.h" X#include "event.h" X X/* stuff global buffer into input stream */ X Xint Xpaste() X { X if (snarf) { X do_event(EVENT_PASTE,active,E_MAIN); X Write(ACTIVE(to_fd),snarf,strlen(snarf)); X#ifdef DEBUG X dprintf(y)(stderr,"%s: Pasting [%s]\n",ACTIVE(tty), snarf?snarf:"EMPTY"); X#endif X } X#ifdef DEBUG X else { X dprintf(y)(stderr,"%s: Nothing to paste\n",ACTIVE(tty)); X } X#endif X } X X/* cut text from a window, put in global buffer */ X X X#define MAXROWS 64 /* greatest char height */ X#define MAXCOLS 32 /* widest char (bits in u-long) */ X XBITMAP *glyph; /* spot for glyph comparison */ Xunsigned long data[MAXROWS]; /* bit data for glyph */ XBITMAP *check; /* other spot for glyph comparison */ Xunsigned long data2[MAXROWS]; /* bit data for other glyph */ X Xstatic struct entry **table; /* hash table */ X X/* sweep out and cut text */ X Xint Xcut() X { X register int i,j; X register WINDOW *win = active; /* window to cut text from */ X int count; /* # of snarfed chars */ X int errors = 0; /* number of misses */ X int cols=1, rows=0; /* rows and cols swept */ X int col,row; /* starting col and row */ X int maxcol; /* # of cols in row */ X int x,y; /* bit position in bitmap */ X int hcode; /* hash code */ X int button; /* button from move_mouse */ X char c; /* matched char */ X char *pntr; /* current char in line */ X struct entry *entry; /* current hash table entry */ X char *line; /* buffer to receive text */ X char get_match(),*malloc(); X char *to_tabs(), *fixline(); X X /* return immediately if window is not snarffable */ X X if (W(flags) & W_SNARFABLE ==0) X return(0); X X /* initialize comparison registers */ X X glyph = bit_alloc(32,FSIZE(high),data,1); X check = bit_alloc(32,FSIZE(high),data2,1); X bit_blit(check,0,0,32,FSIZE(high),BIT_CLR,NULL_DATA,0,0); X X /* build hash table */ X X if ((table = W(font)->table) == NULL) { X#ifdef DEBUG X dprintf(C)(stderr,"building cut table\n"); X#endif X table = W(font)->table = X (struct entry **) malloc (sizeof (struct entry) * H_SIZE); X bzero(table, sizeof(struct entry) * H_SIZE); X X for(i = FSIZE(start);iglyph[i] && i >= ' ') { X hcode = get_hash(W(font)->glyph[i],0,0,FSIZE(wide),FSIZE(high),0); X enter(hcode,i); X } X } X } X X /* find cut region */ X X SETMOUSEICON(&mouse_cut); X button = move_mouse(screen,mouse,&mousex,&mousey,0); X SETMOUSEICON(&mouse_arrow); X i = get_text(screen,mouse,mousex,mousey,&cols,&rows,win,E_SWTEXTT); X if (i == 0) { X do_button(0); X return(0); X } X X /* find extent of cut region */ X X col = (mousex-(W(x0)+SUM_BDR+W(text.x)))/FSIZE(wide); X maxcol = (W(text.wide) ? W(text.wide) : BIT_WIDE(W(window)))/FSIZE(wide); X row = (mousey-(W(y0)+SUM_BDR+W(text.y)))/FSIZE(high); X X if (W(flags)&W_SNARFLINES) { /* snarf lines only */ X#ifdef DEBUG X dprintf(C)(stderr,"Cutting lines only\n"); X#endif X col = 0; X cols = maxcol; X } X X#ifdef DEBUG X dprintf(C)(stderr,"Cut got %d,%d %d x %d\n",col,row,cols,rows); X#endif X X /* look up characters */ X X pntr = line = malloc(1+(1+maxcol)*(rows+1)); /* max possible cut */ X switch(rows) { X case 0: /* 1 row */ X y = W(text.y)+row*FSIZE(high); X for(x=W(text.x)+col*FSIZE(wide),i=0;i 2 rows */ X y = W(text.y)+row*FSIZE(high); X for(x=W(text.x)+col*FSIZE(wide),i=0;i 0 || 2*errors > count) { X oops(); X count = 0; X } X else { X if (W(flags)&W_SNARFTABS) X to_tabs(col,line,line); X X if (snarf && button < BUTTON_SYS) { /* add to cut buffer */ X char *tmp = malloc(strlen(snarf) + strlen(line) +1); X count += strlen(snarf); X strcpy(tmp,snarf); X strcat(tmp,line); X free(snarf); X free(line); X snarf = tmp; X } X else if (snarf) { /* replace cut buffer */ X free(snarf); X snarf = line; X } X else /* new cut buffer */ X snarf = line; X X /* send snarf events (if any) */ X id_message = W(pid); X for(win=active;win != (WINDOW *) 0;win=W(next)) X do_event(EVENT_SNARFED,win,E_MAIN); X } X do_button(0); X return(count); X } X X/* given bitmap, get hash code */ X Xstatic int Xget_hash(map,x,y,w,h,how) XBITMAP *map; Xint x,y,w,h; /* where in map */ Xint how; /* 0-> normal, 1->inverted */ X { X register unsigned long sum = 0; X register int i,j; X bit_blit(glyph,0,0,32,h,BIT_CLR,NULL_DATA,0,0); X bit_blit(glyph,32-w,0,w,h,how ? BIT_NOT(BIT_SRC) : BIT_SRC,map,x,y); X for (j=0;j value = value; X table[item] -> next = (struct entry *) 0; X } X else { X for(entry = table[item];entry->next;entry = entry -> next); X entry -> next = (struct entry *) malloc(sizeof (struct entry)); X entry -> next -> value = value; X entry -> next -> next = (struct entry *) 0; X } X } X X/* find a character match in current font */ X Xstatic char Xget_match(map,x,y,w,h) XBITMAP *map; /* bitmap containing text */ Xint x,y,w,h; /* position of glyph in "map" */ X { X register struct entry *entry; X register WINDOW *win = active; X int code; /* hash code */ X int size = sizeof(long) * h; X X code = get_hash(map,x,y,w,h,0); /* leaves char in glyph */ X for(entry=table[code];entry;entry=entry->next) { X bit_blit(check,32-w,0,w,h,BIT_SRC,W(font)->glyph[entry->value],0,0); X if (bcmp(data,data2,size)==0) { X return(entry->value); X } X } X X /* try inverse video version */ X X code = get_hash(map,x,y,w,h,1); /* leaves char in glyph */ X for(entry=table[code];entry;entry=entry->next) { X bit_blit(check,32-w,0,w,h,BIT_SRC,W(font)->glyph[entry->value],0,0); X if (bcmp(data,data2,size)==0) { X return(entry->value); X } X } X return('\0'); X } X X/* zap a font hash table */ X Xzap_fhash(fnt) Xstruct font *fnt; X { X register struct entry *entry, *next; X register int i; X X if (fnt->table) { X for(i=0;inext; X free(entry); X } X free(fnt->table); X } X } X X/* change trailing white space into \n */ X Xchar * Xfixline(s,pnt) Xchar *s; Xregister char *pnt; X { X while (*--pnt == ' ' && pnt > s); X *++pnt = '\n'; X return(++pnt); X } X X/* change spaces to tabs */ X Xstatic char * Xto_tabs(pos,in,out) Xregister int pos; /* starting col # */ Xregister char *in; /* input str */ Xregister char *out; /* output str - tabs */ X { X char *s = out; /* start of out str */ X register char c; /* current input char */ X register int spaces = 0; /* # pending spaces */ X X#ifdef DEBUG X dprintf(C)(stderr,"-> TABS"); X#endif X while(pos++,c = *in++) { X X if (c=='\n' || c=='\r' || c=='\f') /* reset column counter */ X pos =0; X X if (c == ' ') { X spaces++; X if (pos && pos%8 == 0) { /* ' ' -> \t */ X c = '\t'; X#ifdef DEBUG X dprintf(C)(stderr,"."); X#endif X spaces=0; X } X } X else for(;spaces>0;spaces--) { /* output spaces */ X *out++ = ' '; X } X X if (spaces == 0) X *out++ = c; X } X *out = '\0'; X#ifdef DEBUG X dprintf(C)(stderr,"\n"); X#endif X return(s); X } X X/* can't cut, ring bell */ X Xstatic int Xoops() X { X register WINDOW *win = active; X X CLEAR(W(window),BIT_NOT(BIT_DST)); X write(2,"\007",1); X CLEAR(W(window),BIT_NOT(BIT_DST)); X } END_OF_FILE # end of 'src/cut.c' fi if test -f 'src/win_stack.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'src/win_stack.c'\" else echo shar: Extracting \"'src/win_stack.c'\" \(10948 characters\) sed "s/^X//" >'src/win_stack.c' <<'END_OF_FILE' X/* Copyright (c) 1987 Bellcore X * All Rights Reserved X * Permission is granted to copy or use this program, EXCEPT that it X * may not be sold for profit, the copyright notice must be reproduced X * on copies, and credit should be given to Bellcore where it is due. X * BELLCORE MAKES NO WARRANTY AND ACCEPTS NO LIABILITY FOR THIS PROGRAM. X */ X/* $Header: win_stack.c,v 4.2 88/07/20 10:22:55 sau Exp $ X $Source: /tmp/mgrsrc/src/RCS/win_stack.c,v $ X*/ Xstatic char RCSid_[] = "$Source: /tmp/mgrsrc/src/RCS/win_stack.c,v $$Revision: 4.2 $"; X X/* push - pop window environment */ X X#include "bitmap.h" X#include "font.h" X#include "defs.h" X#include "window.h" X#include "menu.h" X#include "event.h" X#include X X#define S(x) (stack->x) X X/* push a window on the environment stack */ X Xint Xwin_push(win,level) Xregister WINDOW *win; /* window to push */ Xint level; /* what things to push */ X { X register WINDOW *stack; /* pushed window goes here */ X register int i,j; X char *malloc(), *save_line(), *print_stack(); X struct menu_state *menu_copy(); X X if ((stack = (WINDOW *) malloc(sizeof(WINDOW))) == (WINDOW *) 0) X return(-1); X X if (level == 0) X level = P_DEFAULT; X X#ifdef DEBUG X dprintf(P)(stderr,"%s Stacking %s\n", X W(tty),print_stack(level)); X#endif X X /* setup stacked window */ X X *stack = *win; /* structure assignment */ X W(stack) = stack; X X /* bcopy(win,stack,sizeof(WINDOW)); */ X X for(j=0;j