Browse Source

Revised to include rcsid of pattern file in binary opt

sater 40 years ago
parent
commit
6474db065f
3 changed files with 7 additions and 2 deletions
  1. 5 1
      util/opt/mktab.y
  2. 1 1
      util/opt/patterns
  3. 1 0
      util/opt/scan.l

+ 5 - 1
util/opt/mktab.y

@@ -42,6 +42,7 @@ byte	nparam[N_EX_OPS];
 bool	nonumlab[N_EX_OPS];
 bool	onlyconst[N_EX_OPS];
 int	nerrors=0;
+char	patid[128];
 %}
 
 %union {
@@ -61,7 +62,7 @@ int	nerrors=0;
 %nonassoc NOT,COMP,UMINUS
 %nonassoc '$'
 
-%token SFIT,UFIT,NOTREG,PSIZE,WSIZE,DEFINED,SAMESIGN,ROM,ROTATE
+%token SFIT,UFIT,NOTREG,PSIZE,WSIZE,DEFINED,SAMESIGN,ROM,ROTATE,STRING
 %token <y_int> MNEM
 %token <y_int> NUMBER
 %type <y_int> expr,argno,optexpr
@@ -71,6 +72,7 @@ int	nerrors=0;
 %%
 patternlist
 	:	/* empty */
+	|	STRING '\n'
 	|	patternlist '\n'
 	|	patternlist pattern
 	;
@@ -297,6 +299,8 @@ printnodes() {
 		printf("/* %3d */\t%3d,%6u,%6u,\n",
 			p-nodes,p->ex_operator,p->ex_lnode,p->ex_rnode);
 	printf("};\n\niarg_t iargs[%d];\n",maxpatlen);
+	if (patid[0])
+		printf("static char rcsid[] = %s;\n",patid);
 }
 
 initio() {

+ 1 - 1
util/opt/patterns

@@ -1,4 +1,4 @@
-/* $Header$ */
+"$Header$"
 loc adi loc sbi $2==w && $4==w: loc $1-$3 adi w
 ldc adi ldc sbi $2==2*w && $4==2*w:     ldc $1-$3 adi 2*w
 loc adi loc adi $2==w && $4==w: loc $1+$3 adi w

+ 1 - 0
util/opt/scan.l

@@ -24,6 +24,7 @@ static char rcsid2[] = "$Header$";
 extern long atol();
 %}
 %%
+\"[^"]*\"	{ strncpy(patid,yytext,sizeof(patid)); return(STRING); }
 notreg		return(NOTREG);
 sfit		return(SFIT);
 ufit		return(UFIT);