| 
									
										
										
										
											2019-12-13 04:29:58 +00:00
										 |  |  | # | 
					
						
							| 
									
										
										
										
											2020-03-24 07:08:21 +00:00
										 |  |  | # genoptcode.hawk | 
					
						
							| 
									
										
										
										
											2019-12-13 04:29:58 +00:00
										 |  |  | # | 
					
						
							| 
									
										
										
										
											2020-03-24 07:08:21 +00:00
										 |  |  | # hawk -f genoptcode.hawk hawk.h | 
					
						
							| 
									
										
										
										
											2019-12-13 04:29:58 +00:00
										 |  |  | # | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | BEGIN {  | 
					
						
							|  |  |  | 	collect=0;  | 
					
						
							|  |  |  | 	tab3="\t\t"; | 
					
						
							|  |  |  | 	tab4="\t\t\t"; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-01 14:16:01 +00:00
										 |  |  | /^[[:space:]]*enum[[:space:]]+hawk_trait_t[[:space:]]*$/ {  | 
					
						
							| 
									
										
										
										
											2019-12-13 04:29:58 +00:00
										 |  |  | 	collect=1;  | 
					
						
							|  |  |  | 	print tab3 "// generated by genoptcode.awk"; | 
					
						
							|  |  |  | 	print tab3 "enum Option"; | 
					
						
							|  |  |  | 	print tab3 "{"; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | collect && /^[[:space:]]*};[[:space:]]*$/ {  | 
					
						
							|  |  |  | 	print tab3 "};"; | 
					
						
							|  |  |  | 	print tab3 "// end of enum Option"; | 
					
						
							|  |  |  | 	print ""; | 
					
						
							|  |  |  | 	collect=0;  | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-01 14:16:01 +00:00
										 |  |  | collect && /^[[:space:]]*HAWK_[[:alnum:]]+/ {  | 
					
						
							| 
									
										
										
										
											2019-12-13 04:29:58 +00:00
										 |  |  | 	split ($1, flds, ","); | 
					
						
							|  |  |  | 	name=flds[1]; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-01 14:16:01 +00:00
										 |  |  | 	print tab4 "TRAIT_" substr (name,6,length(name)-5) " = " name ","; | 
					
						
							| 
									
										
										
										
											2019-12-13 04:29:58 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 |