summaryrefslogtreecommitdiffstats
path: root/sys/dev/aic7xxx/aicasm
diff options
context:
space:
mode:
authorgibbs <gibbs@FreeBSD.org>1997-06-27 19:38:56 +0000
committergibbs <gibbs@FreeBSD.org>1997-06-27 19:38:56 +0000
commit7ebb73022cd781d8b3686ece97684d4d13d0bf73 (patch)
tree3520df5b44f8c12505137f83d8c6144327ccc685 /sys/dev/aic7xxx/aicasm
parent8023e6ade65c4a8413c51356b0f530bb3ecab092 (diff)
downloadFreeBSD-src-7ebb73022cd781d8b3686ece97684d4d13d0bf73.zip
FreeBSD-src-7ebb73022cd781d8b3686ece97684d4d13d0bf73.tar.gz
Modify my copyright notice to allow the sequencer to be used with GPLed
software (aka Linux). Fix a few bugs in the sequencer assembler. Make it easy to compiler the assembler with debugging turned on.
Diffstat (limited to 'sys/dev/aic7xxx/aicasm')
-rw-r--r--sys/dev/aic7xxx/aicasm/aicasm.c41
-rw-r--r--sys/dev/aic7xxx/aicasm/aicasm.h6
-rw-r--r--sys/dev/aic7xxx/aicasm/aicasm_gram.y6
-rw-r--r--sys/dev/aic7xxx/aicasm/aicasm_scan.l27
-rw-r--r--sys/dev/aic7xxx/aicasm/aicasm_symbol.c6
-rw-r--r--sys/dev/aic7xxx/aicasm/aicasm_symbol.h6
6 files changed, 60 insertions, 32 deletions
diff --git a/sys/dev/aic7xxx/aicasm/aicasm.c b/sys/dev/aic7xxx/aicasm/aicasm.c
index 9e3e4e1..63908ce 100644
--- a/sys/dev/aic7xxx/aicasm/aicasm.c
+++ b/sys/dev/aic7xxx/aicasm/aicasm.c
@@ -8,8 +8,8 @@
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
- * notice immediately at the beginning of the file, without modification,
- * this list of conditions, and the following disclaimer.
+ * notice, this list of conditions, and the following disclaimer,
+ * without modification, immediately at the beginning of the file.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
@@ -28,7 +28,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: aic7xxx_asm.c,v 1.16 1997/03/18 19:18:39 gibbs Exp $
+ * $Id: aic7xxx_asm.c,v 1.17 1997/04/10 19:13:07 gibbs Exp $
*/
#include <sys/types.h>
#include <sys/mman.h>
@@ -56,6 +56,10 @@ int includes_search_curdir;
char *appname;
FILE *ofile;
char *ofilename;
+char *regfilename;
+FILE *regfile;
+char *listfilename;
+FILE *listfile;
static STAILQ_HEAD(,instruction) seq_program;
static STAILQ_HEAD(, patch) patch_list;
@@ -78,10 +82,6 @@ main(argc, argv)
int ch;
int retval;
char *inputfilename;
- char *regfilename;
- FILE *regfile;
- char *listfilename;
- FILE *listfile;
char *options;
SLIST_INIT(&search_path);
@@ -100,10 +100,15 @@ main(argc, argv)
switch(ch) {
case 'd':
#if DEBUG
- if (strcmp(optarg, "s") == 0)
+ if (strcmp(optarg, "s") == 0) {
yy_flex_debug = 1;
- else if (strcmp(optarg, "p") == 0)
+ } else if (strcmp(optarg, "p") == 0) {
yydebug = 1;
+ } else {
+ fprintf(stderr, "%s: -d Requires either an "
+ "'s' or 'p' argument\n", appname);
+ usage();
+ }
#else
stop("-d: Assembler not built with debugging "
"information", EX_SOFTWARE);
@@ -448,6 +453,24 @@ stop(string, err_code)
}
}
+ if (regfile != NULL) {
+ fclose(regfile);
+ if (err_code != 0) {
+ fprintf(stderr, "%s: Removing %s due to error\n",
+ appname, regfilename);
+ unlink(regfilename);
+ }
+ }
+
+ if (listfile != NULL) {
+ fclose(listfile);
+ if (err_code != 0) {
+ fprintf(stderr, "%s: Removing %s due to error\n",
+ appname, listfilename);
+ unlink(listfilename);
+ }
+ }
+
symlist_free(&patch_options);
symtable_close();
diff --git a/sys/dev/aic7xxx/aicasm/aicasm.h b/sys/dev/aic7xxx/aicasm/aicasm.h
index f92fc77..a81afc1 100644
--- a/sys/dev/aic7xxx/aicasm/aicasm.h
+++ b/sys/dev/aic7xxx/aicasm/aicasm.h
@@ -8,8 +8,8 @@
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
- * notice immediately at the beginning of the file, without modification,
- * this list of conditions, and the following disclaimer.
+ * notice, this list of conditions, and the following disclaimer,
+ * without modification, immediately at the beginning of the file.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
@@ -28,7 +28,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: aic7xxx_asm.h,v 1.1.2.1 1997/03/16 07:21:32 gibbs Exp $
+ * $Id: aic7xxx_asm.h,v 1.2 1997/03/16 07:28:30 gibbs Exp $
*/
#include <sys/queue.h>
diff --git a/sys/dev/aic7xxx/aicasm/aicasm_gram.y b/sys/dev/aic7xxx/aicasm/aicasm_gram.y
index 0c75edc..6f9b4e2 100644
--- a/sys/dev/aic7xxx/aicasm/aicasm_gram.y
+++ b/sys/dev/aic7xxx/aicasm/aicasm_gram.y
@@ -9,8 +9,8 @@
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
- * notice immediately at the beginning of the file, without modification,
- * this list of conditions, and the following disclaimer.
+ * notice, this list of conditions, and the following disclaimer,
+ * without modification, immediately at the beginning of the file.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
@@ -29,7 +29,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id$
+ * $Id: gram.y,v 1.1 1997/03/16 07:08:16 gibbs Exp $
*/
#include <stdio.h>
diff --git a/sys/dev/aic7xxx/aicasm/aicasm_scan.l b/sys/dev/aic7xxx/aicasm/aicasm_scan.l
index ec4535c..dcd7d88 100644
--- a/sys/dev/aic7xxx/aicasm/aicasm_scan.l
+++ b/sys/dev/aic7xxx/aicasm/aicasm_scan.l
@@ -9,8 +9,8 @@
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
- * notice immediately at the beginning of the file, without modification,
- * this list of conditions, and the following disclaimer.
+ * notice, this list of conditions, and the following disclaimer,
+ * without modification, immediately at the beginning of the file.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
@@ -29,7 +29,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: scan.l,v 1.1 1997/03/16 07:08:17 gibbs Exp $
+ * $Id: scan.l,v 1.2 1997/03/16 17:31:59 bde Exp $
*/
#include <sys/types.h>
@@ -208,15 +208,19 @@ include_file(file_name, type)
stop("Unable to open input file", EX_SOFTWARE);
/* NOTREACHED */
}
- include = (include_t *)malloc(sizeof(include_t));
- if (include == NULL) {
- stop("Unable to allocate include stack entry", EX_SOFTWARE);
- /* NOTREACHED */
+
+ if (type != SOURCE_FILE) {
+ include = (include_t *)malloc(sizeof(include_t));
+ if (include == NULL) {
+ stop("Unable to allocate include stack entry",
+ EX_SOFTWARE);
+ /* NOTREACHED */
+ }
+ include->buffer = YY_CURRENT_BUFFER;
+ include->lineno = yylineno;
+ include->filename = yyfilename;
+ SLIST_INSERT_HEAD(&include_stack, include, links);
}
- include->buffer = YY_CURRENT_BUFFER;
- include->lineno = yylineno;
- include->filename = yyfilename;
- SLIST_INSERT_HEAD(&include_stack, include, links);
yy_switch_to_buffer(yy_create_buffer(newfile, YY_BUF_SIZE));
yylineno = 1;
yyfilename = strdup(file_name);
@@ -231,6 +235,7 @@ yywrap()
(void)fclose(yyin);
if (yyfilename != NULL)
free(yyfilename);
+ yyfilename = NULL;
include = include_stack.slh_first;
if (include != NULL) {
yy_switch_to_buffer(include->buffer);
diff --git a/sys/dev/aic7xxx/aicasm/aicasm_symbol.c b/sys/dev/aic7xxx/aicasm/aicasm_symbol.c
index e2b93ef..d6b194e 100644
--- a/sys/dev/aic7xxx/aicasm/aicasm_symbol.c
+++ b/sys/dev/aic7xxx/aicasm/aicasm_symbol.c
@@ -8,8 +8,8 @@
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
- * notice immediately at the beginning of the file, without modification,
- * this list of conditions, and the following disclaimer.
+ * notice, this list of conditions, and the following disclaimer,
+ * without modification, immediately at the beginning of the file.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
@@ -28,7 +28,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id$
+ * $Id: symbol.c,v 1.1 1997/03/16 07:08:18 gibbs Exp $
*/
diff --git a/sys/dev/aic7xxx/aicasm/aicasm_symbol.h b/sys/dev/aic7xxx/aicasm/aicasm_symbol.h
index cf8fa00..485cf6c 100644
--- a/sys/dev/aic7xxx/aicasm/aicasm_symbol.h
+++ b/sys/dev/aic7xxx/aicasm/aicasm_symbol.h
@@ -8,8 +8,8 @@
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
- * notice immediately at the beginning of the file, without modification,
- * this list of conditions, and the following disclaimer.
+ * notice, this list of conditions, and the following disclaimer,
+ * without modification, immediately at the beginning of the file.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
@@ -28,7 +28,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id$
+ * $Id: symbol.h,v 1.1 1997/03/16 07:08:19 gibbs Exp $
*/
#include <sys/queue.h>
OpenPOWER on IntegriCloud