view 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
line wrap: on
line source

/*
list.c
Copyright © 2009 William Astle

This file is part of LWASM.

LWASM is free software: you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any later
version.

This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.

You should have received a copy of the GNU General Public License along with
this program. If not, see <http://www.gnu.org/licenses/>.

Contains code for displaying a program listings, etc.
*/

#define __list_c_seen__

#include <stdio.h>
#include <stdlib.h>

#include "lwasm.h"

void lwasm_show_errors(asmstate_t *as)
{
	lwasm_line_t *l;
	lwasm_error_t *e;
	
	for (l = as -> lineshead; l; l = l -> next)
	{
		if (l -> err)
		{
			for (e = l -> err; e; e = e -> next)
			{
				fprintf(stderr, "ERROR: %s\n", e -> mess);
			}
			fprintf(stderr, "%s\n", l -> text);
		}
	}
}

void lwasm_list(asmstate_t *as)
{
	lwasm_show_errors(as);
}