+/* Copyright 2001, 2003 Free Software Foundation, Inc.
+ Written by Steve Chamberlain of Cygnus Support (steve@cygnus.com).
+
+This file is part of GNU binutils.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
%{
+#include <stdio.h>
+#include <stdlib.h>
+
extern char *word;
extern char writecode;
extern int number;
}
%token COND
%token REPEAT
-%token '(' ')' '[' ']'
+%token '(' ')'
%token <s> TYPE
%token <s> NAME
%token <i> NUMBER UNIT
printf("#ifdef SYSROFF_PRINT\n");
printf("#include <stdio.h>\n");
printf("#include <stdlib.h>\n");
+ printf("#include <ansidecl.h>\n");
break;
}
}
{
case 'd':
printf("\n\n\n#define IT_%s_CODE 0x%x\n", it,code);
+ printf("struct IT_%s;\n", it);
+ printf("extern void sysroff_swap_%s_in PARAMS ((struct IT_%s *));\n",
+ $2, it);
+ printf("extern void sysroff_swap_%s_out PARAMS ((FILE *, struct IT_%s *));\n",
+ $2, it);
+ printf("extern void sysroff_print_%s_out PARAMS ((struct IT_%s *));\n",
+ $2, it);
printf("struct IT_%s { \n", it);
break;
case 'i':
printf("size = fillup(raw);\n");
break;
case 'g':
- printf("void sysroff_swap_%s_out(file,ptr,last)\n",$2);
+ printf("void sysroff_swap_%s_out(file,ptr)\n",$2);
printf("FILE * file;\n");
printf("struct IT_%s *ptr;\n", it);
- printf("int last;\n");
printf("{\n");
printf("\tchar raw[255];\n");
printf("\tint idx = 16 ;\n");
printf("};\n");
break;
case 'g':
- printf("\tchecksum(file,raw, idx, IT_%s_CODE, last);\n", it);
+ printf("\tchecksum(file,raw, idx, IT_%s_CODE);\n", it);
case 'i':
if (rdepth == 2)
{
- printf("if (!ptr->%s[n]) ptr->%s[n] = (%s**)calloc(%s[n], sizeof(ptr->%s[n][0]));\n",
+ printf("if (!ptr->%s[n]) ptr->%s[n] = (%s**)xcalloc(%s[n], sizeof(ptr->%s[n][0]));\n",
id,
id,
type,
-
-name:
- NAME
- {
- printf("Got %s\n", word);
- }
- ;
-
-
-
-
-
-
-
%%
/* four modes
- -d write structure defintions for sysroff in host format
+ -d write structure definitions for sysroff in host format
-i write functions to swap into sysroff format in
-o write functions to swap into sysroff format out
-c write code to print info in human form */
-#include <stdio.h>
-#include <stdlib.h>
int yydebug;
char writecode;
int
-main(ac,av)
-int ac;
-char **av;
+main (int ac, char **av)
{
yydebug=0;
if (ac > 1)
return 0;
}
-int yyerror()
+int
+yyerror (char *s)
{
- printf("Error twathead\n");
+ fprintf(stderr, "%s\n" , s);
+ return 0;
}