annotate src/list.c @ 35:39d750ee8d34

Added error display and fixed infinite loop in lwasm_parse_line()
author lost
date Fri, 02 Jan 2009 06:07:10 +0000
parents 34568fab6058
children 2330b88f9600
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
57495da01900 Initial checking of LWASM
lost
parents:
diff changeset
1 /*
4
34568fab6058 Fixed package to include all required files; also added copyright preamble to all source files
lost
parents: 0
diff changeset
2 list.c
35
39d750ee8d34 Added error display and fixed infinite loop in lwasm_parse_line()
lost
parents: 4
diff changeset
3 Copyright © 2009 William Astle
4
34568fab6058 Fixed package to include all required files; also added copyright preamble to all source files
lost
parents: 0
diff changeset
4
34568fab6058 Fixed package to include all required files; also added copyright preamble to all source files
lost
parents: 0
diff changeset
5 This file is part of LWASM.
34568fab6058 Fixed package to include all required files; also added copyright preamble to all source files
lost
parents: 0
diff changeset
6
34568fab6058 Fixed package to include all required files; also added copyright preamble to all source files
lost
parents: 0
diff changeset
7 LWASM is free software: you can redistribute it and/or modify it under the
34568fab6058 Fixed package to include all required files; also added copyright preamble to all source files
lost
parents: 0
diff changeset
8 terms of the GNU General Public License as published by the Free Software
34568fab6058 Fixed package to include all required files; also added copyright preamble to all source files
lost
parents: 0
diff changeset
9 Foundation, either version 3 of the License, or (at your option) any later
34568fab6058 Fixed package to include all required files; also added copyright preamble to all source files
lost
parents: 0
diff changeset
10 version.
34568fab6058 Fixed package to include all required files; also added copyright preamble to all source files
lost
parents: 0
diff changeset
11
34568fab6058 Fixed package to include all required files; also added copyright preamble to all source files
lost
parents: 0
diff changeset
12 This program is distributed in the hope that it will be useful, but WITHOUT
34568fab6058 Fixed package to include all required files; also added copyright preamble to all source files
lost
parents: 0
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
34568fab6058 Fixed package to include all required files; also added copyright preamble to all source files
lost
parents: 0
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
34568fab6058 Fixed package to include all required files; also added copyright preamble to all source files
lost
parents: 0
diff changeset
15 more details.
34568fab6058 Fixed package to include all required files; also added copyright preamble to all source files
lost
parents: 0
diff changeset
16
34568fab6058 Fixed package to include all required files; also added copyright preamble to all source files
lost
parents: 0
diff changeset
17 You should have received a copy of the GNU General Public License along with
34568fab6058 Fixed package to include all required files; also added copyright preamble to all source files
lost
parents: 0
diff changeset
18 this program. If not, see <http://www.gnu.org/licenses/>.
34568fab6058 Fixed package to include all required files; also added copyright preamble to all source files
lost
parents: 0
diff changeset
19
35
39d750ee8d34 Added error display and fixed infinite loop in lwasm_parse_line()
lost
parents: 4
diff changeset
20 Contains code for displaying a program listings, etc.
4
34568fab6058 Fixed package to include all required files; also added copyright preamble to all source files
lost
parents: 0
diff changeset
21 */
0
57495da01900 Initial checking of LWASM
lost
parents:
diff changeset
22
35
39d750ee8d34 Added error display and fixed infinite loop in lwasm_parse_line()
lost
parents: 4
diff changeset
23 #define __list_c_seen__
39d750ee8d34 Added error display and fixed infinite loop in lwasm_parse_line()
lost
parents: 4
diff changeset
24
0
57495da01900 Initial checking of LWASM
lost
parents:
diff changeset
25 #include <stdio.h>
35
39d750ee8d34 Added error display and fixed infinite loop in lwasm_parse_line()
lost
parents: 4
diff changeset
26 #include <stdlib.h>
39d750ee8d34 Added error display and fixed infinite loop in lwasm_parse_line()
lost
parents: 4
diff changeset
27
0
57495da01900 Initial checking of LWASM
lost
parents:
diff changeset
28 #include "lwasm.h"
57495da01900 Initial checking of LWASM
lost
parents:
diff changeset
29
35
39d750ee8d34 Added error display and fixed infinite loop in lwasm_parse_line()
lost
parents: 4
diff changeset
30 void lwasm_show_errors(asmstate_t *as)
0
57495da01900 Initial checking of LWASM
lost
parents:
diff changeset
31 {
35
39d750ee8d34 Added error display and fixed infinite loop in lwasm_parse_line()
lost
parents: 4
diff changeset
32 lwasm_line_t *l;
39d750ee8d34 Added error display and fixed infinite loop in lwasm_parse_line()
lost
parents: 4
diff changeset
33 lwasm_error_t *e;
0
57495da01900 Initial checking of LWASM
lost
parents:
diff changeset
34
35
39d750ee8d34 Added error display and fixed infinite loop in lwasm_parse_line()
lost
parents: 4
diff changeset
35 for (l = as -> lineshead; l; l = l -> next)
0
57495da01900 Initial checking of LWASM
lost
parents:
diff changeset
36 {
35
39d750ee8d34 Added error display and fixed infinite loop in lwasm_parse_line()
lost
parents: 4
diff changeset
37 if (l -> err)
0
57495da01900 Initial checking of LWASM
lost
parents:
diff changeset
38 {
35
39d750ee8d34 Added error display and fixed infinite loop in lwasm_parse_line()
lost
parents: 4
diff changeset
39 for (e = l -> err; e; e = e -> next)
39d750ee8d34 Added error display and fixed infinite loop in lwasm_parse_line()
lost
parents: 4
diff changeset
40 {
39d750ee8d34 Added error display and fixed infinite loop in lwasm_parse_line()
lost
parents: 4
diff changeset
41 fprintf(stderr, "ERROR: %s\n", e -> mess);
39d750ee8d34 Added error display and fixed infinite loop in lwasm_parse_line()
lost
parents: 4
diff changeset
42 }
39d750ee8d34 Added error display and fixed infinite loop in lwasm_parse_line()
lost
parents: 4
diff changeset
43 fprintf(stderr, "%s\n", l -> text);
0
57495da01900 Initial checking of LWASM
lost
parents:
diff changeset
44 }
57495da01900 Initial checking of LWASM
lost
parents:
diff changeset
45 }
57495da01900 Initial checking of LWASM
lost
parents:
diff changeset
46 }
57495da01900 Initial checking of LWASM
lost
parents:
diff changeset
47
35
39d750ee8d34 Added error display and fixed infinite loop in lwasm_parse_line()
lost
parents: 4
diff changeset
48 void lwasm_list(asmstate_t *as)
39d750ee8d34 Added error display and fixed infinite loop in lwasm_parse_line()
lost
parents: 4
diff changeset
49 {
39d750ee8d34 Added error display and fixed infinite loop in lwasm_parse_line()
lost
parents: 4
diff changeset
50 lwasm_show_errors(as);
39d750ee8d34 Added error display and fixed infinite loop in lwasm_parse_line()
lost
parents: 4
diff changeset
51 }