home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / sources / misc / 3785 < prev    next >
Encoding:
Text File  |  1992-07-30  |  27.2 KB  |  986 lines

  1. Newsgroups: comp.sources.misc
  2. Path: sparky!kent
  3. From: sbo@vlsi.polymtl.ca (Stephane Boucher)
  4. Subject:  v31i061:  bam - [OpenLook|Athena] menu system for [GNU|Epoch|Lucid] Emacs, Part05/07
  5. Message-ID: <1992Jul31.042552.23860@sparky.imd.sterling.com>
  6. Followup-To: comp.sources.d
  7. X-Md4-Signature: b14a70b52ccbae5a813c14c75524ad86
  8. Sender: kent@sparky.imd.sterling.com (Kent Landfield)
  9. Organization: Sterling Software
  10. References: <csm-v31i057=bam.232156@sparky.IMD.Sterling.COM>
  11. Date: Fri, 31 Jul 1992 04:25:52 GMT
  12. Approved: kent@sparky.imd.sterling.com
  13. Lines: 971
  14.  
  15. Submitted-by: sbo@vlsi.polymtl.ca (Stephane Boucher)
  16. Posting-number: Volume 31, Issue 61
  17. Archive-name: bam/part05
  18. Environment: Lex, Yacc, SunOS 4.x with XView or BSD Unix with Athena Widget
  19. Supersedes: bam: Volume 27, Issue 68-69
  20.  
  21. #! /bin/sh
  22. # This is a shell archive.  Remove anything before this line, then unpack
  23. # it by saving it into a file and typing "sh file".  To overwrite existing
  24. # files, type "sh file -c".  You can also feed this as standard input via
  25. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  26. # will see the following message at the end:
  27. #        "End of archive 5 (of 7)."
  28. # Contents:  bam-2.0/GrabAndManage.c bam-2.0/Makefile.in
  29. #   bam-2.0/configure.sh
  30. # Wrapped by sbo@froh on Mon Jul 27 20:11:50 1992
  31. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  32. if test -f 'bam-2.0/GrabAndManage.c' -a "${1}" != "-c" ; then 
  33.   echo shar: Will not clobber existing file \"'bam-2.0/GrabAndManage.c'\"
  34. else
  35. echo shar: Extracting \"'bam-2.0/GrabAndManage.c'\" \(8195 characters\)
  36. sed "s/^X//" >'bam-2.0/GrabAndManage.c' <<'END_OF_FILE'
  37. X/*
  38. X  GrabAndManage - window manager widget
  39. X  Copyright(C) 1992 Anders Carlsson
  40. X
  41. X  This program is free software; you can redistribute it and/or modify
  42. X  it under the terms of the GNU General Public License as published by
  43. X  the Free Software Foundation; either version 1, or (at your option)
  44. X  any later version.
  45. X  
  46. X  This program is distributed in the hope that it will be useful,
  47. X  but WITHOUT ANY WARRANTY; without even the implied warranty of
  48. X  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  49. X  GNU General Public License for more details.
  50. X  
  51. X  You should have received a copy of the GNU General Public License
  52. X  along with this program; if not, write to the Free Software
  53. X  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  54. X  */
  55. X/* $ @(#) GrabAndManage.c, v 0.2 92-02-17 Anders Carlsson $ */
  56. X
  57. X#include <stdio.h>
  58. X#include <X11/Xos.h>
  59. X#include <X11/Xlib.h>
  60. X#include <X11/Xutil.h>
  61. X#include <X11/cursorfont.h>
  62. X#include <X11/IntrinsicP.h>
  63. X#include <X11/StringDefs.h>
  64. X#include "GrabAndManageP.h"
  65. X#include "FindWindow.h"
  66. X#include <stdio.h>
  67. X#include <varargs.h>
  68. X
  69. X/* winX,winY,winWidth,winHeight resources added by Hans Olsson */
  70. X
  71. Xstatic XtResource resources[] = {
  72. X#define offset(field) XtOffsetOf(GrabAndManageRec, grabAndManage.field)
  73. X    /* {name, class, type,
  74. X       size, offset,
  75. X       default_type, default_addr}, */
  76. X
  77. X    { XtNwindowName, XtCString, XtRString,
  78. X    sizeof(String), offset(window_name),
  79. X    XtRString, (XtPointer) NULL },
  80. X    { XtNwinSelectString, XtCWinSelectString, XtRString,
  81. X    sizeof(String), offset(select_string),
  82. X    XtRString, (XtPointer) "click on window to manage" },
  83. X    { XtNwinX,XtCPosition,XtRPosition,
  84. X    sizeof(Position),offset(winX),
  85. X    XtRPosition,(XtPointer) 0},
  86. X    { XtNwinY,XtCPosition,XtRPosition,
  87. X    sizeof(Position),offset(winY),
  88. X    XtRPosition,(XtPointer) 0},
  89. X    { XtNwinWidth,XtCWidth,XtRDimension,
  90. X    sizeof(Dimension),offset(winWidth),
  91. X    XtRDimension,(XtPointer) 0},
  92. X    { XtNwinHeight,XtCHeight,XtRDimension,
  93. X    sizeof(Dimension),offset(winHeight),
  94. X    XtRDimension,(XtPointer) 0},
  95. X
  96. X#undef offset
  97. X};
  98. X
  99. Xstatic void GAMRealize(
  100. X#if NeedFunctionPrototypes
  101. X       Widget,
  102. X       XtValueMask          *,
  103. X       XSetWindowAttributes *
  104. X#endif
  105. X);
  106. X
  107. Xstatic void GAMDestroy(
  108. X#if NeedFunctionPrototypes
  109. X       Widget
  110. X#endif
  111. X);
  112. XGrabAndManageClassRec grabAndManageClassRec = {
  113. X  { /* core fields */
  114. X    /* superclass        */    (WidgetClass) &widgetClassRec,
  115. X    /* class_name        */    "GrabAndManage",
  116. X    /* widget_size        */    sizeof(GrabAndManageRec),
  117. X    /* class_initialize        */    NULL,
  118. X    /* class_part_initialize    */    NULL,
  119. X    /* class_inited        */    FALSE,
  120. X    /* initialize        */      NULL,
  121. X    /* initialize_hook        */    NULL,
  122. X    /* realize            */      (XtProc)GAMRealize,
  123. X    /* actions            */    NULL,
  124. X    /* num_actions        */    0,
  125. X    /* resources        */    resources,
  126. X    /* num_resources        */    XtNumber(resources),
  127. X    /* xrm_class        */    NULLQUARK,
  128. X    /* compress_motion        */    TRUE,
  129. X    /* compress_exposure    */    TRUE,
  130. X    /* compress_enterleave    */    TRUE,
  131. X    /* visible_interest        */    FALSE,
  132. X    /* destroy            */    (XtProc)GAMDestroy,
  133. X    /* resize            */    NULL,
  134. X    /* expose            */    NULL,
  135. X    /* set_values        */    NULL,
  136. X    /* set_values_hook        */    NULL,
  137. X    /* set_values_almost    */    XtInheritSetValuesAlmost,
  138. X    /* get_values_hook        */    NULL,
  139. X    /* accept_focus        */    NULL,
  140. X    /* version            */    XtVersion,
  141. X    /* callback_private        */    NULL,
  142. X    /* tm_table            */    NULL,
  143. X    /* query_geometry        */    XtInheritQueryGeometry,
  144. X    /* display_accelerator    */    XtInheritDisplayAccelerator,
  145. X    /* extension        */    NULL
  146. X  },
  147. X  { /* template fields */
  148. X    /* empty            */    0
  149. X  }
  150. X};
  151. X
  152. XWidgetClass grabAndManageWidgetClass = (WidgetClass)&grabAndManageClassRec;
  153. X
  154. X/*
  155. X * Standard fatal error routine - call like printf.
  156. X * Does not require dpy or screen defined.
  157. X * Replaced y SendErrorToEmacs in this app.
  158. X */
  159. X/* VARARGS1 */
  160. X#if 0
  161. Xvoid Fatal_Error(va_alist)
  162. Xva_dcl
  163. X{
  164. X        va_list args;
  165. X    char*fmt;
  166. X    
  167. X    va_start(args);
  168. X
  169. X    fflush(stdout);
  170. X    fflush(stderr);
  171. X    fprintf(stderr, "%s: error: ", "GrabAndManage");
  172. X    fmt=va_arg(args,char*);
  173. X    vfprintf(stderr, fmt,args);
  174. X    fprintf(stderr, "\n");
  175. X    va_end(args);
  176. X    exit(1);
  177. X}
  178. X#endif
  179. X/*
  180. X * Routine to let user select a window using the mouse
  181. X */
  182. X
  183. XWindow Select_Window(dpy, root)
  184. X     Display *dpy;
  185. X     Window root;
  186. X{
  187. X  int status;
  188. X  Cursor cursor;
  189. X  XEvent event;
  190. X  Window target_win = None;
  191. X  int buttons = 0;
  192. X
  193. X  /* Make the target cursor */
  194. X  cursor = XCreateFontCursor(dpy, XC_crosshair);
  195. X
  196. X  /* Grab the pointer using target cursor, letting it room all over */
  197. X  status = XGrabPointer(dpy, root, False,
  198. X            ButtonPressMask|ButtonReleaseMask, GrabModeSync,
  199. X            GrabModeAsync, root, cursor, CurrentTime);
  200. X  if (status != GrabSuccess) {
  201. X    sendErrorToEmacs("Can't grab the mouse.");
  202. X    exit(1);
  203. X  }
  204. X  /* Let the user select a window... */
  205. X  while ((target_win == None) || (buttons != 0)) {
  206. X    /* allow one more event */
  207. X    XAllowEvents(dpy, SyncPointer, CurrentTime);
  208. X    XWindowEvent(dpy, root, ButtonPressMask|ButtonReleaseMask, &event);
  209. X    switch (event.type) {
  210. X    case ButtonPress:
  211. X      if (target_win == None) {
  212. X    target_win = event.xbutton.subwindow; /* window selected */
  213. X    if (target_win == None) target_win = root;
  214. X      }
  215. X      buttons++;
  216. X      break;
  217. X    case ButtonRelease:
  218. X      if (buttons > 0) /* there may have been some down before we started */
  219. X    buttons--;
  220. X       break;
  221. X    }
  222. X  } 
  223. X
  224. X  XUngrabPointer(dpy, CurrentTime);      /* Done with pointer */
  225. X
  226. X  return(target_win);
  227. X}
  228. X
  229. X/* This function reparents the named application window and makes 
  230. X   it belong to the widget */
  231. Xstatic void GAMRealize(widget, value_mask, attributes)
  232. X     Widget               widget;
  233. X     XtValueMask          *value_mask;
  234. X     XSetWindowAttributes *attributes;
  235. X{
  236. X  GrabAndManageWidget gam = (GrabAndManageWidget) widget;
  237. X  GrabAndManagePart *gam_p = &gam->grabAndManage;
  238. X  Widget parent = gam->core.parent;
  239. X  Window parent_window = parent->core.window;
  240. X  XWindowAttributes app_win_attr;
  241. X  
  242. X/* Check if the named window exists. if it does get it's ID, if not
  243. X   or if window_name is a NULL string, make the user select one on 
  244. X   the screen */
  245. X
  246. X  if ((gam_p->window_name == (void*)NULL ) ||
  247. X      ((gam_p->app_window =
  248. X       Window_With_Name(XtDisplay(widget),
  249. X            DefaultRootWindow(XtDisplay(widget)),
  250. X            gam_p->window_name)) == 0)) {
  251. X    
  252. X    fprintf(stderr,"%s\n",gam_p->select_string);
  253. X    gam_p->app_window = Select_Window(XtDisplay(widget),
  254. X                     DefaultRootWindow(XtDisplay(widget)));
  255. X  }
  256. X  XGetWindowAttributes(XtDisplay(gam), gam_p->app_window, &app_win_attr);
  257. X  {
  258. X    int rx,ry,junkwin;
  259. X
  260. X    if ((app_win_attr.map_state == IsUnmapped)||
  261. X    (app_win_attr.override_redirect==True)) {
  262. X      sendErrorToEmacs
  263. X    ("Window %s is unmapped.\nCan't grab it\n",gam_p->window_name?
  264. X         gam_p->window_name:"Unnamed");
  265. X      exit(1);
  266. X    }
  267. X    XTranslateCoordinates(XtDisplay(gam),gam_p->app_window,app_win_attr.root,
  268. X                        -app_win_attr.border_width,
  269. X                        -app_win_attr.border_width,
  270. X                        &rx,&ry,&junkwin);
  271. X
  272. X    gam_p->winX=rx;
  273. X    gam_p->winY=ry;
  274. X    gam_p->app_border_width = app_win_attr.border_width;
  275. X    gam->core.width= gam_p->winWidth=app_win_attr.width;
  276. X    gam->core.height=gam_p->winHeight=app_win_attr.height;
  277. X
  278. X    gam->core.colormap = app_win_attr.colormap;
  279. X
  280. X    /* The following remembers the position of the window */
  281. X
  282. X    
  283. X    if (!(BadWindow==XReparentWindow(XtDisplay(gam),gam_p->app_window,
  284. X            parent_window,gam->core.x,gam->core.y))) {
  285. X      gam->core.window=gam_p->app_window;
  286. X      XSetWindowBorderWidth(XtDisplay(gam),
  287. X                gam->core.window,
  288. X                gam->core.border_width);
  289. X      gam->core.widget_class->core_class.class_inited |= 0x20;
  290. X    }
  291. X  } 
  292. X}
  293. X  
  294. X
  295. Xstatic void GAMDestroy(widget)
  296. X     Widget widget;
  297. X{
  298. X  GrabAndManageWidget gam = (GrabAndManageWidget) widget;
  299. X  GrabAndManagePart *gam_p = &gam->grabAndManage;
  300. X  Window root_window = DefaultRootWindow(XtDisplay(widget));
  301. X
  302. X  /* Get rid of the stolen window */
  303. X  gam->core.window=None;
  304. X
  305. X  if (!(BadWindow==XReparentWindow(XtDisplay(gam),
  306. X                   gam_p->app_window,root_window,
  307. X                   gam_p->winX,
  308. X                   gam_p->winY))) {
  309. X    XSetWindowBorderWidth(XtDisplay(gam),
  310. X                          gam_p->app_window,
  311. X                          1);
  312. X    XMapWindow(XtDisplay(gam),gam_p->app_window);
  313. X  }
  314. X}
  315. END_OF_FILE
  316. if test 8195 -ne `wc -c <'bam-2.0/GrabAndManage.c'`; then
  317.     echo shar: \"'bam-2.0/GrabAndManage.c'\" unpacked with wrong size!
  318. fi
  319. # end of 'bam-2.0/GrabAndManage.c'
  320. fi
  321. if test -f 'bam-2.0/Makefile.in' -a "${1}" != "-c" ; then 
  322.   echo shar: Will not clobber existing file \"'bam-2.0/Makefile.in'\"
  323. else
  324. echo shar: Extracting \"'bam-2.0/Makefile.in'\" \(8029 characters\)
  325. sed "s/^X//" >'bam-2.0/Makefile.in' <<'END_OF_FILE'
  326. X#   bam - the Born Again Menus for GNU Emacs.
  327. X#   Copyright (C) 1992 Stephane Boucher.
  328. X#
  329. X#    This program is free software; you can redistribute it and/or modify
  330. X#    it under the terms of the GNU General Public License as published by
  331. X#    the Free Software Foundation; either version 1, or (at your option)
  332. X#    any later version.
  333. X#
  334. X#    This program is distributed in the hope that it will be useful,
  335. X#    but WITHOUT ANY WARRANTY; without even the implied warranty of
  336. X#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  337. X#    GNU General Public License for more details.
  338. X#
  339. X#    You should have received a copy of the GNU General Public License
  340. X#    along with this program; if not, write to the Free Software
  341. X#    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  342. X#
  343. X#  In other words, you are welcome to use, share and improve this program.
  344. X#  You are forbidden to forbid anyone else to use, share and improve
  345. X#  what you give them.   Help stamp out software-hoarding!
  346. X
  347. X# $Id: Makefile.in,v 1.18 1992/07/28 00:08:24 sbo Exp $
  348. X
  349. X#       Makefile for bam.
  350. X#
  351. X#       The following targets are available:
  352. X#
  353. X#       all:            compile all
  354. X#    doc:        Generate a dvi file of the printed document,
  355. X#                 and bam-info, a info file for emacs.
  356. X#       install:        install bam
  357. X#       uninstall:      uninstall bam if you don't like it
  358. X#       clean:          removes object files.
  359. X#
  360. X#
  361. X#    You should first run configure with the command:
  362. X#        sh configure.sh
  363. X#    This will determine your directories XLIB, XINC and XBITMAPS.
  364. X#
  365. X#       You should also customize the following four definitions:
  366. X#       bindir, elispdir, bitmapdir as shown below.
  367. X#
  368. X#       Then do make all, make install, make clean,
  369. X#       (and hopefully not make uninstall :->)
  370. X#
  371. X#
  372. X###########################################################################
  373. X
  374. Xprefix=/usr/local
  375. X
  376. X# Directory where the bam menus' related files should be placed
  377. Xmenudir=$(prefix)/lib/bam
  378. X
  379. X# Directory where the elisp files should be placed
  380. Xelispdir=$(prefix)/elisp
  381. X
  382. X# Directory where the executable should be placed
  383. Xbindir=$(prefix)/bin
  384. X
  385. X############  You SHOULD not have to customize below this line ###############
  386. X##############################################################################
  387. X
  388. X# CUSTOMIZE the following to where you put your OpenWindows libraries
  389. X# or Xview libraries for those without OpenWindows.
  390. XXLIB=<<XLIB>>
  391. X
  392. X# CUSTOMIZE the following to where you put your Openwindows include files
  393. X# or Xview include files for those without OpenWindows.
  394. XXINC =<<XINC>>
  395. X
  396. X# Directory where the system's X bitmaps are located
  397. X# in cases where multiple bitmaps directory exist, the paths
  398. X# should be seperated by ':' with no spaces.
  399. X# for example:  /usr/lib/X11/bitmaps:/usr/local/lib/X11/bitmaps
  400. Xbitmapdir=<<XBITMAPS>>
  401. X
  402. X# Files from the sub-directory utils, to compensate for the lack
  403. X# of some functions on some systems
  404. XUTILS=<<UTILS>>
  405. X
  406. X# widget specific files
  407. XXVIEW_WIDGET_MODULES=frame \
  408. X             icon \
  409. X             menusxv \
  410. X             panelmenu \
  411. X             parfxv
  412. X
  413. XATHENA_WIDGET_MODULES=athena \
  414. X                      FindWindow \
  415. X               GrabAndManage \
  416. X              parfaw
  417. X
  418. XWIDGET_MODULES=$(<<WIDGET_KIT>>_WIDGET_MODULES)
  419. X
  420. X# Widget specific libraries
  421. XXVIEW_LIB=-lxview -lolgx -lX11
  422. XATHENA_LIB=-lXaw -lXt -lXmu -lX11 -lXext -lXt -lm
  423. XWIDGET_LIB=$(<<WIDGET_KIT>>_LIB)
  424. X
  425. X#Widget specific defines
  426. XXVIEW_DEFS=-DXVIEW=1
  427. XATHENA_DEFS=-DATHENA=1
  428. XWIDGET_DEFS=$(<<WIDGET_KIT>>_DEFS)
  429. X
  430. XINCFLAGS=-I$(XINC)
  431. XLIBFLAGS=-L$(XLIB)
  432. X
  433. XO=o
  434. XEXE=
  435. X.SUFFIXES: .y .l .$O
  436. X
  437. XVERSION=2.0
  438. X
  439. X# Lex flags
  440. XLFLAGS=
  441. XLEXLIB=-ll
  442. X# Compiler flags
  443. XCFLAGS=-g $(WIDGET_DEFS)
  444. X
  445. X# Linker flags
  446. X# dynamic link with sun's cc   : -Bdynamic
  447. X#                   gcc on sun : don't know how
  448. X#LDFLAGS=-Bdynamic    # Sun's K&R cc
  449. XLDFLAGS=        # Gcc (at least for Sun ...)
  450. XLIB=$(WIDGET_LIB)
  451. X
  452. X# List of elisp files
  453. XELISPFILES=command-process.el bam-defaults.el-dist \
  454. X       bam.el trial.el emacs_init-dist
  455. X
  456. X# List of include files
  457. XINCLUDEFILES=config.h paths.h-dist strstore.h bam.h
  458. X
  459. X# List of commands
  460. X#CC=cc             # Sun's K&R cc
  461. XCC=gcc -traditional    # Gcc
  462. XLEX=lex
  463. X# You can't use cc,lex and athena widgets on sun3's
  464. X# You have to change at least one of them, but flex doesn't define yylineno
  465. X# so you have only the choice between cc => gcc and athena => xview
  466. X# (or you can use cc if you:
  467. X# 1: make scanner.c
  468. X# 2: replace input() with something else e.g. gurka(), except when
  469. X#    part of yyinput(). (the call to input() in yyinput should of course
  470. X#    be changed).
  471. X# 3: continue to make bam.
  472. X#YACC=bison -y -l
  473. XYACC=yacc -l
  474. XPERL=perl
  475. XRM=rm
  476. XSED=sed
  477. XCP=cp
  478. XMV=mv
  479. XMKDIR=mkdir
  480. XSCCS-GET=sccs get
  481. XSUN_MAKE_CLEAN=$(RM) -f .make.state
  482. X
  483. X.c.$O:
  484. X    $(CC) $(CFLAGS) $(INCFLAGS) -c $*.c
  485. X
  486. X# I want to keep parser.c and parser.h so I have to provide
  487. X# .y.$O and .y.c so that my rules apply wether parser.c exist
  488. X# or not
  489. X.y.$O:
  490. X    $(YACC) -d -v $*.y
  491. X    @$(MV) -f y.tab.c $*.c
  492. X    @$(MV) -f y.tab.h $*.h
  493. X    $(CC) $(CFLAGS) $(INCFLAGS) -c $*.c
  494. X.y.c:
  495. X    $(YACC) -d -v $*.y
  496. X    @$(MV) -f y.tab.c $*.c
  497. X    @$(MV) -f y.tab.h $*.h
  498. X
  499. X# Lex files are treated in the same way as yacc files,
  500. X# that is I provide .l.$O and .l.c implicit rules
  501. X.l.$O:
  502. X    $(LEX) $(LFLAGS) -t $*.l > $*.c
  503. X    $(CC) $(CFLAGS) $(INCFLAGS) -c $*.c
  504. X.l.c:
  505. X    $(LEX) $(LFLAGS) -t $*.l > $*.c
  506. X
  507. XTARGET=bam
  508. XBEMACS=bemacs
  509. X
  510. XTARGET_MOD=     args \
  511. X        $(TARGET) \
  512. X        send \
  513. X        menus \
  514. X        parser \
  515. X        scanner \
  516. X        strstore \
  517. X        filenames \
  518. X        $(WIDGET_MODULES) \
  519. X        $(UTILS)
  520. X
  521. XOBJ_MOD=$(TARGET_MOD:%=%.$O)
  522. XDISTDIR=$(TARGET)-$(VERSION)
  523. XEXAMPLESDIR=menus
  524. X
  525. X$(TARGET)$(EXE): trial-stamp-check emacs_init bam-defaults.el paths.h $(OBJ_MOD)
  526. X    $(CC) $(CFLAGS) $(LDFLAGS) $(LIBFLAGS) -o $@ $(OBJ_MOD) $(LEXLIB) $(LIB)
  527. X
  528. Xpaths.h: paths.h-dist
  529. X    $(SED) "s;/usr/lib/X11/bitmaps;${bitmapdir};g" $@-dist >$@
  530. X
  531. Xbam-defaults.el: bam-defaults.el-dist
  532. X    $(SED) -e "s;/usr/local/bin;${bindir};g" \
  533. X           -e "s;/usr/lib/X11/bitmaps;${bitmapdir};g" \
  534. X           -e "s;/usr/local/lib/bam;${menudir};g" \
  535. X           -e "s;%%VERSION%%;${VERSION};g" \
  536. X               -e "s;%%WIDGET_KIT%%;<<WIDGET_KIT>>;g" \
  537. X           $@-dist >$@
  538. X
  539. Xemacs_init: emacs_init-dist
  540. X    $(SED) "s;/usr/local/elisp;${elispdir};g" $@-dist >$@
  541. X
  542. Xall:
  543. X    @$(MAKE) clean
  544. X    @$(MAKE) $(TARGET)$(EXE)
  545. X    @$(MAKE) $(BEMACS)
  546. X
  547. Xdoc:    bamdoc.dvi bam-info
  548. X
  549. Xbamdoc.dvi: bamdoc.texinfo
  550. X    tex bamdoc.texinfo
  551. X    texindex bamdoc.??
  552. X    tex bamdoc.texinfo
  553. X
  554. Xbam-info: bamdoc.texinfo
  555. X    emacs -batch -q bamdoc.texinfo -f texinfo-format-buffer -f save-buffer
  556. X
  557. Xclean:
  558. X    -$(RM) -f $(TARGET)$(EXE) *.$O scanner.c parser.c parser.h core \
  559. X              trial-stamp bemacs
  560. X    -$(SUN_MAKE_CLEAN)
  561. X    -$(RM) -f *.aux *.cp  *.cps *.dvi *.ky  *.kys *.log *.pg \
  562. X          *.pgs *.toc *.tp  *.tps *.vr  *.fn  *.fns *.vrs \
  563. X          bam-info
  564. X
  565. Xfull-clean:
  566. X    @make clean
  567. X    -$(RM) -f paths.h bam-defaults.el Makefile ${UTILS:%=%.c}
  568. X
  569. Xtrial-stamp-check:
  570. X    @sh -c 'if [ -f trial-stamp ]; then \
  571. X        make full-clean; \
  572. X        echo "-- Now run configure with sh ./configure.sh"; \
  573. X        echo "-- You can ignore the following error."; \
  574. X        exit 1; \
  575. X    fi'
  576. X
  577. Xtrial:
  578. X    sed "s;/usr/lib/X11/bitmaps;${bitmapdir};g" paths.h-dist >paths.h
  579. X    sh -c '${MAKE} bindir=`pwd` menudir=`pwd`/menus bam-defaults.el'
  580. X    @$(MAKE) $(TARGET)$(EXE)
  581. X    touch trial-stamp
  582. X
  583. Xtry-trial:
  584. X    sh -c '\
  585. X    if [ ${DISPLAY}x = x ]; then \
  586. X    echo Check your DISPLAY environment variable; \
  587. X    else \
  588. X    emacs -q -l ./command-process.el -l ./bam-defaults.el -l ./bam.el -l ./trial.el -wn Bam-trial; \
  589. X    fi'
  590. X
  591. X$(BEMACS): $(BEMACS)-dist
  592. X    $(SED) -e "s;/usr/local/elisp;${elispdir};g" \
  593. X           $(BEMACS)-dist >$(BEMACS)
  594. X    chmod a+xr $(BEMACS)
  595. X
  596. Xinstall:
  597. X    -$(MKDIR) $(bindir)
  598. X    $(CP) ./$(BEMACS) ./$(TARGET)$(EXE) $(bindir)
  599. X    -$(MKDIR) $(elispdir)
  600. X    $(CP) $(ELISPFILES:%-dist=%) $(elispdir)
  601. X    -$(MKDIR) $(menudir)
  602. X    $(CP) $(EXAMPLESDIR)/* $(menudir)
  603. X
  604. Xuninstall:
  605. X    $(RM) -f $(BINDIR)/$(TARGET)$(EXE)
  606. X    cd $(elispdir); $(RM) -f $(ELISPFILES:%-dist=%)
  607. X    cd $(menudir); $(RM) -f *
  608. X
  609. Xdist:
  610. X    $(MAKE) cleandist
  611. X    $(MKDIR) $(DISTDIR)
  612. X    $(PERL) mkdist.pl -s `pwd` -t `pwd`/$(DISTDIR) -h `pwd`/HEADER
  613. X    cd $(DISTDIR); chmod u+w *; chmod u-w *-dist *.in 
  614. X    cd $(DISTDIR)/$(EXAMPLESDIR); chmod u+w *
  615. X    cd $(DISTDIR)/utils; chmod u+w *
  616. X
  617. Xcleandist:
  618. X    $(RM) -rf $(DISTDIR)
  619. X
  620. END_OF_FILE
  621. if test 8029 -ne `wc -c <'bam-2.0/Makefile.in'`; then
  622.     echo shar: \"'bam-2.0/Makefile.in'\" unpacked with wrong size!
  623. fi
  624. # end of 'bam-2.0/Makefile.in'
  625. fi
  626. if test -f 'bam-2.0/configure.sh' -a "${1}" != "-c" ; then 
  627.   echo shar: Will not clobber existing file \"'bam-2.0/configure.sh'\"
  628. else
  629. echo shar: Extracting \"'bam-2.0/configure.sh'\" \(7589 characters\)
  630. sed "s/^X//" >'bam-2.0/configure.sh' <<'END_OF_FILE'
  631. X#   bam - the Born Again Menus for GNU Emacs.
  632. X#   Copyright (C) 1992 Stephane Boucher.
  633. X#
  634. X#    This program is free software; you can redistribute it and/or modify
  635. X#    it under the terms of the GNU General Public License as published by
  636. X#    the Free Software Foundation; either version 1, or (at your option)
  637. X#    any later version.
  638. X#
  639. X#    This program is distributed in the hope that it will be useful,
  640. X#    but WITHOUT ANY WARRANTY; without even the implied warranty of
  641. X#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  642. X#    GNU General Public License for more details.
  643. X#
  644. X#    You should have received a copy of the GNU General Public License
  645. X#    along with this program; if not, write to the Free Software
  646. X#    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  647. X#
  648. X#  In other words, you are welcome to use, share and improve this program.
  649. X#  You are forbidden to forbid anyone else to use, share and improve
  650. X#  what you give them.   Help stamp out software-hoarding!
  651. X
  652. X# $Id: configure.sh,v 1.4 1992/07/02 00:57:44 sbo Exp $
  653. X
  654. X
  655. X#################################################
  656. X# $1 = path
  657. Xchk_xathena_lib() {
  658. Xif [ -d $1 ]; then
  659. X    if [ `ls ${1}/libXaw* 2> /dev/null | grep Xaw | wc -l` != 0 ]; then
  660. X        if [ `ls ${1}/libXt* 2> /dev/null | grep Xt | wc -l` != 0 ]; then
  661. X            echo found
  662. X        else 
  663. X            echo not_found
  664. X        fi;
  665. X    else
  666. X        echo not_found
  667. X    fi;
  668. Xelse
  669. X    echo not_found
  670. Xfi
  671. X}
  672. X
  673. X##################################################
  674. X# $1 = path
  675. Xchk_xview_lib () {
  676. Xif [ -d $1 ]; then
  677. X    if [ `ls ${1}/libxview* 2> /dev/null | grep xview | wc -l` != 0 ]; then 
  678. X        if [ `ls ${1}/libolgx* 2> /dev/null | grep olgx | wc -l` != 0 ]; then 
  679. X            echo found
  680. X        else
  681. X            echo not_found
  682. X        fi;
  683. X    else
  684. X        echo not_found
  685. X    fi;
  686. Xelse
  687. X    echo not_found
  688. Xfi
  689. X}
  690. X
  691. X##################################################
  692. X# $1 = path
  693. Xchk_xathena_inc() {
  694. X    if [ `ls $1/X11/Xaw/SmeBSB.h 2>/dev/null | wc -l` =  1 ]; then
  695. X        echo found
  696. X    else
  697. X        echo not_found
  698. X    fi
  699. X}
  700. X
  701. X##################################################
  702. X# $1 = path
  703. Xchk_xview_inc() {
  704. X    if [ `ls $1/xview/xview.h 2>/dev/null | wc -l` =  1 ]; then
  705. X        echo found
  706. X    else
  707. X        echo not_found
  708. X    fi
  709. X}
  710. X
  711. X
  712. X##################################################
  713. Xecho "Choosing Widget Toolkit..."
  714. X
  715. XHAVE_XVIEW=0
  716. XHAVE_ATHENA=0
  717. Xfor lib in ${OPEWINHOME}/lib /usr/openwin/lib /usr/lib/X11 /usr/local/lib/X11; do
  718. X    if [ `chk_xview_lib $lib` = found ]; then
  719. X        HAVE_XVIEW=1
  720. X    fi
  721. Xdone
  722. X
  723. Xfor lib in /usr/lib /usr/local/lib /usr/local/lib/X11 /usr/lib/X11; do
  724. X    if [ `chk_xathena_lib $lib` = found ]; then
  725. X        HAVE_ATHENA=1
  726. X    fi
  727. Xdone
  728. X
  729. Xif [ ${HAVE_ATHENA} =  ${HAVE_XVIEW} ]; then
  730. X    echo "Do you want XView or normal toolkit(Athena widgets)?"
  731. X    echo -n "Enter 1 for athena and 2 for xview:"
  732. X    read CHOICE
  733. X    if [ $CHOICE = 1 ]; then
  734. X        WIDGET_KIT='ATHENA';
  735. X    else
  736. X        WIDGET_KIT='XVIEW';
  737. X    fi
  738. Xelse
  739. X    if [ $HAVE_XVIEW = 1 ]; then
  740. X        WIDGET_KIT='XVIEW';
  741. X    else
  742. X        WIDGET_KIT='ATHENA';
  743. X    fi
  744. Xfi
  745. X
  746. Xif [ ${WIDGET_KIT}x = XVIEWx ]; then
  747. X
  748. Xecho "Trying to find your xview and olgx librairies..."
  749. X
  750. XXLIB=''
  751. Xfor lib in ${OPEWNINHOME}/lib /usr/openwin/lib /usr/lib/X11 /usr/local/lib/X11; do
  752. X    if [ `chk_xview_lib $lib` = found ]; then 
  753. X        XLIB=$lib
  754. X        echo $lib  seems good!
  755. X        break; 
  756. X    fi
  757. Xdone
  758. Xif [ ${XLIB}x = x ]; then
  759. X    XLIB=no_directory_so_far
  760. X    while true; do
  761. X    if [ $XLIB != no_directory_so_far ]; then
  762. X    if [ -d $XLIB ]; then
  763. X        if [ `chk_xview_lib $XLIB` = found ]; then
  764. X            echo This seems good!
  765. X            break;
  766. X        else
  767. X            echo $XLIB is not good. Try again...
  768. X        fi;
  769. X    else
  770. X        echo $XLIB is not good. Try again...
  771. X    fi
  772. X    fi
  773. X    echo
  774. X    echo "Can't find your xview and olgx librairies."
  775. X    echo -n "Where are your xview and olgx librairies?: "
  776. X    read XLIB
  777. X    done
  778. Xfi
  779. X
  780. Xecho
  781. Xecho
  782. X
  783. X##################################################
  784. Xecho "Trying to find your xview include directory..."
  785. X
  786. XXINC=''
  787. Xfor inc in ${OPENWINHOME}/include /usr/openwin/include /usr/include/X11 /usr/local/include/X11; do
  788. X    if [ `chk_xview_inc $inc` = found ]; then 
  789. X        XINC=$inc
  790. X        echo $inc  seems good!
  791. X        break; 
  792. X    fi
  793. Xdone
  794. Xif [ ${XINC}x = x ]; then
  795. X    XINC=no_directory_so_far
  796. X    while true; do
  797. X    if [ $XINC != no_directory_so_far ]; then
  798. X    if [ -d $XINC ]; then
  799. X        if [ `chk_xview_inc $XINC` = found ]; then
  800. X            echo $XINC seems good!
  801. X            break;
  802. X        else
  803. X            echo $XINC is not good. Try again...
  804. X        fi;
  805. X    else
  806. X        echo $XINC is not good. Try again...
  807. X    fi
  808. X    fi
  809. X    echo
  810. X    echo "Can't find your xview include directory."
  811. X    echo -n "Where is your xview include directory?: "
  812. X    read XINC
  813. X    done
  814. Xfi
  815. X
  816. Xelse
  817. X# Athena Widgets
  818. X
  819. Xecho "Trying to find your Xt and Athena librairies..."
  820. X
  821. XXLIB=''
  822. Xfor lib in /usr/lib /usr/local/lib /usr/local/lib/X11 /usr/lib/X11; do
  823. X    if [ `chk_xathena_lib $lib` = found ]; then 
  824. X        XLIB=$lib
  825. X        echo $lib  seems good, thank you!
  826. X    fi
  827. Xdone
  828. Xif [ ${XLIB}x = x ]; then
  829. X    XLIB=no_directory_so_far
  830. X    while true; do
  831. X    if [ $XLIB != no_directory_so_far ]; then
  832. X    if [ -d $XLIB ]; then
  833. X        if [ `chk_xathena_lib $XLIB` = found ]; then
  834. X            echo This seems good, thank you!
  835. X            break;
  836. X        else
  837. X            echo $XLIB is not good. Try again...
  838. X        fi;
  839. X    else
  840. X        echo $XLIB is not good. Try again...
  841. X    fi
  842. X    fi
  843. X    echo
  844. X    echo "Can't find your toolkit and athena librairies."
  845. X    echo -n "Where are your toolkit and athena librairies?: "
  846. X    read XLIB
  847. X    done
  848. Xfi
  849. X
  850. Xecho
  851. Xecho
  852. X
  853. X##################################################
  854. Xecho "Trying to find your athena include directory..."
  855. X
  856. XXINC=''
  857. Xfor inc in /usr/include /usr/local/include; do
  858. X    if [ `chk_xathena_inc $inc` = found ]; then 
  859. X        XINC=$inc
  860. X        echo $inc  seems good, thank you!
  861. X    fi
  862. Xdone
  863. Xif [ ${XINC}x = x ]; then
  864. X    XINC=no_directory_so_far
  865. X    while true; do
  866. X    if [ $XINC != no_directory_so_far ]; then
  867. X    if [ -d $XINC ]; then
  868. X        if [ `chk_xathena_inc $XINC` = found ]; then
  869. X            echo $XINC seems good, thank you!
  870. X            break;
  871. X        else
  872. X            echo $XINC is not good. Try again...
  873. X        fi;
  874. X    else
  875. X        echo $XINC is not good. Try again...
  876. X    fi
  877. X    fi
  878. X    echo
  879. X    echo "Can't find your athena include directory."
  880. X    echo -n "Where is your athena include directory?(except the /X11 part: "
  881. X    read XINC
  882. X    done
  883. Xfi
  884. X
  885. Xfi    
  886. Xecho
  887. Xecho
  888. X
  889. X##################################################
  890. X
  891. XXBITMAPS=
  892. X
  893. Xfor dir in ${OPENWINHOME}/lib/bitmaps \
  894. X       ${OPENWINHOME}/include/Xol \
  895. X       ${OPENWINHOME}/include/X11/bitmaps \
  896. X       /usr/openwin/lib/bitmaps \
  897. X       /usr/openwin/include/Xol/bitmaps \
  898. X       /usr/openwin/include/X11/bitmaps \
  899. X       /usr/lib/X11/bitmaps \
  900. X       /usr/local/lib/X11/bitmaps; do
  901. X    if [ -d $dir ]; then
  902. X        if [ ${XBITMAPS}x = x ]; then
  903. X            XBITMAPS=$dir
  904. X        else    
  905. X            XBITMAPS=${XBITMAPS}:$dir
  906. X        fi
  907. X    fi
  908. Xdone
  909. X
  910. Xif [ ${XBITMAPS}x = x ]; then
  911. X    echo "Oups! I did not find any bitmaps directory."
  912. X    XBITMAPS=no_directory_so_far
  913. X    while true; do
  914. X    if [ $XBITMAPS != no_directory_so_far ]; then
  915. X    if [ -d $XBITMAPS ]; then
  916. X        echo $XBITMAPS seems good!
  917. X        break
  918. X    elif [ -d ${XBITMAPS}/bitmaps ]; then
  919. X        echo $XBITMAPS seems good!
  920. X        break
  921. X    else
  922. X        echo $XBITMAPS is not good. Try again...
  923. X    fi
  924. X    fi
  925. X    echo
  926. X    echo -n "Where are your bitmaps (type skip if you don't have any)?: "
  927. X    read XBITMAPS
  928. X
  929. X    if [ ${XBITMAPS}x = skipx ]; then XBITMAPS=""; break; fi
  930. X
  931. X    done
  932. Xelse
  933. X    echo $XBITMAPS seems good!
  934. Xfi
  935. X
  936. X##################################################
  937. XUTILS=
  938. Xfor file in  utils/*.c; 
  939. Xdo
  940. X    echo 'main(){' >tcfg.c; 
  941. X    basename_noext=`echo $file | sed 's|.*/\(.*\)[.]c|\1|g'`;
  942. X    echo $basename_noext >>tcfg.c;
  943. X    echo '();}' >>tcfg.c;
  944. X    if cc tcfg.c >/dev/null 2>&1; then . ; 
  945. X    else UTILS="$UTILS $basename_noext"; cp $file .; fi;
  946. X    rm -f tcfg.c a.out;
  947. Xdone
  948. X        
  949. Xecho
  950. Xecho
  951. X
  952. X##################################################
  953. Xecho Generating the new Makefile...
  954. Xsed -e "s|<<XLIB>>|$XLIB|g" \
  955. X    -e "s|<<XINC>>|$XINC|g" \
  956. X    -e "s|<<XBITMAPS>>|$XBITMAPS|g" \
  957. X    -e "s|<<WIDGET_KIT>>|$WIDGET_KIT|g" \
  958. X    -e "s|<<UTILS>>|$UTILS|g" Makefile.in >Makefile
  959. Xecho done.
  960. Xexit 0
  961. END_OF_FILE
  962. if test 7589 -ne `wc -c <'bam-2.0/configure.sh'`; then
  963.     echo shar: \"'bam-2.0/configure.sh'\" unpacked with wrong size!
  964. fi
  965. # end of 'bam-2.0/configure.sh'
  966. fi
  967. echo shar: End of archive 5 \(of 7\).
  968. cp /dev/null ark5isdone
  969. MISSING=""
  970. for I in 1 2 3 4 5 6 7 ; do
  971.     if test ! -f ark${I}isdone ; then
  972.     MISSING="${MISSING} ${I}"
  973.     fi
  974. done
  975. if test "${MISSING}" = "" ; then
  976.     echo You have unpacked all 7 archives.
  977.     rm -f ark[1-9]isdone
  978. else
  979.     echo You still need to unpack the following archives:
  980.     echo "        " ${MISSING}
  981. fi
  982. ##  End of shell archive.
  983. exit 0
  984.  
  985. exit 0 # Just in case...
  986.