mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-11-04 05:19:11 +00:00 
			
		
		
		
	Filter ANSI escape sequences from ABC output
This commit is contained in:
		
							parent
							
								
									c27120fcbc
								
							
						
					
					
						commit
						28bc7aeb93
					
				
					 1 changed files with 15 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -639,10 +639,25 @@ static void abc_module(RTLIL::Design *design, RTLIL::Module *current_module, std
 | 
			
		|||
			log("ABC: %s", logbuf);
 | 
			
		||||
#else
 | 
			
		||||
		bool got_cr = false;
 | 
			
		||||
		int escape_seq_state = 0;
 | 
			
		||||
		std::string linebuf;
 | 
			
		||||
		char logbuf[1024];
 | 
			
		||||
		while (fgets(logbuf, 1024, f) != NULL)
 | 
			
		||||
			for (char *p = logbuf; *p; p++) {
 | 
			
		||||
				if (escape_seq_state == 0 && *p == '\033') {
 | 
			
		||||
					escape_seq_state = 1;
 | 
			
		||||
					continue;
 | 
			
		||||
				}
 | 
			
		||||
				if (escape_seq_state == 1) {
 | 
			
		||||
					escape_seq_state = *p == '[' ? 2 : 0;
 | 
			
		||||
					continue;
 | 
			
		||||
				}
 | 
			
		||||
				if (escape_seq_state == 2) {
 | 
			
		||||
					if ((*p < '0' || '9' < *p) && *p != ';')
 | 
			
		||||
						escape_seq_state = 0;
 | 
			
		||||
					continue;
 | 
			
		||||
				}
 | 
			
		||||
				escape_seq_state = 0;
 | 
			
		||||
				if (*p == '\r') {
 | 
			
		||||
					got_cr = true;
 | 
			
		||||
					continue;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue