a56: Add missing prototypes for alloc() and fixstring()
[linux-libre-firmware.git] / a56 / a56.h
1 /*******************************************************
2  *
3  *  a56 - a DSP56001 assembler
4  *
5  *  Written by Quinn C. Jensen
6  *  July 1990
7  *
8  *******************************************************\
9
10 /*
11  * Copyright (C) 2008 Robert Millan <rmh@aybabtu.com>
12  *
13  * This file is free software: you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License as published
15  * by the Free Software Foundation, either version 3 of the License,
16  * or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21  * General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program. If not, see
25  * <http://www.gnu.org/licenses/>.
26  *
27  * This file incorporates work covered by the following copyright and
28  * permission notice:
29  *
30  * Copyright (C) 1990-1994 Quinn C. Jensen
31  *
32  * Permission to use, copy, modify, distribute, and sell this software
33  * and its documentation for any purpose is hereby granted without fee,
34  * provided that the above copyright notice appear in all copies and
35  * that both that copyright notice and this permission notice appear
36  * in supporting documentation.  The author makes no representations
37  * about the suitability of this software for any purpose.  It is
38  * provided "as is" without express or implied warranty.
39  *
40  */
41
42 /*
43  *  a56.h - general definitions
44  *
45  */
46
47 #include <stdio.h>
48
49 #ifndef TRUE
50 #define TRUE 1
51 #define FALSE 0
52 #define NOT !
53 typedef int BOOL;
54 #endif
55
56 struct sym {
57         char *name;
58         struct n {
59                 short type;
60 #define UNDEF -1
61 #define INT 0
62 #define FLT 1
63                 short seg;
64 #define NONE 0
65 #define PROG 1
66 #define XDATA 2
67 #define YDATA 3
68 #define LDATA 4
69 #define ANY 5
70                 union val {
71                         int i;
72                         double f;
73                 } val;
74         } n;
75         struct sym *next;
76 } *find_sym();
77
78 extern int pass;
79
80 #define NEW(object) ((object *)alloc(sizeof(object)))
81
82 #define MAX_NEST 20             /* maximum include file nesting */
83
84 struct inc {
85         char *file;
86         FILE *fp;
87         int line;
88 };
89 extern struct inc inc[];
90 extern int inc_p;
91 #define curfile inc[inc_p].file
92 #define curline inc[inc_p].line
93
94 extern int ldebug;
95
96 struct psect {
97         char *name;
98         int seg;
99         unsigned int pc, bottom, top;
100         struct psect *next;
101 } *find_psect(), *new_psect();
102
103 FILE *open_read(), *open_write(), *open_append();
104
105         /* save string s somewhere */
106 #define strsave(s) ((s) != NULL ? \
107                 (char *)strcpy((char *)malloc(strlen(s)+1),(s)) : NULL)
108
109         /* after a call to fgets(), remove the newline character */
110 #define rmcr(s) {if (s[strlen(s)-1] == '\n') s[strlen(s)-1] = '\0';};
111
112 #define ASSERT(expr, str) \
113                 if(expr) fprintf(stderr, "ASSERT: %s: line %d: %s\n", __FILE__, __LINE__, str);
114
115 char *alloc (int size);
116 char *fixstring (char *s);