1 /* { dg-do compile } */
2 /* { dg-require-effective-target lp64 } */
3 /* { dg-options "-O2 -ftree-tail-merge" } */
4 
5 enum Lisp_Type
6 {
7   Lisp_Int0 = 0, Lisp_Int1 = 4, Lisp_Symbol = 2, Lisp_Misc = 3, Lisp_String =
8     1, Lisp_Vectorlike = 5, Lisp_Cons = 6, Lisp_Float = 7,
9 };
10 typedef long Lisp_Object;
11 enum pvec_type
12 {
13   PVEC_NORMAL_VECTOR = 0, PVEC_PROCESS = 0x200, PVEC_FRAME =
14     0x400, PVEC_COMPILED = 0x800, PVEC_WINDOW =
15     0x1000, PVEC_WINDOW_CONFIGURATION = 0x2000, PVEC_SUBR =
16     0x4000, PVEC_CHAR_TABLE = 0x8000, PVEC_BOOL_VECTOR =
17     0x10000, PVEC_BUFFER = 0x20000, PVEC_HASH_TABLE = 0x40000, PVEC_TERMINAL =
18     0x80000, PVEC_SUB_CHAR_TABLE = 0x100000, PVEC_FONT =
19     0x200000, PVEC_OTHER = 0x400000, PVEC_TYPE_MASK = 0x7ffe00
20 };
21 struct Lisp_Vector
22 {
23   unsigned long size;
24 };
25 struct Lisp_Char_Table
26 {
27   Lisp_Object defalt;
28   Lisp_Object ascii;
29 };
30 struct Lisp_Sub_Char_Table
31 {
32   Lisp_Object contents[1];
33 };
34 extern Lisp_Object Qnil, Qt, Qquote, Qlambda, Qsubr, Qunbound;
35 struct buffer_text
36 {
37   unsigned char *beg;
38   long gpt_byte;
39   long gap_size;
40 };
41 struct buffer
42 {
43   struct buffer_text *text;
44   struct region_cache *width_run_cache;
45   Lisp_Object tab_width;
46   Lisp_Object ctl_arrow;
47 };
48 extern struct buffer *current_buffer;
49 extern Lisp_Object Vchar_width_table;
50 struct frame
51 {
52   long text_lines, text_cols;
53 };
54 struct window
55 {
56   Lisp_Object frame;
57 };
58 extern Lisp_Object Vtruncate_partial_width_windows;
59 extern struct Lisp_Char_Table *window_display_table (struct window *);
60 long find_before_next_newline (long, long, long);
61 long disp_char_vector (struct Lisp_Char_Table *, int);
62 long char_table_ref (Lisp_Object, int);
63 struct position *
compute_motion(from,fromvpos,fromhpos,did_motion,to,tovpos,tohpos,width,hscroll,tab_offset,win)64 compute_motion (from, fromvpos, fromhpos, did_motion, to, tovpos, tohpos,
65 		width, hscroll, tab_offset, win)
66      int did_motion, width, hscroll, tab_offset;
67      long from, fromvpos, fromhpos, to, tovpos, tohpos;
68      struct window *win;
69 {
70   register long hpos = fromhpos;
71   register long pos;
72   long pos_byte;
73   register int c = 0;
74   register struct Lisp_Char_Table *dp = window_display_table (win);
75   long wide_column_end_hpos = 0;
76   long continuation_glyph_width;
77   while (1)
78     {
79       if (hpos > width)
80 	{
81 	  int total_width = width + continuation_glyph_width;
82 	  if (!((Vtruncate_partial_width_windows) == (Qnil))
83 	      && (total_width <
84 		  (((void) 0,
85 		    (struct frame
86 		     *) ((long) (((win)->frame) & ~((((long) 1) << 3) -
87 						    1)))))->text_cols))
88 	    {
89 	      if (pos <= to)
90 		{
91 		  pos = find_before_next_newline (pos, to, 1);
92 		}
93 	      if (wide_column_end_hpos > width)
94 		{
95 		  hpos -= width;
96 		}
97 	    }
98 	}
99       else
100 	{
101 	  Lisp_Object charvec;
102 	  c =
103 	    *(((((pos_byte)) >=
104 		(current_buffer->text->gpt_byte) ? (current_buffer->text->
105 						    gap_size) : 0) +
106 	       ((pos_byte)) + (current_buffer->text->beg) - ((1))));
107 	  if (current_buffer->width_run_cache)
108 	    {
109 	      if (((((enum Lisp_Type) (((unsigned long) ((charvec))) &
110 				       ((((long) 1) << 3) - 1))) ==
111 		    Lisp_Vectorlike)
112 		   &&
113 		   !(((void) 0,
114 		      (struct Lisp_Vector
115 		       *) ((long) ((charvec) & ~((((long) 1) << 3) - 1))))->
116 		     size & ((((unsigned long) 1 << (64 - 1)) >> 1)))))
117 		{
118 		  unsigned char *ptr;
119 		  int bytes, width, wide_column;
120 		  do
121 		    {
122 		      if ((!((*ptr) & 0x80) ? 1 : !((*ptr) & 0x20) ? 2 :
123 			   !((*ptr) & 0x10) ? 3 : !((*ptr) & 0x08) ? 4 : 5) !=
124 			  bytes)
125 			width = bytes * 4;
126 		      else
127 			{
128 			  if (dp != 0
129 			      &&
130 			      ((((enum
131 				  Lisp_Type) (((unsigned
132 						long) (((((unsigned) (c) <
133 							  0x80)
134 							 ? ((((dp)->ascii) ==
135 							     (Qnil)) ? (dp)->
136 							    defalt
137 							    : (((((enum
138 								   Lisp_Type)
139 								  (((unsigned
140 								     long) (((dp)->ascii))) & ((((long) 1) << 3) - 1))) == Lisp_Vectorlike) && (((((void) 0, (struct Lisp_Vector *) ((long) (((dp)->ascii) & ~((((long) 1) << 3) - 1))))->size & (((((unsigned long) 1 << (64 - 1)) >> 1)) | (PVEC_SUB_CHAR_TABLE)))) == (((((unsigned long) 1 << (64 - 1)) >> 1)) | (PVEC_SUB_CHAR_TABLE)))) ? ((void) 0, (struct Lisp_Sub_Char_Table *) ((long) (((dp)->ascii) & ~((((long) 1) << 3) - 1))))->contents[c] : (dp)->ascii)) : disp_char_vector ((dp), (c)))))) & ((((long) 1) << 3) - 1))) == Lisp_Vectorlike) && !(((void) 0, (struct Lisp_Vector *) ((long) (((((unsigned) (c) < 0x80) ? ((((dp)->ascii) == (Qnil)) ? (dp)->defalt : (((((enum Lisp_Type) (((unsigned long) (((dp)->ascii))) & ((((long) 1) << 3) - 1))) == Lisp_Vectorlike) && (((((void) 0, (struct Lisp_Vector *) ((long) (((dp)->ascii) & ~((((long) 1) << 3) - 1))))->size & (((((unsigned long) 1 << (64 - 1)) >> 1)) | (PVEC_SUB_CHAR_TABLE)))) == (((((unsigned long) 1 << (64 - 1)) >> 1)) | (PVEC_SUB_CHAR_TABLE)))) ? ((void) 0, (struct Lisp_Sub_Char_Table *) ((long) (((dp)->ascii) & ~((((long) 1) << 3) - 1))))->contents[c] : (dp)->ascii)) : disp_char_vector ((dp), (c)))) & ~((((long) 1) << 3) - 1))))->size & ((((unsigned long) 1 << (64 - 1)) >> 1)))))
141 			    width =
142 			      ((void) 0,
143 			       (struct Lisp_Vector
144 				*) ((long) (((((unsigned) (c) <
145 					       0x80) ? ((((dp)->ascii) ==
146 							 (Qnil)) ? (dp)->
147 							defalt
148 							: (((((enum
149 							       Lisp_Type) (((unsigned long) (((dp)->ascii))) & ((((long) 1) << 3) - 1))) == Lisp_Vectorlike) && (((((void) 0, (struct Lisp_Vector *) ((long) (((dp)->ascii) & ~((((long) 1) << 3) - 1))))->size & (((((unsigned long) 1 << (64 - 1)) >> 1)) | (PVEC_SUB_CHAR_TABLE)))) == (((((unsigned long) 1 << (64 - 1)) >> 1)) | (PVEC_SUB_CHAR_TABLE)))) ? ((void) 0, (struct Lisp_Sub_Char_Table *) ((long) (((dp)->ascii) & ~((((long) 1) << 3) - 1))))->contents[c] : (dp)->ascii)) : disp_char_vector ((dp), (c)))) & ~((((long) 1) << 3) - 1))))->size;
150 			  else
151 			    width =
152 			      (((unsigned) (c) < 0x80) ? (c <
153 							  0x20 ? (c ==
154 								  '\t'
155 								  ? ((((long)
156 								       (current_buffer->
157 									tab_width))
158 								      >> (3 -
159 									  1)))
160 								  : (c ==
161 								     '\n' ? 0
162 								     : (((current_buffer->ctl_arrow) == (Qnil)) ? 4 : 2))) : (c < 0x7f ? 1 : ((((current_buffer->ctl_arrow) == (Qnil)) ? 4 : 2)))) : (((long) ((((unsigned) (c) < 0x80) ? (
163 																														       {
164 																														       Lisp_Object
165 																														       _val;
166 																														       _val;}
167 			):																							char_table_ref ((Vchar_width_table), (c))))) >> (3 - 1)));
168 			  if (width > 1)
169 			    wide_column = width;
170 			}
171 		    }
172 		  while (0);
173 		  if (wide_column)
174 		    wide_column_end_hpos = hpos + wide_column;
175 		}
176 	    }
177 	}
178     }
179 }
180