OpenCores
URL https://opencores.org/ocsvn/open8_urisc/open8_urisc/trunk

Subversion Repositories open8_urisc

[/] [open8_urisc/] [trunk/] [Open8 Tools/] [open8_src/] [open8_as/] [pass_2.c] - Blame information for rev 178

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 178 jshamlet
 
2
#include <ctype.h>
3
#include <stdio.h>
4
#include <stdlib.h>
5
#include <string.h>
6
#include <time.h>
7
 
8
#include "defines.h"
9
#include "pass_1.h"
10
#include "pass_2.h"
11
#include "pass_4.h"
12
 
13
 
14
extern FILE *file_out_ptr;
15
extern int ind, inz, rambanks, rambanks_defined, ifdef;
16
extern int rombanks_defined, rombanks, cartridgetype, cartridgetype_defined;
17
extern int output_format, romgbc, romsgb, romdmg, max_address;
18
extern int romtype, verbose_mode, section_status, background_defined, memorymap_defined;
19
extern int emptyfill_defined, emptyfill, rombankmap_defined, section_id;
20
extern unsigned char *rom_banks, *rom_banks_usage_table;
21
 
22
char include_directives_name[] = "INCLUDE_DIRECTIVES:";
23
 
24
extern struct section_def *sections_first, *sections_last, *sec_tmp, *sec_next;
25
 
26
 
27
 
28
 
29
int pass_2(void) {
30
 
31
  if (ifdef > 0) {
32
    fprintf(stderr, "%x x .ENDIFs are missing.\n", ifdef);
33
    return FAILED;
34
  }
35
 
36
  if (verbose_mode == ON)
37
    printf("Directive checks...\n");
38
 
39
  if (section_status == ON) {
40
    fprintf(stderr, "%s The section \"%s\" was not closed.\n", include_directives_name, sections_last->name);
41
    return FAILED;
42
  }
43
 
44
  if (output_format != OUTPUT_LIBRARY && rombanks_defined == 0 && rombankmap_defined == 0) {
45
    fprintf(stderr, "%s ROMBANKS/ROMBANKMAP wasn't defined.\n", include_directives_name);
46
    return FAILED;
47
  }
48
 
49
  fclose(file_out_ptr);
50
  file_out_ptr = NULL;
51
 
52
  return SUCCEEDED;
53
}
54
 
55
 
56
int create_a_new_section_structure(void) {
57
 
58
    sec_tmp = malloc(sizeof(struct section_def));
59
    if (sec_tmp == NULL) {
60
      print_error("Out of memory while allocating room for a new SECTION.\n", ERROR_DIR);
61
      return FAILED;
62
    }
63
 
64
    sec_tmp->listfile_items = 0;
65
    sec_tmp->listfile_ints = NULL;
66
    sec_tmp->listfile_cmds = NULL;
67
    sec_tmp->maxsize_status = OFF;
68
    sec_tmp->data = NULL;
69
    sec_tmp->next = NULL;
70
    sec_tmp->id = section_id;
71
    sec_tmp->alive = ON;
72
    sec_tmp->advance_org = NO;
73
    section_id++;
74
    sec_tmp->filename_id = 0;
75
    sec_tmp->alignment = 1;
76
 
77
    if (sections_first == NULL) {
78
      sections_first = sec_tmp;
79
      sections_last = sec_tmp;
80
    }
81
    else {
82
      sections_last->next = sec_tmp;
83
      sections_last = sec_tmp;
84
    }
85
 
86
    return SUCCEEDED;
87
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.