Deleted Added
full compact
aicasm.c (24794) aicasm.c (26997)
1/*
2 * Aic7xxx SCSI host adapter firmware asssembler
3 *
4 * Copyright (c) 1997 Justin T. Gibbs.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
1/*
2 * Aic7xxx SCSI host adapter firmware asssembler
3 *
4 * Copyright (c) 1997 Justin T. Gibbs.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice immediately at the beginning of the file, without modification,
12 * this list of conditions, and the following disclaimer.
11 * notice, this list of conditions, and the following disclaimer,
12 * without modification, immediately at the beginning of the file.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. The name of the author may not be used to endorse or promote products
17 * derived from this software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
23 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE.
30 *
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. The name of the author may not be used to endorse or promote products
17 * derived from this software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
23 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE.
30 *
31 * $Id: aic7xxx_asm.c,v 1.16 1997/03/18 19:18:39 gibbs Exp $
31 * $Id: aic7xxx_asm.c,v 1.17 1997/04/10 19:13:07 gibbs Exp $
32 */
33#include <sys/types.h>
34#include <sys/mman.h>
35
36#include <stdio.h>
37#include <stdlib.h>
38#include <string.h>
39#include <sysexits.h>

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

51static struct patch *next_patch __P((struct patch *cur_patch, int options,
52 int instrptr));
53
54struct path_list search_path;
55int includes_search_curdir;
56char *appname;
57FILE *ofile;
58char *ofilename;
32 */
33#include <sys/types.h>
34#include <sys/mman.h>
35
36#include <stdio.h>
37#include <stdlib.h>
38#include <string.h>
39#include <sysexits.h>

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

51static struct patch *next_patch __P((struct patch *cur_patch, int options,
52 int instrptr));
53
54struct path_list search_path;
55int includes_search_curdir;
56char *appname;
57FILE *ofile;
58char *ofilename;
59char *regfilename;
60FILE *regfile;
61char *listfilename;
62FILE *listfile;
59
60static STAILQ_HEAD(,instruction) seq_program;
61static STAILQ_HEAD(, patch) patch_list;
62symlist_t patch_options;
63
64#if DEBUG
65extern int yy_flex_debug;
66extern int yydebug;

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

73 int argc;
74 char *argv[];
75{
76 extern char *optarg;
77 extern int optind;
78 int ch;
79 int retval;
80 char *inputfilename;
63
64static STAILQ_HEAD(,instruction) seq_program;
65static STAILQ_HEAD(, patch) patch_list;
66symlist_t patch_options;
67
68#if DEBUG
69extern int yy_flex_debug;
70extern int yydebug;

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

77 int argc;
78 char *argv[];
79{
80 extern char *optarg;
81 extern int optind;
82 int ch;
83 int retval;
84 char *inputfilename;
81 char *regfilename;
82 FILE *regfile;
83 char *listfilename;
84 FILE *listfile;
85 char *options;
86
87 SLIST_INIT(&search_path);
88 STAILQ_INIT(&seq_program);
89 STAILQ_INIT(&patch_list);
90 SLIST_INIT(&patch_options);
91 includes_search_curdir = 1;
92 appname = *argv;
93 regfile = NULL;
94 listfile = NULL;
95 options = NULL;
96#if DEBUG
97 yy_flex_debug = 0;
98#endif
99 while ((ch = getopt(argc, argv, "d:l:n:o:r:I:O:")) != -1) {
100 switch(ch) {
101 case 'd':
102#if DEBUG
85 char *options;
86
87 SLIST_INIT(&search_path);
88 STAILQ_INIT(&seq_program);
89 STAILQ_INIT(&patch_list);
90 SLIST_INIT(&patch_options);
91 includes_search_curdir = 1;
92 appname = *argv;
93 regfile = NULL;
94 listfile = NULL;
95 options = NULL;
96#if DEBUG
97 yy_flex_debug = 0;
98#endif
99 while ((ch = getopt(argc, argv, "d:l:n:o:r:I:O:")) != -1) {
100 switch(ch) {
101 case 'd':
102#if DEBUG
103 if (strcmp(optarg, "s") == 0)
103 if (strcmp(optarg, "s") == 0) {
104 yy_flex_debug = 1;
104 yy_flex_debug = 1;
105 else if (strcmp(optarg, "p") == 0)
105 } else if (strcmp(optarg, "p") == 0) {
106 yydebug = 1;
106 yydebug = 1;
107 } else {
108 fprintf(stderr, "%s: -d Requires either an "
109 "'s' or 'p' argument\n", appname);
110 usage();
111 }
107#else
108 stop("-d: Assembler not built with debugging "
109 "information", EX_SOFTWARE);
110#endif
111 break;
112 case 'l':
113 /* Create a program listing */
114 if ((listfile = fopen(optarg, "w")) == NULL) {

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

443 fclose(ofile);
444 if (err_code != 0) {
445 fprintf(stderr, "%s: Removing %s due to error\n",
446 appname, ofilename);
447 unlink(ofilename);
448 }
449 }
450
112#else
113 stop("-d: Assembler not built with debugging "
114 "information", EX_SOFTWARE);
115#endif
116 break;
117 case 'l':
118 /* Create a program listing */
119 if ((listfile = fopen(optarg, "w")) == NULL) {

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

448 fclose(ofile);
449 if (err_code != 0) {
450 fprintf(stderr, "%s: Removing %s due to error\n",
451 appname, ofilename);
452 unlink(ofilename);
453 }
454 }
455
456 if (regfile != NULL) {
457 fclose(regfile);
458 if (err_code != 0) {
459 fprintf(stderr, "%s: Removing %s due to error\n",
460 appname, regfilename);
461 unlink(regfilename);
462 }
463 }
464
465 if (listfile != NULL) {
466 fclose(listfile);
467 if (err_code != 0) {
468 fprintf(stderr, "%s: Removing %s due to error\n",
469 appname, listfilename);
470 unlink(listfilename);
471 }
472 }
473
451 symlist_free(&patch_options);
452 symtable_close();
453
454 exit(err_code);
455}
456
457struct instruction *
458seq_alloc()

--- 24 unchanged lines hidden ---
474 symlist_free(&patch_options);
475 symtable_close();
476
477 exit(err_code);
478}
479
480struct instruction *
481seq_alloc()

--- 24 unchanged lines hidden ---