struct shape_mapping { const char *name; int number; }; const int cursor_shape_to_id(const char *name); %% X_cursor,0 arrow,1 based_arrow_down,2 based_arrow_up,3 boat,4 bogosity,5 bottom_left_corner,6 bottom_right_corner,7 bottom_side,8 bottom_tee,9 box_spiral,10 center_ptr,11 circle,12 clock,13 coffee_mug,14 cross,15 cross_reverse,16 crosshair,17 diamond_cross,18 dot,19 dotbox,20 double_arrow,21 draft_large,22 draft_small,23 draped_box,24 exchange,25 fleur,26 gobbler,27 gumby,28 hand1,29 hand2,30 heart,31 icon,32 iron_cross,33 left_ptr,34 left_side,35 left_tee,36 leftbutton,37 ll_angle,38 lr_angle,39 man,40 middlebutton,41 mouse,42 pencil,43 pirate,44 plus,45 question_arrow,46 right_ptr,47 right_side,48 right_tee,49 rightbutton,50 rtl_logo,51 sailboat,52 sb_down_arrow,53 sb_h_double_arrow,54 sb_left_arrow,55 sb_right_arrow,56 sb_up_arrow,57 sb_v_double_arrow,58 shuttle,59 sizing,60 spider,61 spraycan,62 star,63 target,64 tcross,65 top_left_arrow,66 top_left_corner,67 top_right_corner,68 top_side,69 top_tee,70 trek,71 ul_angle,72 umbrella,73 ur_angle,74 watch,75 xterm,76 %% const int cursor_shape_to_id(const char *name) { struct shape_mapping *mapping = in_word_set(name, strlen(name)); return (mapping ? (mapping->number * 2) : -1); }