Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/RenderSystems/GL/src/nvparse/nvparse_errors.cpp @ 1

Last change on this file since 1 was 1, checked in by landauf, 17 years ago
File size: 880 bytes
Line 
1#include <stdlib.h>
2#include <stdio.h>
3#include <string.h>
4
5#include "nvparse_errors.h"
6
7
8
9nvparse_errors::nvparse_errors()
10{
11        num_errors = 0;
12        reset();
13}
14
15nvparse_errors::~nvparse_errors()
16{
17        reset();
18}
19
20
21void nvparse_errors::reset()
22{
23        for(int i=0; i < num_errors; i++)
24            free(elist[i]);//FIXME detail_nmap something is writing 0x2 to elist[1] blah!
25        for(int j=0; j <= NVPARSE_MAX_ERRORS; j++)
26                elist[j] = 0;
27        num_errors = 0;
28}
29
30void nvparse_errors::set(const char * e)
31{
32        if(num_errors < NVPARSE_MAX_ERRORS)
33                elist[num_errors++] = strdup(e);
34}
35
36void nvparse_errors::set(const char * e, int line_number)
37{
38        char buff[256];
39        sprintf(buff, "error on line %d: %s", line_number, e);
40        if(num_errors < NVPARSE_MAX_ERRORS)
41                elist[num_errors++] = strdup(buff);
42}
43
44char * const * const nvparse_errors::get_errors()
45{
46        return elist;
47}
Note: See TracBrowser for help on using the repository browser.