home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / x / xcolored.zip / xcoloredit / utilities.c < prev    next >
C/C++ Source or Header  |  1992-01-25  |  3KB  |  100 lines

  1. #ifndef lint
  2. static char sccsid[] = "@(#)utilities.c    1.2 (UKC) 25/1/92";
  3. #endif /* !lint */
  4.  
  5. /* 
  6.  * Copyright 1990,1992 Richard Hesketh / rlh2@ukc.ac.uk
  7.  *                Computing Lab. University of Kent at Canterbury, UK
  8.  *
  9.  * Permission to use, copy, modify and distribute this software and its
  10.  * documentation for any purpose is hereby granted without fee, provided that
  11.  * the above copyright notice appear in all copies and that both that
  12.  * copyright notice and this permission notice appear in supporting
  13.  * documentation, and that the names of Richard Hesketh and The University of
  14.  * Kent at Canterbury not be used in advertising or publicity pertaining to
  15.  * distribution of the software without specific, written prior permission.
  16.  * Richard Hesketh and The University of Kent at Canterbury make no
  17.  * representations about the suitability of this software for any purpose.
  18.  * It is provided "as is" without express or implied warranty.
  19.  *
  20.  * Richard Hesketh AND THE UNIVERSITY OF KENT AT CANTERBURY DISCLAIMS ALL
  21.  * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
  22.  * OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL Richard Hesketh OR THE
  23.  * UNIVERSITY OF KENT AT CANTERBURY BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  24.  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  25.  * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  26.  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
  27.  * OF THIS SOFTWARE.
  28.  *
  29.  * Author:  Richard Hesketh / rlh2@ukc.ac.uk, 
  30.  *                Computing Lab. University of Kent at Canterbury, UK
  31.  */
  32.  
  33.  
  34. /*
  35.  * This file was generated by the DIRT interface editor
  36.  *    Author: Richard Hesketh / rlh2@ukc.ac.uk
  37.  *    Version: 1.0 of June 3rd 1989
  38.  *
  39.  * Generated for rlh2 on Mon Aug 21 09:35:53 1989
  40.  */
  41.  
  42. #include <X11/Intrinsic.h>
  43. #include <X11/Shell.h>
  44.  
  45. Display *
  46. XukcToolkitInitialize(dpy_str, app_name, app_class,
  47.                     argc, argv, options, num_options)
  48. String dpy_str;
  49. String app_name;
  50. String app_class;
  51. Cardinal *argc;
  52. String argv[];
  53. XrmOptionDescRec options[];
  54. Cardinal num_options;
  55. {
  56.     Cardinal i;
  57.     static Boolean inited = FALSE;
  58.     XtAppContext new_context;
  59.     Display *dpy;
  60.  
  61.     if (!inited) {
  62.         XtToolkitInitialize();
  63.         inited = TRUE;
  64.     }
  65.  
  66.     new_context = XtCreateApplicationContext();
  67.     dpy = XtOpenDisplay(new_context, dpy_str, app_name,
  68.                 app_class, options, num_options,
  69.                 argc, argv);
  70.     if (dpy == NULL)
  71.         XtError("Could not open Display");
  72.     return (dpy);
  73. }
  74.  
  75.  
  76. void
  77. XukcRegisterApplicationDefaults(screen, defs, n_defs)
  78. Screen *screen;
  79. String defs[];
  80. Cardinal n_defs;
  81. {
  82.     XrmDatabase rdb = NULL;
  83.     Cardinal i;
  84.  
  85.     for (i = 0; i < n_defs; i++)
  86.         XrmPutLineResource(&rdb, defs[i]);
  87.  
  88.     if (rdb != NULL) {
  89. #if defined(XlibSpecificationRelease) && XlibSpecificationRelease > 4
  90.         XrmDatabase sdb = XtScreenDatabase(screen);
  91.  
  92.         XrmCombineDatabase(rdb, &sdb, False);
  93. #else
  94.         XrmMergeDatabases(DisplayOfScreen(screen)->db, &rdb);
  95.         DisplayOfScreen(screen)->db = rdb;
  96.         /* original dpy->db has been destroyed */
  97. #endif
  98.     }
  99. }
  100.