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] - Rev 295

Go to most recent revision | Compare with Previous | Blame | View Log

 
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
 
#include "defines.h"
#include "pass_1.h"
#include "pass_2.h"
#include "pass_4.h"
 
 
extern FILE *file_out_ptr;
extern int ind, inz, rambanks, rambanks_defined, ifdef;
extern int rombanks_defined, rombanks, cartridgetype, cartridgetype_defined;
extern int output_format, romgbc, romsgb, romdmg, max_address;
extern int romtype, verbose_mode, section_status, background_defined, memorymap_defined;
extern int emptyfill_defined, emptyfill, rombankmap_defined, section_id;
extern unsigned char *rom_banks, *rom_banks_usage_table;
 
char include_directives_name[] = "INCLUDE_DIRECTIVES:";
 
extern struct section_def *sections_first, *sections_last, *sec_tmp, *sec_next;
 
 
 
 
int pass_2(void) {
 
  if (ifdef > 0) {
    fprintf(stderr, "%x x .ENDIFs are missing.\n", ifdef);
    return FAILED;
  }
 
  if (verbose_mode == ON)
    printf("Directive checks...\n");
 
  if (section_status == ON) {
    fprintf(stderr, "%s The section \"%s\" was not closed.\n", include_directives_name, sections_last->name);
    return FAILED;
  }
 
  if (output_format != OUTPUT_LIBRARY && rombanks_defined == 0 && rombankmap_defined == 0) {
    fprintf(stderr, "%s ROMBANKS/ROMBANKMAP wasn't defined.\n", include_directives_name);
    return FAILED;
  }
 
  fclose(file_out_ptr);
  file_out_ptr = NULL;
 
  return SUCCEEDED;
}
 
 
int create_a_new_section_structure(void) {
 
    sec_tmp = malloc(sizeof(struct section_def));
    if (sec_tmp == NULL) {
      print_error("Out of memory while allocating room for a new SECTION.\n", ERROR_DIR);
      return FAILED;
    }
 
    sec_tmp->listfile_items = 0;
    sec_tmp->listfile_ints = NULL;
    sec_tmp->listfile_cmds = NULL;
    sec_tmp->maxsize_status = OFF;
    sec_tmp->data = NULL;
    sec_tmp->next = NULL;
    sec_tmp->id = section_id;
    sec_tmp->alive = ON;
    sec_tmp->advance_org = NO;
    section_id++;
    sec_tmp->filename_id = 0;
    sec_tmp->alignment = 1;
 
    if (sections_first == NULL) {
      sections_first = sec_tmp;
      sections_last = sec_tmp;
    }
    else {
      sections_last->next = sec_tmp;
      sections_last = sec_tmp;
    }
 
    return SUCCEEDED;
}
 

Go to most recent revision | Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

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