diff options
| author | lukem <lukem@NetBSD.org> | 2002-06-02 01:20:36 +0000 |
|---|---|---|
| committer | lukem <lukem@NetBSD.org> | 2002-06-02 01:20:36 +0000 |
| commit | 7026bf4ede84d96c22970f5ae906c5b2992a3644 (patch) | |
| tree | da90c11f910ff55664028e8378902e475f9f6faf /sys/dev/microcode | |
| parent | 310f799ea70d09177b8d01924752c17d77b84225 (diff) | |
Use SLIST_*() instead of accessing slh_first,sle_next directly.
XXX: this program currently doesn't parse macros that cross the EOL with \
(there are a couple in sys/dev/scsipi/scsi_message.h).
with that issue temporarily worked around, this change generates the
same output as the version of aicasm without this change.
Diffstat (limited to 'sys/dev/microcode')
| -rw-r--r-- | sys/dev/microcode/aic7xxx/aicasm_gram.y | 11 | ||||
| -rw-r--r-- | sys/dev/microcode/aic7xxx/aicasm_scan.l | 8 | ||||
| -rw-r--r-- | sys/dev/microcode/aic7xxx/aicasm_symbol.c | 42 |
3 files changed, 29 insertions, 32 deletions
diff --git a/sys/dev/microcode/aic7xxx/aicasm_gram.y b/sys/dev/microcode/aic7xxx/aicasm_gram.y index e34460a30f2..6898f3d2358 100644 --- a/sys/dev/microcode/aic7xxx/aicasm_gram.y +++ b/sys/dev/microcode/aic7xxx/aicasm_gram.y @@ -1,5 +1,5 @@ %{ -/* $NetBSD: aicasm_gram.y,v 1.1 2000/03/15 02:09:13 fvdl Exp $ */ +/* $NetBSD: aicasm_gram.y,v 1.2 2002/06/02 01:20:36 lukem Exp $ */ /* * Parser for the Aic7xxx SCSI Host adapter sequencer assembler. @@ -1328,9 +1328,7 @@ type_check(symbol, expression, opcode) * expression are defined for this register. */ if(symbol->info.rinfo->typecheck_masks != FALSE) { - for(node = expression->referenced_syms.slh_first; - node != NULL; - node = node->links.sle_next) { + SLIST_FOREACH(node, &expression->referenced_syms, links) { if ((node->symbol->type == MASK || node->symbol->type == BIT) && symlist_search(&node->symbol->info.minfo->symrefs, @@ -1404,8 +1402,9 @@ static int is_download_const(immed) expression_t *immed; { - if ((immed->referenced_syms.slh_first != NULL) - && (immed->referenced_syms.slh_first->symbol->type == DOWNLOAD_CONST)) + if (! SLIST_EMPTY(&immed->referenced_syms) + && (SLIST_FIRST(&immed->referenced_syms)->symbol->type == + DOWNLOAD_CONST)) return (TRUE); return (FALSE); diff --git a/sys/dev/microcode/aic7xxx/aicasm_scan.l b/sys/dev/microcode/aic7xxx/aicasm_scan.l index 0c10bab0046..41092fa8a82 100644 --- a/sys/dev/microcode/aic7xxx/aicasm_scan.l +++ b/sys/dev/microcode/aic7xxx/aicasm_scan.l @@ -1,5 +1,5 @@ %{ -/* $NetBSD: aicasm_scan.l,v 1.1 2000/03/15 02:09:14 fvdl Exp $ */ +/* $NetBSD: aicasm_scan.l,v 1.2 2002/06/02 01:20:36 lukem Exp $ */ /* * Lexical Analyzer for the Aic7xxx SCSI Host adapter sequencer assembler. @@ -226,9 +226,7 @@ include_file(file_name, type) if (newfile == NULL && type != SOURCE_FILE) { path_entry_t include_dir; - for (include_dir = search_path.slh_first; - include_dir != NULL; - include_dir = include_dir->links.sle_next) { + SLIST_FOREACH(include_dir, &search_path, links) { char fullname[PATH_MAX]; if ((include_dir->quoted_includes_only == TRUE) @@ -276,7 +274,7 @@ yywrap() if (yyfilename != NULL) free(yyfilename); yyfilename = NULL; - include = include_stack.slh_first; + include = SLIST_FIRST(&include_stack); if (include != NULL) { yy_switch_to_buffer(include->buffer); yylineno = include->lineno; diff --git a/sys/dev/microcode/aic7xxx/aicasm_symbol.c b/sys/dev/microcode/aic7xxx/aicasm_symbol.c index 405a3a1bc5f..10f89bb0eb8 100644 --- a/sys/dev/microcode/aic7xxx/aicasm_symbol.c +++ b/sys/dev/microcode/aic7xxx/aicasm_symbol.c @@ -1,4 +1,4 @@ -/* $NetBSD: aicasm_symbol.c,v 1.1 2000/03/15 02:09:14 fvdl Exp $ */ +/* $NetBSD: aicasm_symbol.c,v 1.2 2002/06/02 01:20:36 lukem Exp $ */ /* * Aic7xxx SCSI host adapter firmware asssembler symbol table implementation @@ -190,11 +190,11 @@ symlist_search(symlist, symname) { symbol_node_t *curnode; - curnode = symlist->slh_first; + curnode = SLIST_FIRST(symlist); while(curnode != NULL) { if (strcmp(symname, curnode->symbol->name) == 0) break; - curnode = curnode->links.sle_next; + curnode = SLIST_NEXT(curnode, links); } return (curnode); } @@ -233,7 +233,7 @@ symlist_add(symlist, symbol, how) /* NOTREACHED */ } - curnode = symlist->slh_first; + curnode = SLIST_FIRST(symlist); if (curnode == NULL || (mask && (curnode->symbol->info.minfo->mask > newnode->symbol->info.minfo->mask)) @@ -244,14 +244,14 @@ symlist_add(symlist, symbol, how) } while (1) { - if (curnode->links.sle_next == NULL) { + if (SLIST_NEXT(curnode, links) == NULL) { SLIST_INSERT_AFTER(curnode, newnode, links); break; } else { symbol_t *cursymbol; - cursymbol = curnode->links.sle_next->symbol; + cursymbol = SLIST_NEXT(curnode, links)->symbol; if ((mask && (cursymbol->info.minfo->mask > symbol->info.minfo->mask)) || (!mask &&(cursymbol->info.rinfo->address > @@ -261,7 +261,7 @@ symlist_add(symlist, symbol, how) break; } } - curnode = curnode->links.sle_next; + curnode = SLIST_NEXT(curnode, links); } } else { SLIST_INSERT_HEAD(symlist, newnode, links); @@ -274,9 +274,9 @@ symlist_free(symlist) { symbol_node_t *node1, *node2; - node1 = symlist->slh_first; + node1 = SLIST_FIRST(symlist); while (node1 != NULL) { - node2 = node1->links.sle_next; + node2 = SLIST_NEXT(node1, links); free(node1); node1 = node2; } @@ -292,7 +292,7 @@ symlist_merge(symlist_dest, symlist_src1, symlist_src2) symbol_node_t *node; *symlist_dest = *symlist_src1; - while((node = symlist_src2->slh_first) != NULL) { + while((node = SLIST_FIRST(symlist_src2)) != NULL) { SLIST_REMOVE_HEAD(symlist_src2, links); SLIST_INSERT_HEAD(symlist_dest, node, links); } @@ -363,28 +363,28 @@ symtable_dump(ofile) } /* Put in the masks and bits */ - while (masks.slh_first != NULL) { + while (! SLIST_EMPTY(&masks)) { symbol_node_t *curnode; symbol_node_t *regnode; char *regname; - curnode = masks.slh_first; + curnode = SLIST_FIRST(&masks); SLIST_REMOVE_HEAD(&masks, links); regnode = - curnode->symbol->info.minfo->symrefs.slh_first; + SLIST_FIRST(&curnode->symbol->info.minfo->symrefs); regname = regnode->symbol->name; regnode = symlist_search(®isters, regname); SLIST_INSERT_AFTER(regnode, curnode, links); } /* Add the aliases */ - while (aliases.slh_first != NULL) { + while (! SLIST_EMPTY(&aliases)) { symbol_node_t *curnode; symbol_node_t *regnode; char *regname; - curnode = aliases.slh_first; + curnode = SLIST_FIRST(&aliases); SLIST_REMOVE_HEAD(&aliases, links); regname = curnode->symbol->info.ainfo->parent->name; @@ -397,13 +397,13 @@ symtable_dump(ofile) "/* * DO NOT EDIT - This file is automatically generated. */\n"); - while (registers.slh_first != NULL) { + while (! SLIST_EMPTY(®isters)) { symbol_node_t *curnode; u_int8_t value; char *tab_str; char *tab_str2; - curnode = registers.slh_first; + curnode = SLIST_FIRST(®isters); SLIST_REMOVE_HEAD(®isters, links); switch(curnode->symbol->type) { case REGISTER: @@ -445,10 +445,10 @@ symtable_dump(ofile) } fprintf(ofile, "\n\n"); - while (constants.slh_first != NULL) { + while (! SLIST_EMPTY(&constants)) { symbol_node_t *curnode; - curnode = constants.slh_first; + curnode = SLIST_FIRST(&constants); SLIST_REMOVE_HEAD(&constants, links); fprintf(ofile, "#define\t%-8s\t0x%02x\n", curnode->symbol->name, @@ -459,10 +459,10 @@ symtable_dump(ofile) fprintf(ofile, "\n\n/* Downloaded Constant Definitions */\n"); - while (download_constants.slh_first != NULL) { + while (! SLIST_EMPTY(&download_constants)) { symbol_node_t *curnode; - curnode = download_constants.slh_first; + curnode = SLIST_FIRST(&download_constants); SLIST_REMOVE_HEAD(&download_constants, links); fprintf(ofile, "#define\t%-8s\t0x%02x\n", curnode->symbol->name, |
