home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / X / mit / lib / Xmu / StrToOrnt.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-12-20  |  1.8 KB  |  60 lines

  1. /* $XConsortium: StrToOrnt.c,v 1.6 90/12/20 13:33:20 converse Exp $ */
  2.  
  3. /* 
  4.  * Copyright 1988 by the Massachusetts Institute of Technology
  5.  *
  6.  * Permission to use, copy, modify, and distribute this software and its
  7.  * documentation for any purpose and without fee is hereby granted, provided 
  8.  * that the above copyright notice appear in all copies and that both that 
  9.  * copyright notice and this permission notice appear in supporting 
  10.  * documentation, and that the name of M.I.T. not be used in advertising
  11.  * or publicity pertaining to distribution of the software without specific, 
  12.  * written prior permission. M.I.T. makes no representations about the 
  13.  * suitability of this software for any purpose.  It is provided "as is"
  14.  * without express or implied warranty.
  15.  *
  16.  */
  17.  
  18. #include <X11/Intrinsic.h>
  19. #include <X11/StringDefs.h>
  20. #include "Converters.h"
  21. #include "CharSet.h"
  22.  
  23.  
  24. #define    done(address, type) \
  25.     { (*toVal).size = sizeof(type); (*toVal).addr = (caddr_t) address; }
  26.  
  27. /* ARGSUSED */
  28. void
  29. XmuCvtStringToOrientation(args, num_args, fromVal, toVal)
  30.     XrmValuePtr args;        /* unused */
  31.     Cardinal    *num_args;    /* unused */
  32.     XrmValuePtr    fromVal;
  33.     XrmValuePtr    toVal;
  34. {
  35.     static XtOrientation orient;
  36.     static    XrmQuark  XtQEhorizontal;
  37.     static    XrmQuark  XtQEvertical;
  38.     static    int      haveQuarks = 0;
  39.     XrmQuark    q;
  40.     char    lowerName[1000];
  41.  
  42.     if (!haveQuarks) {
  43.     XtQEhorizontal = XrmPermStringToQuark(XtEhorizontal);
  44.     XtQEvertical   = XrmPermStringToQuark(XtEvertical);
  45.     haveQuarks = 1;
  46.     }
  47.     XmuCopyISOLatin1Lowered(lowerName, (char *) fromVal->addr);
  48.     q = XrmStringToQuark(lowerName);
  49.     if (q == XtQEhorizontal) {
  50.         orient = XtorientHorizontal;
  51.     done(&orient, XtOrientation);
  52.     return;
  53.     }
  54.     if (q == XtQEvertical) {
  55.         orient = XtorientVertical;
  56.     done(&orient, XtOrientation);
  57.     return;
  58.     }
  59. }
  60.