Deleted Added
full compact
aicasm.c (5775) aicasm.c (7118)
1/*
2 * Adaptec 274x device driver for Linux.
3 * Copyright (c) 1994 The University of Calgary Department of Computer Science.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.

--- 12 unchanged lines hidden (view full) ---

21 *
22 * <label>*
23 * <label>* <undef-sym> = <value>
24 * <label>* <opcode> <operand>*
25 *
26 * A <label> is an <undef-sym> ending in a colon. Spaces, tabs, and commas
27 * are token separators.
28 *
1/*
2 * Adaptec 274x device driver for Linux.
3 * Copyright (c) 1994 The University of Calgary Department of Computer Science.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.

--- 12 unchanged lines hidden (view full) ---

21 *
22 * <label>*
23 * <label>* <undef-sym> = <value>
24 * <label>* <opcode> <operand>*
25 *
26 * A <label> is an <undef-sym> ending in a colon. Spaces, tabs, and commas
27 * are token separators.
28 *
29 * $Id: aic7xxx.c,v 1.4 1995/01/16 16:31:20 gibbs Exp $
29 * $Id: aic7xxx.c,v 1.5 1995/01/22 00:46:52 gibbs Exp $
30 */
31
32/* #define _POSIX_SOURCE 1 */
33#define _POSIX_C_SOURCE 2
34
35#include <ctype.h>
36#include <stdio.h>
37#include <string.h>

--- 156 unchanged lines hidden (view full) ---

194 M[i][1],
195 M[i][0]);
196 printf("%d out of %d instructions used.\n", LC, MEMORY);
197}
198
199char **getl(int *n)
200{
201 int i;
30 */
31
32/* #define _POSIX_SOURCE 1 */
33#define _POSIX_C_SOURCE 2
34
35#include <ctype.h>
36#include <stdio.h>
37#include <string.h>

--- 156 unchanged lines hidden (view full) ---

194 M[i][1],
195 M[i][0]);
196 printf("%d out of %d instructions used.\n", LC, MEMORY);
197}
198
199char **getl(int *n)
200{
201 int i;
202 char *p;
202 char *p, *quote;
203 static char buf[MAXLINE];
204 static char *a[MAXTOKEN];
205
206 i = 0;
207
208 while (fgets(buf, sizeof(buf), ifp)) {
209
210 lineno += 1;
211
212 if (buf[strlen(buf)-1] != '\n')
213 error("line too long");
214
215 p = strchr(buf, '#');
216 if (p)
217 *p = '\0';
203 static char buf[MAXLINE];
204 static char *a[MAXTOKEN];
205
206 i = 0;
207
208 while (fgets(buf, sizeof(buf), ifp)) {
209
210 lineno += 1;
211
212 if (buf[strlen(buf)-1] != '\n')
213 error("line too long");
214
215 p = strchr(buf, '#');
216 if (p)
217 *p = '\0';
218
219 for (p = strtok(buf, ", \t\n"); p; p = strtok(NULL, ", \t\n"))
218 p = buf;
219rescan:
220 quote = strchr(p, '\"');
221 if (quote)
222 *quote = '\0';
223 for (p = strtok(p, ", \t\n"); p; p = strtok(NULL, ", \t\n"))
220 if (i < MAXTOKEN-1)
221 a[i++] = p;
222 else
223 error("too many tokens");
224 if (i < MAXTOKEN-1)
225 a[i++] = p;
226 else
227 error("too many tokens");
228 if (quote) {
229 quote++;
230 p = strchr(quote, '\"');
231 if (!p)
232 error("unterminated string constant");
233 else if (i < MAXTOKEN-1) {
234 a[i++] = quote;
235 *p = '\0';
236 p++;
237 }
238 else
239 error("too many tokens");
240 goto rescan;
241 }
224 if (i) {
225 *n = i;
226 return(a);
227 }
228 }
229 return(NULL);
230}
231

--- 356 unchanged lines hidden ---
242 if (i) {
243 *n = i;
244 return(a);
245 }
246 }
247 return(NULL);
248}
249

--- 356 unchanged lines hidden ---