summaryrefslogblamecommitdiffstats
path: root/src/state.c
blob: 33025b6000afc857f4fbf87043b305d76b9f43dc (plain) (tree)
1
2
3
4
5
6
7
8
9








                                         
                      
                        
                           
                             
                           

                                                                             



                                         


                             


                                      


                                    


                                             
 

                               
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif

#include "state.h"


void ccmmc_state_init (CcmmcState *state)
{
    state->ast = NULL;
    state->table = NULL;
    state->line_number = 1;
    state->asm_output = NULL;
    state->reg_pool = NULL;
    // XXX: TA's broken toolchain prevent this number from starting from zero
    state->label_number = 3;
}

void ccmmc_state_fini (CcmmcState *state)
{
    if (state->ast != NULL) {
        // TODO: Free the AST
    }
    if (state->table != NULL) {
        // TODO: Free the symbol table
    }
    if (state->asm_output != NULL) {
        fclose(state->asm_output);
    }
    if (state->reg_pool != NULL) {
        ccmmc_register_fini(state->reg_pool);
    }
}

// vim: set sw=4 ts=4 sts=4 et: