mirror of
				https://gitlab.freedesktop.org/wayland/wayland.git
				synced 2025-11-03 09:01:42 -05:00 
			
		
		
		
	scanner: Use indent() function in desc_dump()
This commit is contained in:
		
							parent
							
								
									3f7048e0e9
								
							
						
					
					
						commit
						e4026ff797
					
				
					 1 changed files with 19 additions and 25 deletions
				
			
		| 
						 | 
					@ -138,10 +138,26 @@ uppercase_dup(const char *src)
 | 
				
			||||||
	return u;
 | 
						return u;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static const char *indent(int n)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						const char *whitespace[] = {
 | 
				
			||||||
 | 
							"\t\t\t\t\t\t\t\t\t\t\t\t",
 | 
				
			||||||
 | 
							"\t\t\t\t\t\t\t\t\t\t\t\t ",
 | 
				
			||||||
 | 
							"\t\t\t\t\t\t\t\t\t\t\t\t  ",
 | 
				
			||||||
 | 
							"\t\t\t\t\t\t\t\t\t\t\t\t   ",
 | 
				
			||||||
 | 
							"\t\t\t\t\t\t\t\t\t\t\t\t    ",
 | 
				
			||||||
 | 
							"\t\t\t\t\t\t\t\t\t\t\t\t     ",
 | 
				
			||||||
 | 
							"\t\t\t\t\t\t\t\t\t\t\t\t      ",
 | 
				
			||||||
 | 
							"\t\t\t\t\t\t\t\t\t\t\t\t       "
 | 
				
			||||||
 | 
						};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return whitespace[n % 8] + 12 - n / 8;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
desc_dump(char *src, int startcol)
 | 
					desc_dump(char *src, int startcol)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int i, j = 0, col = startcol, line = 0;
 | 
						int i, col = startcol, line = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Strip leading space */
 | 
						/* Strip leading space */
 | 
				
			||||||
	for (i = 0; isspace(src[i]); i++)
 | 
						for (i = 0; isspace(src[i]); i++)
 | 
				
			||||||
| 
						 | 
					@ -156,14 +172,8 @@ desc_dump(char *src, int startcol)
 | 
				
			||||||
			src[i] = ' ';
 | 
								src[i] = ' ';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (col > 72 && isspace(src[i])) {
 | 
							if (col > 72 && isspace(src[i])) {
 | 
				
			||||||
			if (src[i+1]) {
 | 
								if (src[i+1])
 | 
				
			||||||
				putchar('\n');
 | 
									printf("\n%s* ", indent(startcol + 1));
 | 
				
			||||||
				for (j = 0; j < startcol; j++)
 | 
					 | 
				
			||||||
					putchar(' ');
 | 
					 | 
				
			||||||
				putchar(' ');
 | 
					 | 
				
			||||||
				putchar('*');
 | 
					 | 
				
			||||||
				putchar(' ');
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			line++;
 | 
								line++;
 | 
				
			||||||
			col = startcol;
 | 
								col = startcol;
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
| 
						 | 
					@ -619,22 +629,6 @@ emit_event_wrappers(struct wl_list *message_list, struct interface *interface)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static const char *indent(int n)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	const char *whitespace[] = {
 | 
					 | 
				
			||||||
		"\t\t\t\t\t\t\t\t\t\t\t\t",
 | 
					 | 
				
			||||||
		"\t\t\t\t\t\t\t\t\t\t\t\t ",
 | 
					 | 
				
			||||||
		"\t\t\t\t\t\t\t\t\t\t\t\t  ",
 | 
					 | 
				
			||||||
		"\t\t\t\t\t\t\t\t\t\t\t\t   ",
 | 
					 | 
				
			||||||
		"\t\t\t\t\t\t\t\t\t\t\t\t    ",
 | 
					 | 
				
			||||||
		"\t\t\t\t\t\t\t\t\t\t\t\t     ",
 | 
					 | 
				
			||||||
		"\t\t\t\t\t\t\t\t\t\t\t\t      ",
 | 
					 | 
				
			||||||
		"\t\t\t\t\t\t\t\t\t\t\t\t       "
 | 
					 | 
				
			||||||
	};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	return whitespace[n % 8] + 12 - n / 8;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
emit_enumerations(struct interface *interface)
 | 
					emit_enumerations(struct interface *interface)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue