Beispiel #1
0
/**
 * Iterates through the symbol table and prints its elements in no particular
 * order.
 * @param sym_table Address to the symbol table
 */
void asmPrintSymTable(Map *sym_table){
    MapIter i = mapBegin(sym_table);
    printf("[Symbol table]\n"
           "Label: address\n");
    while (i.n){
        const char *label = miKey(&i);
        const int *addr = miData(&i);
        printf("%s: %d\n", label, *addr);
        mapNext(sym_table, &i);
    }
}
Beispiel #2
0
void asmOutputSymTable(Map *sym_table, FILE *out){
    MapIter i = mapBegin(sym_table);
    fprintf(out, "%s\n", linker_sym_table_begin);
    while (i.n){
        const char *label = miKey(&i);
        const int *addr = miData(&i);
        fprintf(out, "%s %d\n", label, *addr);
        mapNext(sym_table, &i);
    }
    fprintf(out, "%s\n", linker_sym_table_end);
}
Beispiel #3
0
bool ConvertBase::convert()
{
	if(!setMap()) {
		return false;
	}

	m_io->text().clear();
	do {
		m_io->nextLine();
		int i = 0;
		while(i < m_io->currentLine().length()) {
			m_io->text() += mapNext(i);
		}
		if(!m_io->done()) {
			m_io->text() += '\n';
		}
	}
	while(!m_io->done());

	m_io->writeText();
	return true;
}