home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / X / mit / lib / Xmu / CursorName.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-02-17  |  4.4 KB  |  142 lines

  1. /*
  2.  * $XConsortium: CursorName.c,v 1.7 91/02/17 15:25:42 rws Exp $
  3.  *
  4.  * Copyright 1989 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.  * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
  17.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T.
  18.  * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  19.  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
  20.  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 
  21.  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  22.  */
  23.  
  24. #include <X11/Intrinsic.h>
  25. #include <X11/Xmu/CharSet.h>
  26. #include <X11/Xmu/CurUtil.h>
  27. #include <X11/cursorfont.h>
  28.  
  29. #if __STDC__
  30. #define Const const
  31. #else
  32. #define Const /**/
  33. #endif
  34.  
  35. #if NeedFunctionPrototypes
  36. int XmuCursorNameToIndex (_Xconst char *name)
  37. #else
  38. int XmuCursorNameToIndex (name)
  39.     char *name;
  40. #endif
  41. {
  42.     static Const struct _CursorName {
  43.     Const char    *name;
  44.     unsigned int    shape;
  45.     } cursor_names[] = {
  46.             {"x_cursor",        XC_X_cursor},
  47.             {"arrow",        XC_arrow},
  48.             {"based_arrow_down",    XC_based_arrow_down},
  49.             {"based_arrow_up",    XC_based_arrow_up},
  50.             {"boat",        XC_boat},
  51.             {"bogosity",        XC_bogosity},
  52.             {"bottom_left_corner",    XC_bottom_left_corner},
  53.             {"bottom_right_corner",    XC_bottom_right_corner},
  54.             {"bottom_side",        XC_bottom_side},
  55.             {"bottom_tee",        XC_bottom_tee},
  56.             {"box_spiral",        XC_box_spiral},
  57.             {"center_ptr",        XC_center_ptr},
  58.             {"circle",        XC_circle},
  59.             {"clock",        XC_clock},
  60.             {"coffee_mug",        XC_coffee_mug},
  61.             {"cross",        XC_cross},
  62.             {"cross_reverse",    XC_cross_reverse},
  63.             {"crosshair",        XC_crosshair},
  64.             {"diamond_cross",    XC_diamond_cross},
  65.             {"dot",            XC_dot},
  66.             {"dotbox",        XC_dotbox},
  67.             {"double_arrow",    XC_double_arrow},
  68.             {"draft_large",        XC_draft_large},
  69.             {"draft_small",        XC_draft_small},
  70.             {"draped_box",        XC_draped_box},
  71.             {"exchange",        XC_exchange},
  72.             {"fleur",        XC_fleur},
  73.             {"gobbler",        XC_gobbler},
  74.             {"gumby",        XC_gumby},
  75.             {"hand1",        XC_hand1},
  76.             {"hand2",        XC_hand2},
  77.             {"heart",        XC_heart},
  78.             {"icon",        XC_icon},
  79.             {"iron_cross",        XC_iron_cross},
  80.             {"left_ptr",        XC_left_ptr},
  81.             {"left_side",        XC_left_side},
  82.             {"left_tee",        XC_left_tee},
  83.             {"leftbutton",        XC_leftbutton},
  84.             {"ll_angle",        XC_ll_angle},
  85.             {"lr_angle",        XC_lr_angle},
  86.             {"man",            XC_man},
  87.             {"middlebutton",    XC_middlebutton},
  88.             {"mouse",        XC_mouse},
  89.             {"pencil",        XC_pencil},
  90.             {"pirate",        XC_pirate},
  91.             {"plus",        XC_plus},
  92.             {"question_arrow",    XC_question_arrow},
  93.             {"right_ptr",        XC_right_ptr},
  94.             {"right_side",        XC_right_side},
  95.             {"right_tee",        XC_right_tee},
  96.             {"rightbutton",        XC_rightbutton},
  97.             {"rtl_logo",        XC_rtl_logo},
  98.             {"sailboat",        XC_sailboat},
  99.             {"sb_down_arrow",    XC_sb_down_arrow},
  100.             {"sb_h_double_arrow",    XC_sb_h_double_arrow},
  101.             {"sb_left_arrow",    XC_sb_left_arrow},
  102.             {"sb_right_arrow",    XC_sb_right_arrow},
  103.             {"sb_up_arrow",        XC_sb_up_arrow},
  104.             {"sb_v_double_arrow",    XC_sb_v_double_arrow},
  105.             {"shuttle",        XC_shuttle},
  106.             {"sizing",        XC_sizing},
  107.             {"spider",        XC_spider},
  108.             {"spraycan",        XC_spraycan},
  109.             {"star",        XC_star},
  110.             {"target",        XC_target},
  111.             {"tcross",        XC_tcross},
  112.             {"top_left_arrow",    XC_top_left_arrow},
  113.             {"top_left_corner",    XC_top_left_corner},
  114.             {"top_right_corner",    XC_top_right_corner},
  115.             {"top_side",        XC_top_side},
  116.             {"top_tee",        XC_top_tee},
  117.             {"trek",        XC_trek},
  118.             {"ul_angle",        XC_ul_angle},
  119.             {"umbrella",        XC_umbrella},
  120.             {"ur_angle",        XC_ur_angle},
  121.             {"watch",        XC_watch},
  122.             {"xterm",        XC_xterm},
  123.     };
  124.     register Const struct _CursorName *table;
  125.     register int i;
  126.     char tmp[40];
  127.     
  128.     if (strlen (name) >= sizeof tmp) return -1;
  129.     XmuCopyISOLatin1Lowered (tmp, name);
  130.  
  131.     for (i=0, table=cursor_names; i < XtNumber(cursor_names); i++, table++ ) {
  132.     if (strcmp(tmp, table->name) == 0) return table->shape;
  133.     }
  134.  
  135.     return -1;
  136. }
  137.  
  138.  
  139.  
  140.  
  141.  
  142.