home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / x / volume10 / wcl / part12 < prev    next >
Internet Message Format  |  1990-12-17  |  37KB

  1. Path: uunet!know!cs.utexas.edu!usc!julius.cs.uiuc.edu!apple!sun-barr!newstop!exodus!jpl-devvax.jpl.nasa.gov
  2. From: david@jpl-devvax.jpl.nasa.gov (David E. Smyth)
  3. Newsgroups: comp.sources.x
  4. Subject: v10i060: wcl -- Widget Creation Library, Part12/11
  5. Message-ID: <4655@exodus.Eng.Sun.COM>
  6. Date: 17 Dec 90 22:19:16 GMT
  7. References: <csx-10i049:wcl@uunet.UU.NET>
  8. Sender: news@exodus.Eng.Sun.COM
  9. Lines: 1126
  10. Approved: argv@sun.com
  11.  
  12. Submitted-by: david@jpl-devvax.jpl.nasa.gov (David E. Smyth)
  13. Posting-number: Volume 10, Issue 60
  14. Archive-name: wcl/part12
  15.  
  16. # to unbundle, "sh" this file -- DO NOT use csh
  17. #  SHAR archive format.  Archive created Fri Oct 19 09:33:36 PDT 1990
  18. echo x - WcReg.c
  19. sed 's/^X//' > WcReg.c <<'+FUNKY+STUFF+'
  20. X/*
  21. X** Copyright (c) 1990 David E. Smyth
  22. X**
  23. X** This file was derived from work performed by Martin Brunecky at
  24. X** Auto-trol Technology Corporation, Denver, Colorado, under the
  25. X** following copyright:
  26. X**
  27. X*******************************************************************************
  28. X* Copyright 1990 by Auto-trol Technology Corporation, Denver, Colorado.
  29. X*
  30. X*                        All Rights Reserved
  31. X*
  32. X* Permission to use, copy, modify, and distribute this software and its
  33. X* documentation for any purpose and without fee is hereby granted, provided
  34. X* that the above copyright notice appears on all copies and that both the
  35. X* copyright and this permission notice appear in supporting documentation
  36. X* and that the name of Auto-trol not be used in advertising or publicity
  37. X* pertaining to distribution of the software without specific, prior written
  38. X* permission.
  39. X*
  40. X* Auto-trol disclaims all warranties with regard to this software, including
  41. X* all implied warranties of merchantability and fitness, in no event shall
  42. X* Auto-trol be liable for any special, indirect or consequential damages or
  43. X* any damages whatsoever resulting from loss of use, data or profits, whether
  44. X* in an action of contract, negligence or other tortious action, arising out
  45. X* of or in connection with the use or performance of this software.
  46. X*******************************************************************************
  47. X**
  48. X** Redistribution and use in source and binary forms are permitted
  49. X** provided that the above copyright notice and this paragraph are
  50. X** duplicated in all such forms and that any documentation, advertising
  51. X** materials, and other materials related to such distribution and use
  52. X** acknowledge that the software was developed by David E. Smyth.  The
  53. X** name of David E. Smyth may not be used to endorse or promote products
  54. X** derived from this software without specific prior written permission.
  55. X** THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
  56. X** WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
  57. X** MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  58. X**
  59. X*/
  60. X
  61. X/*
  62. X* SCCS_data: @(#)WcReg.c 1.0 ( 19 June 1990 )
  63. X*
  64. X* Subsystem_group:
  65. X*
  66. X*     Widget Creation Library
  67. X*
  68. X* Module_description:
  69. X*
  70. X*     Since (for portability reasons) we can not assume runtime binding,
  71. X*     all widget classes, creation routines (constructors), and callbacks
  72. X*     must be "registered"  by the application BEFORE widget tree creation.
  73. X*
  74. X*     All four of the functions defined in this module load dynamically
  75. X*     allocated and extended arrays of structures.  The size increment
  76. X*     of the arrays starts at a reasonably small size (INCR_REGISTRY,
  77. X*     initially 32), and is doubled in size everytime a given registry is
  78. X*     filled.  This allows registries to be small, yet to not have to be
  79. X*     realloc'd frequently when they grow large.  
  80. X*
  81. X*     The registries are arrays of structs.  In all four cases, the
  82. X*     structs are very similar: they contain a name string which holds the
  83. X*     class, constructor, or callback name as it was registered; a quark
  84. X*     which is based on an all lower case representation of the name, and
  85. X*     class, constructor, or callback specific information.  The name
  86. X*     as registered should be as shown in reference documents and source
  87. X*     code, as it is used for user error messages.
  88. X*
  89. X*     The registries are intended to be used by string-to-whatever converters.
  90. X*
  91. X*     All four registration functions currently check for duplicate
  92. X*     entries, but do no fancy hashing scheme, nor any ties to the
  93. X*     application context.  Assumming a relatively small number of
  94. X*     entries in these regestries, it is assumed that a sequential
  95. X*     search using quarks will be adequate and simple.
  96. X
  97. X* Module_interface_summary: 
  98. X*
  99. X*       WcRegisterClassPtr(
  100. X*        XtAppContext  app,        - application context
  101. X*        String      name,        - class ptr name, as in ref manuals
  102. X*        WidgetClass   class )   - class record pointer
  103. X*
  104. X*       WcRegisterClassName(
  105. X*        XtAppContext  app,        - application context
  106. X*        String      name,        - class name, as in ref manuals
  107. X*        WidgetClass   class )   - class record pointer
  108. X*
  109. X*       WcRegisterConstructor(
  110. X*        XtAppContext  app,        - application context
  111. X*        String      name,        - constructor name, as in ref manuals
  112. X*        (*Widget)()   const )   - constructor function pointer
  113. X*
  114. X*    WcRegisterCallback(
  115. X*        XtAppContext  app,      - application context
  116. X*           String        name,     - callback name, "nice" capitalization
  117. X*        void (*func)() )        - pointer to callback function
  118. X*
  119. X*    WcRegisterAction(
  120. X*        XtAppContext  app,      - application context
  121. X*           String        name,     - action name
  122. X*        XtActionProc  proc )    - action proc
  123. X
  124. X*    WcAllowDuplicateRegistration   ( int allowed )
  125. X*    WcAllowDuplicateClassPtrReg    ( int allowed )
  126. X*    WcAllowDuplicateClassNameReg   ( int allowed )
  127. X*    WcAllowDuplicateConstructorReg ( int allowed )
  128. X*    WcAllowDuplicateCallbackReg    ( int allowed )
  129. X*
  130. X* Module_history:
  131. X
  132. X*   mm/dd/yy  initials  function  action
  133. X*   --------  --------  --------  ---------------------------------------------
  134. X*   16Jul90   D.Smyth   Added WcAllowDuplicate*()
  135. X*   19Jun90   D.Smyth   Version 1.0 Widget Creation Library
  136. X*   06/08/90  D.Smyth   All Added "name" member for better user msgs.
  137. X*   02/26/90  MarBru    All       Created
  138. X*   02/16/90  MarBru    Create..  Limited creation to composite widgets/objects
  139. X*
  140. X* Design_notes:
  141. X*
  142. X*   For VMS, we could have used LIB$FIND_IMAGE_SYMBOL and use dynamic
  143. X*   (runtime) binding. But since most UNIX systems lack such capability,
  144. X*   we stick to the concept of "registration" routines.
  145. X*
  146. X*******************************************************************************
  147. X*/
  148. X/*
  149. X*******************************************************************************
  150. X* Include_files.
  151. X*******************************************************************************
  152. X*/
  153. X
  154. X/*  -- Widget Creation Includes */
  155. X#include "WcCreate.h"
  156. X#include "WcCreateP.h"
  157. X
  158. X/*
  159. X*******************************************************************************
  160. X* Private_data_definitions.
  161. X*******************************************************************************
  162. X    The following cache/registry of known widget classes, contructors, 
  163. X    and callbacks are initially empty, and are loaded by the application 
  164. X    using "registration" routines.
  165. X*/
  166. X
  167. Xstatic char     msg[MAX_ERRMSG];
  168. X
  169. Xstatic int allowDuplicateClassPtrReg    = FALSE;
  170. Xstatic int allowDuplicateClassNameReg   = FALSE;
  171. Xstatic int allowDuplicateConstructorReg = FALSE;
  172. Xstatic int allowDuplicateCallbackReg    = FALSE;
  173. X
  174. X/*  -- Named class pointer cache, intially empty */
  175. X
  176. Xint         classes_num = 0;
  177. Xint         classes_max = 0;
  178. XClCacheRec *classes_ptr = NULL;
  179. X
  180. X/*  -- Class name cache, intially empty */
  181. X
  182. Xint             cl_nm_num = 0;
  183. Xint             cl_nm_max = 0;
  184. XClNameCacheRec* cl_nm_ptr = NULL;
  185. X
  186. X/*  -- Named object constructor cache, intially empty */
  187. X
  188. Xint          constrs_num = 0;
  189. Xint          constrs_max = 0;
  190. XConCacheRec *constrs_ptr = NULL;
  191. X
  192. X/*  -- Named callback procedures cache, intially empty */
  193. X
  194. Xint         callbacks_num = 0;
  195. Xint         callbacks_max = 0;
  196. XCBCacheRec *callbacks_ptr = NULL;
  197. X
  198. X/*
  199. X*******************************************************************************
  200. X* Private_function_declarations.
  201. X*******************************************************************************
  202. X*/
  203. X
  204. X/*
  205. X*******************************************************************************
  206. X* Public_function_declarations.
  207. X*******************************************************************************
  208. X*/
  209. X
  210. X/*
  211. X    -- Allow or Disallow Duplicate Registrations
  212. X*******************************************************************************
  213. X    By default, the Widget Creation Library does not allow a
  214. X    string-to-callback, string-to-class, etc bindings to be re-defined.
  215. X    Some applications, most noticably user interface builders, need to be
  216. X    able to change these bindings in order to provide additional
  217. X    flexibility.  Therefore the following functions are provided.  The
  218. X    typical user interface builder will make this single call:
  219. X
  220. X    WcAllowDuplicateRegistration( TRUE );
  221. X
  222. X    which allows class pointers, class names, constructors, and callbacks
  223. X    to be changed during execution.
  224. X*/
  225. X
  226. Xvoid WcAllowDuplicateRegistration( allowed )
  227. X    int allowed;
  228. X{
  229. X    allowDuplicateClassPtrReg = allowed;
  230. X    allowDuplicateClassNameReg = allowed;
  231. X    allowDuplicateConstructorReg = allowed;
  232. X    allowDuplicateCallbackReg = allowed;
  233. X}
  234. Xvoid WcAllowDuplicateClassPtrReg( allowed )
  235. X    int allowed;
  236. X{
  237. X    allowDuplicateClassPtrReg = allowed;
  238. X}
  239. Xvoid WcAllowDuplicateClassNameReg( allowed )
  240. X    int allowed;
  241. X{
  242. X    allowDuplicateClassNameReg = allowed;
  243. X}
  244. Xvoid WcAllowDuplicateConstructorReg( allowed )
  245. X    int allowed;
  246. X{
  247. X    allowDuplicateConstructorReg = allowed;
  248. X}
  249. Xvoid WcAllowDuplicateCallbackReg( allowed )
  250. X    int allowed;
  251. X{
  252. X    allowDuplicateCallbackReg = allowed;
  253. X}
  254. X
  255. X/*
  256. X    -- Register Class Pointer Name
  257. X*******************************************************************************
  258. X    This procedure adds class pointer name to our list of registered
  259. X    classes. Note that the class ptr name is effectively case insensitive
  260. X    as it is being quarkified.  However, one should register the class ptr
  261. X    names using the "standard" capitalization (whatever is in the reference
  262. X    manual for the widget set) as the name as registered is used for error
  263. X    messages.
  264. X
  265. X   The registry is primarily used by CvtStringToClassPtr().
  266. X*/
  267. X
  268. Xvoid WcRegisterClassPtr ( app, name, class )
  269. X    XtAppContext        app;    /* not used (yet), must be present      */
  270. X    char*               name;   /* class ptr name, case insensitive     */
  271. X    WidgetClass         class;  /* Xt object class pointer              */
  272. X{
  273. X    char          *lowerCaseName;
  274. X    XrmQuark       quark;
  275. X    ClCacheRec    *rec;
  276. X    int            i;
  277. X
  278. X    /* Might need to grow cache.  Note that growth increment is exponential:
  279. X    ** if lots of classes, don't need to keep realloc'ing so often.
  280. X    */
  281. X    if (classes_num >= classes_max )
  282. X    {
  283. X        classes_max += (classes_max ? classes_max : INCR_REGISTRY);
  284. X        classes_ptr  = (ClCacheRec*) XtRealloc((char*)classes_ptr,
  285. X                             sizeof(ClCacheRec) * classes_max);
  286. X    }
  287. X
  288. X    /* See if this object has been registered.  Compare quarks.
  289. X    */
  290. X    lowerCaseName = WcLowerCaseCopy( name );
  291. X    quark = XrmStringToQuark ( lowerCaseName );
  292. X    XtFree ( lowerCaseName );
  293. X
  294. X    for (i = 0 ; i < classes_num ; i++ )
  295. X    {
  296. X        if (classes_ptr[i].quark == quark)
  297. X        {
  298. X            /* already registered this class */
  299. X        if ( allowDuplicateClassPtrReg )
  300. X        {
  301. X        rec = &classes_ptr[i];        /* overwrite this ClCacheRec */
  302. X        goto found_rec;
  303. X        }
  304. X            sprintf(msg,
  305. X            "WcRegisterClassPtr (%s) - Failed \n\
  306. X             Problem: Duplicate class registration ignored.",
  307. X             name );
  308. X            XtWarning( msg );
  309. X            return;
  310. X        }
  311. X    }
  312. X
  313. X    rec = &classes_ptr[classes_num++];          /* New ClCacheRec to be filled */
  314. X
  315. Xfound_rec:
  316. X    rec->quark = quark;
  317. X    rec->class = class;
  318. X    rec->name  = XtMalloc( strlen(name) + 1 );
  319. X    strcpy ( rec->name, name );
  320. X}
  321. X
  322. X/*
  323. X    -- Register Class Name
  324. X*******************************************************************************
  325. X    This procedure adds a class name to our list of registered
  326. X    classes. Note that the class name is effectively case insensitive
  327. X    as it is being quarkified.  However, one should register the class
  328. X    names using the "standard" capitalization (whatever is in the reference
  329. X    manual for the widget set) as the name as registered is used for error
  330. X    messages.
  331. X
  332. X   The registry is primarily used by CvtStringToClassName().
  333. X*/
  334. X
  335. Xvoid WcRegisterClassName ( app, name, class )
  336. X    XtAppContext    app;    /* not used (yet), must be present      */
  337. X    char*        name;    /* class name, case insensitive       */
  338. X    WidgetClass        class;    /* Xt object class pointer              */
  339. X{
  340. X    char           *lowerCaseName;
  341. X    XrmQuark        quark;
  342. X    ClNameCacheRec *rec;
  343. X    int            i;
  344. X
  345. X    /* Might need to grow cache.  Note that growth increment is exponential:
  346. X    ** if lots of classes, don't need to keep realloc'ing so often.
  347. X    */
  348. X    if (cl_nm_num >= cl_nm_max )
  349. X    {
  350. X    cl_nm_max += (cl_nm_max ? cl_nm_max : INCR_REGISTRY);
  351. X    cl_nm_ptr  = (ClNameCacheRec*) XtRealloc((char*)cl_nm_ptr, 
  352. X                             sizeof(ClNameCacheRec) * cl_nm_max);
  353. X    }
  354. X
  355. X    /* See if this object has been registered.  Compare quarks.
  356. X    */
  357. X    lowerCaseName = WcLowerCaseCopy( name );
  358. X    quark = XrmStringToQuark ( lowerCaseName );
  359. X    XtFree ( lowerCaseName );
  360. X
  361. X    for (i = 0 ; i < cl_nm_num ; i++ )
  362. X    {
  363. X    if (cl_nm_ptr[i].quark == quark)
  364. X    {
  365. X        /* already registered this class */
  366. X        if ( allowDuplicateClassNameReg )
  367. X        {
  368. X        rec = &cl_nm_ptr[i];    /* overwrite this ClNameCacheRec */
  369. X        goto found_rec;
  370. X        }
  371. X        sprintf(msg, 
  372. X            "WcRegisterClassName (%s) - Failed \n\
  373. X             Problem: Duplicate class registration ignored.",
  374. X             name );
  375. X            XtWarning( msg );
  376. X        return;
  377. X    }
  378. X    }
  379. X
  380. X    rec = &cl_nm_ptr[cl_nm_num++];    /* New ClNameCacheRec to be filled */
  381. X
  382. Xfound_rec:
  383. X    rec->quark = quark;
  384. X    rec->class = class;
  385. X    rec->name  = XtMalloc( strlen(name) + 1 );
  386. X    strcpy ( rec->name, name );
  387. X}
  388. X
  389. X/*
  390. X    -- Register constructor
  391. X*******************************************************************************
  392. X    This procedure adds constructor procedure/name to our list of registered
  393. X    constructors. Note that the name is effectively case insensitive
  394. X    as it is being quarkified.  However, one should register the 
  395. X    names using the "standard" capitalization (whatever is in the reference
  396. X    manual for the widget set) as the name as registered is used for error
  397. X    messages.
  398. X
  399. X    Note the constructor is a "Motif Style" widget creation routine,
  400. X    commonly called a "confusion function."  
  401. X
  402. X   The registry is primarily used by CvtStringToConstructor().
  403. X*/
  404. X
  405. Xvoid WcRegisterConstructor ( app, name, constructor )
  406. X    XtAppContext app;            /* not used (yet), must be present      */
  407. X    char*        name;            /* constructor name, case insensitive   */
  408. X    Widget (*constructor) ();   /* pointer to a widget creation routine */
  409. X{
  410. X    char          *lowerCaseName;
  411. X    XrmQuark       quark;
  412. X    ConCacheRec   *rec;
  413. X    int           i;
  414. X
  415. X    /* Might need to grow cache.  Note that growth increment is exponential:
  416. X    ** if lots of constructors, don't need to keep realloc'ing so often.
  417. X    */
  418. X    if (constrs_num >= constrs_max )
  419. X    {
  420. X        constrs_max += (constrs_max ? constrs_max : INCR_REGISTRY);
  421. X        constrs_ptr  = (ConCacheRec*) XtRealloc((char*)constrs_ptr,
  422. X                             sizeof(ConCacheRec) * constrs_max);
  423. X    }
  424. X
  425. X    /* See if this object has been registered.  Compare quarks.
  426. X    */
  427. X    lowerCaseName = WcLowerCaseCopy( name );
  428. X    quark = XrmStringToQuark ( lowerCaseName );
  429. X    XtFree ( lowerCaseName );
  430. X
  431. X    for (i = 0 ; i < constrs_num ; i++ )
  432. X    {
  433. X        if (constrs_ptr[i].quark == quark)
  434. X        {
  435. X            /* already registered this class */
  436. X        if ( allowDuplicateConstructorReg )
  437. X        {
  438. X        rec = &constrs_ptr[i];        /* overwrite this ConCacheRec */
  439. X        goto found_rec;
  440. X        }
  441. X            sprintf(msg,
  442. X            "WcRegisterConstructor (%s) - Failed \n\
  443. X             Problem: Duplicate constructor registration ignored.",
  444. X             name );
  445. X            XtWarning( msg );
  446. X            return;
  447. X        }
  448. X    }
  449. X
  450. X    rec = &constrs_ptr[constrs_num++];        /* New ClCacheRec to be filled */
  451. X
  452. Xfound_rec:
  453. X    rec->quark       = quark;
  454. X    rec->constructor = constructor;
  455. X    rec->name        = XtMalloc( strlen(name) + 1 );
  456. X    strcpy ( rec->name, name );
  457. X}
  458. X
  459. X/*
  460. X  -- Register Callbacks
  461. X*******************************************************************************
  462. X    Register callback functions which can then be bound to widget
  463. X    callback lists by the string-to-callback converter 
  464. X    CvtStringToCallback().
  465. X*/
  466. X
  467. Xvoid WcRegisterCallback ( app, name, callback, closure )
  468. X    XtAppContext    app;        /* not used (yet), must be present      */
  469. X    String          name;       /* callback name, case insensitive      */
  470. X    XtCallbackProc  callback;   /* callback function pointer            */
  471. X    caddr_t        closure;    /* default client data            */
  472. X{
  473. X    char          *lowerCaseName;
  474. X    XrmQuark       quark;
  475. X    CBCacheRec    *rec;
  476. X    int           i;
  477. X
  478. X    /* Might need to grow cache.  Note that growth increment is exponential:
  479. X    ** if lots of constructors, don't need to keep realloc'ing so often.
  480. X    */
  481. X    if (callbacks_num >= callbacks_max )
  482. X    {
  483. X        callbacks_max += (callbacks_max ? callbacks_max : INCR_REGISTRY);
  484. X        callbacks_ptr  = (CBCacheRec*) XtRealloc((char*)callbacks_ptr,
  485. X                             sizeof(CBCacheRec) * callbacks_max);
  486. X    }
  487. X
  488. X    /* See if this callback has been registered.  Compare quarks.
  489. X    */
  490. X    lowerCaseName = WcLowerCaseCopy( name );
  491. X    quark = XrmStringToQuark ( lowerCaseName );
  492. X    XtFree ( lowerCaseName );
  493. X
  494. X    for (i = 0 ; i < callbacks_num ; i++ )
  495. X    {
  496. X        if (callbacks_ptr[i].quark == quark)
  497. X        {
  498. X            /* already registered this callback */
  499. X        if ( allowDuplicateCallbackReg )
  500. X        {
  501. X        rec = &callbacks_ptr[i];    /* overwrite this CBCacheRec */
  502. X        goto found_rec;
  503. X        }
  504. X            sprintf(msg,
  505. X            "WcRegisterCallback (%s) - Failed \n\
  506. X             Problem: Duplicate callback registration ignored.",
  507. X             name );
  508. X            XtWarning( msg );
  509. X            return;
  510. X        }
  511. X    }
  512. X
  513. X    rec = &callbacks_ptr[callbacks_num++];   /* New ClCacheRec to be filled */
  514. X
  515. Xfound_rec:
  516. X    rec->quark    = quark;
  517. X    rec->callback = callback;
  518. X    rec->closure  = closure;
  519. X    rec->name     = XtMalloc( strlen(name) + 1 );
  520. X    strcpy ( rec->name, name );
  521. X}
  522. X
  523. X/*
  524. X  -- Register Actions
  525. X*******************************************************************************
  526. X    A simple wrapper around XtAppAddActions().
  527. X    Register action procs which can then be bound to widget
  528. X    actions using standard Xt mechanisms.
  529. X*/
  530. X
  531. Xvoid WcRegisterAction(app, name, proc)
  532. X    XtAppContext app;
  533. X    String       name;
  534. X    XtActionProc proc;
  535. X{
  536. X    static XtActionsRec action_rec[] = {
  537. X        { (String)NULL, (XtActionProc)NULL }
  538. X    };
  539. X
  540. X    action_rec[0].string = name;
  541. X    action_rec[0].proc = proc;
  542. X    XtAppAddActions(app, action_rec, 1);
  543. X}
  544. +FUNKY+STUFF+
  545. echo '-rw-r--r--  1 david       18444 Oct  8 08:32 WcReg.c    (as sent)'
  546. chmod u=rw,g=r,o=r WcReg.c
  547. ls -l WcReg.c
  548. echo x - WcRegXt.c
  549. sed 's/^X//' > WcRegXt.c <<'+FUNKY+STUFF+'
  550. X/*
  551. X** Copyright (c) 1990 David E. Smyth
  552. X**
  553. X** Redistribution and use in source and binary forms are permitted
  554. X** provided that the above copyright notice and this paragraph are
  555. X** duplicated in all such forms and that any documentation, advertising
  556. X** materials, and other materials related to such distribution and use
  557. X** acknowledge that the software was developed by David E. Smyth.  The
  558. X** name of David E. Smyth may not be used to endorse or promote products
  559. X** derived from this software without specific prior written permission.
  560. X** THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
  561. X** WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
  562. X** MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  563. X**
  564. X*/
  565. X
  566. X/*
  567. X* SCCS_data: @(#)WcRegXt.c 1.03 ( 23 July 1990 )
  568. X*
  569. X* Subsystem_group:
  570. X*
  571. X*     Widget Creation Library - Intrinsic Resource Interpreter
  572. X*
  573. X* Module_description:
  574. X*
  575. X*     This module contains registration routine for all Intrinsic
  576. X*     widget constructors and classes.  
  577. X*
  578. X* Module_interface_summary: 
  579. X*
  580. X*     void WcRegisterIntrinsic ( XtAppContext app )
  581. X*
  582. X* Module_history:
  583. X*                                                  
  584. X*   mm/dd/yy  initials  function  action
  585. X*   --------  --------  --------  ---------------------------------------------
  586. X*   07/23/90  D.Smyth   cleaned up function return values.
  587. X*   06/19/90  R.Whitby  all      create.
  588. X*
  589. X* Design_notes:
  590. X*
  591. X*******************************************************************************
  592. X*/
  593. X/*
  594. X*******************************************************************************
  595. X* Include_files.
  596. X*******************************************************************************
  597. X*/
  598. X
  599. X#include <X11/Intrinsic.h>
  600. X
  601. X#include <X11/Object.h>
  602. X#include <X11/RectObj.h>
  603. X#include <X11/Shell.h>
  604. X#include <X11/Vendor.h>
  605. X
  606. X/* -- Widget constructor routines */
  607. X
  608. XWidget WcCreateApplicationShell    ();
  609. XWidget WcCreateOverrideShell    ();
  610. XWidget WcCreateShell        ();
  611. XWidget WcCreateTopLevelShell    ();
  612. XWidget WcCreateTransientShell    ();
  613. XWidget WcCreateVendorShell    ();
  614. XWidget WcCreateWMShell        ();
  615. X
  616. X
  617. Xvoid WcRegisterIntrinsic ( app )
  618. X    XtAppContext app;
  619. X{
  620. X    static int alreadyRegisteredXt = 0;
  621. X
  622. X    if ( alreadyRegisteredXt++ )
  623. X    return;
  624. X
  625. X#define RCN( name, class ) WcRegisterClassName ( app, name, class );
  626. X#define RCP( name, class ) WcRegisterClassPtr  ( app, name, class );
  627. X#define RCR( name, func )  WcRegisterConstructor(app, name, func  );
  628. X
  629. X    /* -- register all Intrinsic widget classes */
  630. X
  631. X    RCN("Object",            objectClass );
  632. X    RCP("objectClass",            objectClass );
  633. X    RCN("RectObj",            rectObjClass );
  634. X    RCP("rectObjClass",            rectObjClass );
  635. X#if defined(MOTIF) && MOTIF > 1 || MOTIF_MINOR > 0
  636. X    RCN("Core",                coreWidgetClass );
  637. X    RCP("coreWidgetClass",        coreWidgetClass );
  638. X#endif
  639. X    RCN("Composite",            compositeWidgetClass );
  640. X    RCP("compositeWidgetClass",        compositeWidgetClass );
  641. X    RCN("Constraint",            constraintWidgetClass );
  642. X    RCP("constraintWidgetClass",    constraintWidgetClass );
  643. X    RCN("ApplicationShell",        applicationShellWidgetClass );
  644. X    RCP("applicationShellWidgetClass",    applicationShellWidgetClass );
  645. X    RCN("OverrideShell",        overrideShellWidgetClass );
  646. X    RCP("overrideShellWidgetClass",    overrideShellWidgetClass );
  647. X    RCN("Shell",            shellWidgetClass );
  648. X    RCP("shellWidgetClass",        shellWidgetClass );
  649. X    RCN("TopLevelShell",        topLevelShellWidgetClass );
  650. X    RCP("topLevelShellWidgetClass",    topLevelShellWidgetClass );
  651. X    RCN("TransientShell",        transientShellWidgetClass );
  652. X    RCP("transientShellWidgetClass",    transientShellWidgetClass );
  653. X    RCN("VendorShell",            vendorShellWidgetClass );
  654. X    RCP("vendorShellWidgetClass",    vendorShellWidgetClass );
  655. X    RCN("WmShell",            wmShellWidgetClass );
  656. X    RCP("wmShellWidgetClass",        wmShellWidgetClass );
  657. X
  658. X    /* -- register all Intrinsic constructors */
  659. X
  660. X    RCR("XtCreateApplicationShell",    WcCreateApplicationShell);
  661. X    RCR("XtCreateOverrideShell",    WcCreateOverrideShell);
  662. X    RCR("XtCreateShell",        WcCreateShell);
  663. X    RCR("XtCreateTopLevelShell",    WcCreateTopLevelShell);
  664. X    RCR("XtCreateTransientShell",    WcCreateTransientShell);
  665. X    RCR("XtCreateWMShell",        WcCreateWMShell);
  666. X    RCR("XtCreateVendorShell",        WcCreateVendorShell);
  667. X
  668. X#undef RCN
  669. X#undef RCP
  670. X#undef RCR
  671. X}
  672. X
  673. X/*
  674. X    -- Create Application Shell
  675. X*******************************************************************************
  676. X    This function creates an application shell widget.
  677. X    
  678. X*/
  679. XWidget WcCreateApplicationShell ( pw, name, args, nargs )
  680. X    Widget    pw;    /* children's parent                 */
  681. X    String      name;    /* widget name to create             */
  682. X    Arg        *args;    /* args for widget                */
  683. X    Cardinal    nargs;    /* args count                    */
  684. X{
  685. X
  686. X  return XtCreatePopupShell(name, applicationShellWidgetClass, pw, args, nargs);
  687. X}
  688. X
  689. X/*
  690. X    -- Create Override Shell
  691. X*******************************************************************************
  692. X    This function creates an override shell widget.
  693. X    
  694. X*/
  695. XWidget WcCreateOverrideShell ( pw, name, args, nargs )
  696. X    Widget    pw;    /* children's parent                 */
  697. X    String      name;    /* widget name to create             */
  698. X    Arg        *args;    /* args for widget                */
  699. X    Cardinal    nargs;    /* args count                    */
  700. X{
  701. X  return XtCreatePopupShell(name, overrideShellWidgetClass, pw, args, nargs);
  702. X}
  703. X
  704. X/*
  705. X    -- Create Shell
  706. X*******************************************************************************
  707. X    This function creates a shell widget.
  708. X    
  709. X*/
  710. XWidget WcCreateShell ( pw, name, args, nargs )
  711. X    Widget    pw;    /* children's parent                 */
  712. X    String      name;    /* widget name to create             */
  713. X    Arg        *args;    /* args for widget                */
  714. X    Cardinal    nargs;    /* args count                    */
  715. X{
  716. X  return XtCreatePopupShell(name, shellWidgetClass, pw, args, nargs);
  717. X}
  718. X
  719. X/*
  720. X    -- Create TopLevel Shell
  721. X*******************************************************************************
  722. X    This function creates a top level shell widget.
  723. X    
  724. X*/
  725. XWidget WcCreateTopLevelShell ( pw, name, args, nargs )
  726. X    Widget    pw;    /* children's parent                 */
  727. X    String      name;    /* widget name to create             */
  728. X    Arg        *args;    /* args for widget                */
  729. X    Cardinal    nargs;    /* args count                    */
  730. X{
  731. X  return XtCreatePopupShell(name, topLevelShellWidgetClass, pw, args, nargs);
  732. X}
  733. X
  734. X/*
  735. X    -- Create Transient Shell
  736. X*******************************************************************************
  737. X    This function creates an transient shell widget.
  738. X    
  739. X*/
  740. XWidget WcCreateTransientShell ( pw, name, args, nargs )
  741. X    Widget    pw;    /* children's parent                 */
  742. X    String      name;    /* widget name to create             */
  743. X    Arg        *args;    /* args for widget                */
  744. X    Cardinal    nargs;    /* args count                    */
  745. X{
  746. X  return XtCreatePopupShell(name, transientShellWidgetClass, pw, args, nargs);
  747. X}
  748. X
  749. X/*
  750. X    -- Create Vendor Shell
  751. X*******************************************************************************
  752. X    This function creates a vendor shell widget.
  753. X    
  754. X*/
  755. XWidget WcCreateVendorShell ( pw, name, args, nargs )
  756. X    Widget    pw;    /* children's parent                 */
  757. X    String      name;    /* widget name to create             */
  758. X    Arg        *args;    /* args for widget                */
  759. X    Cardinal    nargs;    /* args count                    */
  760. X{
  761. X  return XtCreatePopupShell(name, vendorShellWidgetClass, pw, args, nargs);
  762. X}
  763. X
  764. X/*
  765. X    -- Create WM Shell
  766. X*******************************************************************************
  767. X    This function creates an WM shell widget.
  768. X    
  769. X*/
  770. XWidget WcCreateWMShell ( pw, name, args, nargs )
  771. X    Widget    pw;    /* children's parent                 */
  772. X    String      name;    /* widget name to create             */
  773. X    Arg        *args;    /* args for widget                */
  774. X    Cardinal    nargs;    /* args count                    */
  775. X{
  776. X  return XtCreatePopupShell(name, wmShellWidgetClass, pw, args, nargs);
  777. X}
  778. +FUNKY+STUFF+
  779. echo '-rw-r--r--  1 david        7651 Oct 12 10:27 WcRegXt.c    (as sent)'
  780. chmod u=rw,g=r,o=r WcRegXt.c
  781. ls -l WcRegXt.c
  782. echo x - makefile
  783. sed 's/^X//' > makefile <<'+FUNKY+STUFF+'
  784. X# Assumes that your Imake site.cf defines -DHAVE_MOTIF if you have motif.
  785. X# Otherwise, you will have to add a line which says:
  786. X#    #define HAVE_MOTIF
  787. X#
  788. X# Note how Motif version numbers are defined: Motif 1.1 or Motif 1.1.1
  789. X# is defined:
  790. X#    MOTIF_VER = -DMOTIF=1 -DMOTIF_MINOR=1
  791. X# and when Motif 2.7 comes out, MOTIF_VER gets define as:
  792. X#    MOTIF_VER = -DMOTIF=2 -DMOTIF_MINOR=7
  793. X#
  794. X# If your C compiler does not know how to use prototypes, you may
  795. X# need to add -D_NO_PROTO to the MOTIF_VER macros.  This may be
  796. X# needed because many sites do not put Motif specific defines
  797. X# in their site.cf files used by Imake.
  798. X#
  799. X# Some Table.c and Table_m.c both include Xmu.h.  If you are using
  800. X# Motif 1.0 and you have installed the X11R4 Xmu libraries, then
  801. X# you musr provide the XT_VER macro as shown.  In all other cases,
  802. X# I think that the XT_VER macro is not needed.
  803. X#
  804. X# Also, if you have Motif installed in a non-standard place, set MOTIFDIR to
  805. X# point to it.  The value of MOTIFDIR gets pre-pended to /include and /lib.
  806. X#
  807. X# Motif 1.0 required a special Xt Intrinsics, commonly named libXtm.  If
  808. X# you are building for 1.0, MOTIFLIB should be -lXtm
  809. X
  810. X#
  811. X# typical for Motif 1.0
  812. X#
  813. X      MOTIF_VER = -DMOTIF=1 -DMOTIF_MINOR=0 
  814. X         XT_VER = -DXtSpecificationRelease=4
  815. X       MOTIFDIR = /usr
  816. X        MOTIFXT = -lXtm
  817. X     MOTIFXTLIB = $(MOTIFDIR)/lib/libXtm.a
  818. X
  819. X#
  820. X# typical for Motif 1.1:
  821. X#
  822. X#     MOTIF_VER = -DMOTIF=1 -DMOTIF_MINOR=1 -D_NO_PROTO
  823. X#      MOTIFDIR = /usr
  824. X#       MOTIFXT = -lXt
  825. X#    MOTIFXTLIB = $(MOTIFDIR)/lib/libXt.a
  826. X
  827. X#
  828. X# C compiler and ld definitions - pick and choose, but you CANNOT use
  829. X# prototypes with Motif 1.1!!!  But you can with Motif 1.0.
  830. X#
  831. X  CDEBUGFLAGS = -O
  832. X# CDEBUGFLAGS = -O4
  833. X# CDEBUGFLAGS = -g -DDEBUG
  834. X# CDEBUGFLAGS = -g -Bstatic -DDEBUG
  835. X#
  836. X           CC = cc
  837. X#          CC = gcc -DNOSTDHDRS -fstrength-reduce -fpcc-struct-return -fwritable-strings -traditional
  838. X#          CC = gcc -DFUNCTION_PROTOTYPES -ansi
  839. X
  840. X#
  841. X# Imake related stuff.  
  842. X# You might need to change the MACROFILE, and -DHAVE_MOTIF.
  843. X#
  844. X
  845. X    MACROFILE = sun.cf
  846. X     IRULESRC = /usr/lib/X11/config
  847. X        IMAKE = imake
  848. X    IMAKE_CMD = $(IMAKE) -DUseInstalled -I$(IRULESRC) -DHAVE_MOTIF
  849. X ICONFIGFILES = $(IRULESRC)/Imake.tmpl   $(IRULESRC)/Imake.rules \
  850. X                $(IRULESRC)/Project.tmpl $(IRULESRC)/site.def \
  851. X                $(IRULESRC)/$(MACROFILE)
  852. X#
  853. X# These defines probably never have to change.  What may change
  854. X# is the inclusion of -lXext in the XLIB define, and the place
  855. X# to look for include files (the `-I/usr/include' in CFLAGS).
  856. X#
  857. X         CFLAGS = $(CDEBUGFLAGS) -I. -I/usr/include
  858. X        SYSLIBS = -lm
  859. X  INSTALLLIBDIR = /usr/lib
  860. X  INSTALLINCDIR = /usr/include/Wc
  861. X         XAWLIB = -lXaw
  862. X         XMULIB = -lXmu
  863. X       XTOOLLIB = -lXt
  864. X           XLIB = -lXext -lX11
  865. X#
  866. X# These are aliases for various system commands used by this makefile
  867. X#
  868. X     AR = ar cq
  869. XINSTALL = install
  870. X   MAKE = make
  871. X     MV = mv
  872. X RANLIB = ranlib
  873. X     RM = rm -f
  874. X#
  875. X# Permission flags used at installation time
  876. X#
  877. X     INSTLIBFLAGS = -m 0664
  878. X     INSTINCFLAGS = -m 0444
  879. X     INSTINCFLAGS = -m 0444
  880. X
  881. X          WCLIB = -L. -lWc
  882. X       DEPWCLIB = ./libWc.a
  883. X
  884. X         WCMLIB = -L. -lWcm
  885. X      DEPWCMLIB = ./libWcm.a
  886. X
  887. Xall:: libWc.a Ari App MDathena libWcm.a Mri MDmotif
  888. X
  889. X#
  890. X# Rules for Ari
  891. X#
  892. X
  893. X       ARI_LIBS = $(WCLIB) $(XAWLIB) $(XMULIB) $(XTOOLLIB) $(XLIB)
  894. X       ARI_OBJS = Ari.o AriRegAll.o Table.o
  895. X
  896. XAri:  $(ARI_OBJS)  $(DEPWCLIB)
  897. X    $(RM) $@
  898. X    $(CC) -o $@ $(CDEBUGFLAGS) $(ARI_OBJS) $(ARI_LIBS) $(SYSLIBS)
  899. X
  900. Xclean::
  901. X    $(RM) Ari
  902. X#
  903. X# Rules for App
  904. X#
  905. X
  906. X     APP_OBJS = App.o AriRegAll.o
  907. X
  908. XApp:  $(APP_OBJS)  $(DEPWCLIB)
  909. X    $(RM) $@
  910. X    $(CC) -o $@ $(CDEBUGFLAGS) $(APP_OBJS) $(ARI_LIBS) $(SYSLIBS) 
  911. X
  912. Xclean::
  913. X    $(RM) App
  914. X
  915. X#
  916. X# Rules for MDathena
  917. X#
  918. X
  919. X     MDA_OBJS = MDathena.o AriRegAll.o Table.o
  920. X
  921. XMDathena.o: MD.c
  922. X    $(RM) $@
  923. X    $(CC) -c $(CFLAGS) MD.c -o MDathena.o
  924. X
  925. XMDathena:  $(MDA_OBJS)  $(DEPWCLIB)
  926. X    $(RM) $@
  927. X    $(CC) -o $@ $(CDEBUGFLAGS) $(MDA_OBJS) $(ARI_LIBS) $(SYSLIBS)
  928. X
  929. Xclean::
  930. X    $(RM) MDathena
  931. X
  932. X#
  933. X# Rules for libWc.a
  934. X#
  935. X
  936. X     LIBWC_INCS = WcCreate.h WcCreateP.h
  937. X     LIBWC_OBJS = WcCreate.o WcCallb.o WcConvert.o WcName.o \
  938. X          WcReg.o WcActions.o WcRegXt.o
  939. X
  940. X.c.o:
  941. X    $(RM) $@
  942. X    $(CC) -c $(CFLAGS) $*.c
  943. X
  944. XlibWc.a:  $(LIBWC_OBJS)
  945. X    $(RM) $@
  946. X    $(AR) $@  $(LIBWC_OBJS)
  947. X    $(RANLIB) $@
  948. X
  949. Xinstall:: libWc.a
  950. X    $(INSTALL) -c $(INSTLIBFLAGS) libWc.a  $(INSTALLLIBDIR)
  951. X    $(RANLIB) $(INSTALLLIBDIR)/libWc.a
  952. X
  953. Xinstall:: $(LIBWC_INCS)
  954. X    @case '${MFLAGS}' in *[i]*) set +e;; esac; \
  955. X    for i in $(LIBWC_INCS); do \
  956. X    (set -x; $(INSTALL) -c $(INSTINCFLAGS) $$i  $(INSTALLINCDIR)); \
  957. X    done
  958. X
  959. Xclean::
  960. X    $(RM) libWc.a
  961. X
  962. X###############################################################################
  963. X# Rules to build Motif clients and Wcl on Motif's Xt
  964. X###############################################################################
  965. X# Note that Motif doesn't provide Xmu, so pick it up from R4
  966. X#
  967. X# Rules for Mri
  968. X#
  969. X
  970. X       MRI_LIBS = $(WCMLIB) $(MOTIFLIB) 
  971. X    MRI_DEPLIBS = $(DEPWCMLIB) $(DEPMOTIFLIB) 
  972. X
  973. X       MOTIFLIB = -L$(MOTIFDIR)/lib -lXm $(MOTIFXT) $(XLIB)
  974. X    DEPMOTIFLIB = $(MOTIFDIR)/lib/libXm.a $(MOTIFXTLIB)
  975. X
  976. X       MRI_OBJS = Mri.o MriRegAll.o Table_m.o
  977. X   MRI_INCLUDES = -I$(MOTIFDIR)/include/Xm -I$(MOTIFDIR)/include
  978. X
  979. X    MRI_DEFINES = $(MOTIF_VER) $(MRI_INCLUDES)
  980. X
  981. XTable_m.o: Table_m.c
  982. X    $(RM) $@
  983. X    $(CC) -c $(XT_VER) $(MRI_DEFINES) $(CFLAGS) $*.c
  984. XMri.o: Mri.c
  985. X    $(RM) $@
  986. X    $(CC) -c $(MRI_DEFINES) $(CFLAGS) $*.c
  987. XMriRegAll.o: MriRegAll.c
  988. X    $(RM) $@
  989. X    $(CC) -c $(MRI_DEFINES) $(CFLAGS) $*.c
  990. X
  991. XMri:  $(MRI_OBJS)  $(MRI_DEPLIBS)
  992. X    $(RM) $@
  993. X    $(CC) -o $@ $(CDEBUGFLAGS) $(MRI_OBJS) $(MRI_LIBS) $(SYSLIBS)
  994. X
  995. Xclean::
  996. X    $(RM) Mri
  997. X
  998. X
  999. X#
  1000. X# Rules for MDmotif
  1001. X#
  1002. X
  1003. XMDM_OBJS = MDmotif.o MriRegAll.o Table_m.o
  1004. X
  1005. XMDmotif.o: MD.c
  1006. X    $(RM) $@
  1007. X    $(CC) -c $(MRI_DEFINES) $(CFLAGS) MD.c -o MDmotif.o
  1008. X
  1009. XMDmotif:  $(MDM_OBJS)  $(MRI_DEPLIBS)
  1010. X    $(RM) $@
  1011. X    $(CC) -o $@ $(CDEBUGFLAGS) $(MDM_OBJS) $(MRI_LIBS) $(SYSLIBS)
  1012. X
  1013. Xclean::
  1014. X    $(RM) MDmotif
  1015. X
  1016. X#
  1017. X# Rules for libWcm.a
  1018. X#
  1019. X
  1020. X    LIBWCM_OBJS = WcmCreate.o WcmCallb.o WcmConvert.o \
  1021. X          WcmName.o WcmReg.o WcmActions.o WcmRegXt.o
  1022. X
  1023. XWcmCreate.o: WcCreate.c
  1024. X    $(RM) $@
  1025. X    $(CC) -c $(MRI_DEFINES) $(CFLAGS) WcCreate.c  -o WcmCreate.o
  1026. XWcmCallb.o: WcCallb.c
  1027. X    $(RM) $@
  1028. X    $(CC) -c $(MRI_DEFINES) $(CFLAGS) WcCallb.c   -o WcmCallb.o
  1029. XWcmConvert.o: WcConvert.c
  1030. X    $(RM) $@
  1031. X    $(CC) -c $(MRI_DEFINES) $(CFLAGS) WcConvert.c -o WcmConvert.o
  1032. XWcmName.o: WcName.c
  1033. X    $(RM) $@
  1034. X    $(CC) -c $(MRI_DEFINES) $(CFLAGS) WcName.c    -o WcmName.o
  1035. XWcmReg.o: WcReg.c
  1036. X    $(RM) $@
  1037. X    $(CC) -c $(MRI_DEFINES) $(CFLAGS) WcReg.c     -o WcmReg.o
  1038. XWcmActions.o: WcActions.c
  1039. X    $(RM) $@
  1040. X    $(CC) -c $(MRI_DEFINES) $(CFLAGS) WcActions.c -o WcmActions.o
  1041. XWcmRegXt.o: WcRegXt.c
  1042. X    $(RM) $@
  1043. X    $(CC) -c $(MRI_DEFINES) $(CFLAGS) WcRegXt.c   -o WcmRegXt.o
  1044. X
  1045. XlibWcm.a:  $(LIBWCM_OBJS)
  1046. X    $(RM) $@
  1047. X    $(AR) $@  $(LIBWCM_OBJS)
  1048. X    $(RANLIB) $@
  1049. X
  1050. Xinstall:: libWcm.a
  1051. X    $(INSTALL) -c $(INSTLIBFLAGS) libWcm.a  $(INSTALLLIBDIR)
  1052. X    $(RANLIB) $(INSTALLLIBDIR)/libWcm.a
  1053. X
  1054. Xclean::
  1055. X    $(RM) libWcm.a
  1056. X
  1057. Xclean::
  1058. X    $(RM) *.o core 
  1059. X
  1060. XMakefile:: makefile_orig
  1061. X    -@if [ -f Makefile ]; then \
  1062. X    echo "  $(RM) Makefile.bak; $(MV) Makefile Makefile.bak"; \
  1063. X    $(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \
  1064. X    else exit 0; fi
  1065. X    $(IMAKE_CMD) -DCURDIR=.
  1066. X
  1067. Xmakefile_orig: makefile
  1068. X    $(MV) makefile makefile_orig
  1069. +FUNKY+STUFF+
  1070. echo '-rw-rw-r--  1 david        7134 Oct 18 16:36 makefile    (as sent)'
  1071. chmod u=rw,g=rw,o=r makefile
  1072. ls -l makefile
  1073. echo x - patchlevel.h
  1074. sed 's/^X//' > patchlevel.h <<'+FUNKY+STUFF+'
  1075. X#define PATCHLEVEL 4
  1076. +FUNKY+STUFF+
  1077. echo '-rw-r--r--  1 david          21 Aug  6 09:45 patchlevel.h    (as sent)'
  1078. chmod u=rw,g=r,o=r patchlevel.h
  1079. ls -l patchlevel.h
  1080. echo x - test
  1081. sed 's/^X//' > test <<'+FUNKY+STUFF+'
  1082. X# !/bin/csh
  1083. X#
  1084. X# Execute all of the programs in the Widget Creation Library
  1085. X# delivery.
  1086. X#
  1087. X
  1088. Xalias se setenv XENVIRONMENT
  1089. X
  1090. Xecho This script will execute the programs once at a time.
  1091. X
  1092. Xif (-e App) then
  1093. X    se App1.All
  1094. X    App
  1095. Xendif
  1096. X
  1097. Xif (-e Ari) then
  1098. X    foreach example (A[0-9][0-9].*)
  1099. X    se $example
  1100. X    Ari 
  1101. X    end
  1102. Xendif
  1103. X
  1104. Xif (-e Mri) then
  1105. X    foreach example (M[1-9].*)
  1106. X    se $example
  1107. X    Mri 
  1108. X    end
  1109. Xendif
  1110. X
  1111. Xif (-e MDathena) then
  1112. X    se MD
  1113. X    MDathena
  1114. Xendif
  1115. X
  1116. Xif (-e MDmotif) then
  1117. X    echo    If you are using Xtm instead of X11R4 Xt, then
  1118. X    echo    this will core dump when you close a display,
  1119. X    echo    and then try to open another display.
  1120. X    se MD
  1121. X    MDmotif
  1122. Xendif
  1123. +FUNKY+STUFF+
  1124. echo '-rwxr-xr-x  1 david         656 Oct  9 20:48 test*    (as sent)'
  1125. chmod u=rwx,g=rx,o=rx test
  1126. ls -l test
  1127. exit 0
  1128.  
  1129. dan
  1130. ----------------------------------------------------
  1131. O'Reilly && Associates   argv@sun.com / argv@ora.com
  1132. Opinions expressed reflect those of the author only.
  1133. --
  1134. dan
  1135. ----------------------------------------------------
  1136. O'Reilly && Associates   argv@sun.com / argv@ora.com
  1137. Opinions expressed reflect those of the author only.
  1138.