mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-10-31 11:42:30 +00:00 
			
		
		
		
	Removed 4096 bytes limit for size of command from script file
This commit is contained in:
		
							parent
							
								
									3ec9fa4048
								
							
						
					
					
						commit
						5919bf5525
					
				
					 1 changed files with 20 additions and 3 deletions
				
			
		|  | @ -28,6 +28,19 @@ | ||||||
| #include "kernel/register.h" | #include "kernel/register.h" | ||||||
| #include "kernel/log.h" | #include "kernel/log.h" | ||||||
| 
 | 
 | ||||||
|  | bool fgetline(FILE *f, std::string &buffer) | ||||||
|  | { | ||||||
|  | 	buffer = ""; | ||||||
|  | 	char block[4096]; | ||||||
|  | 	while (1) { | ||||||
|  | 		if (fgets(block, 4096, f) == NULL) | ||||||
|  | 			return false; | ||||||
|  | 		buffer += block; | ||||||
|  | 		if (buffer.size() > 0 && (buffer[buffer.size()-1] == '\n' ||  buffer[buffer.size()-1] == '\r')) | ||||||
|  | 			return true; | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  | 
 | ||||||
| static void run_frontend(std::string filename, std::string command, RTLIL::Design *design, std::string *backend_command) | static void run_frontend(std::string filename, std::string command, RTLIL::Design *design, std::string *backend_command) | ||||||
| { | { | ||||||
| 	if (command == "auto") { | 	if (command == "auto") { | ||||||
|  | @ -50,9 +63,13 @@ static void run_frontend(std::string filename, std::string command, RTLIL::Desig | ||||||
| 			f = fopen(filename.c_str(), "r"); | 			f = fopen(filename.c_str(), "r"); | ||||||
| 		if (f == NULL) | 		if (f == NULL) | ||||||
| 			log_error("Can't open script file `%s' for reading: %s\n", filename.c_str(), strerror(errno)); | 			log_error("Can't open script file `%s' for reading: %s\n", filename.c_str(), strerror(errno)); | ||||||
| 		char buffer[4096]; | 		std::string command; | ||||||
| 		while (fgets(buffer, 4096, f) != NULL) { | 		while (fgetline(f, command)) { | ||||||
| 			Pass::call(design, buffer); | 			Pass::call(design, command); | ||||||
|  | 			design->check(); | ||||||
|  | 		} | ||||||
|  | 		if (!command.empty()) { | ||||||
|  | 			Pass::call(design, command); | ||||||
| 			design->check(); | 			design->check(); | ||||||
| 		} | 		} | ||||||
| 		if (filename != "-") | 		if (filename != "-") | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue