home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / misc / volume31 / bam / part05 < prev    next >
Encoding:
Text File  |  1992-07-30  |  27.0 KB  |  980 lines

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