Esempio n. 1
0
int findRomsInDir(bool force)
{
	if ( force && pRom_ent ) {
		free( pRom_ent );
		pRom_ent = NULL;
	}
	if ( pRom_ent ) return rom_count;
	rom_count = findloop( NULL );	
	if ( rom_count ) {
		pRom_ent = (ROM_FILE_ENT *) malloc ( rom_count * sizeof(ROM_FILE_ENT) );
		if (!pRom_ent) {
			rom_count = 0;
			return 0; // error alloc memory
		}
		rom_count = findloop( pRom_ent );
	}
	return rom_count;
}
Esempio n. 2
0
/**
 * "continue" statement
 */
docont() {
        loop_t *ptr;

        if ((ptr = findloop ()) == 0)
                return;
        gen_modify_stack (ptr->stack_pointer);
        if (ptr->type == WSFOR)
                gen_jump (ptr->cont_label);
        else
                gen_jump (ptr->test_label);
}
Esempio n. 3
0
File: tsort.c Progetto: 8l/FUZIX
/*	the first for loop reads in the graph,
 *	the second prints out the ordering
*/
int main(int argc, const char *argv[])
{
	register struct predlist *t;
	FILE *input = stdin;
	register struct nodelist *i, *j;
	int x;
	char precedes[50], follows[50];
	if (argc > 1) {
		input = fopen(argv[1], "r");
		if (input == NULL)
			error("cannot open ", argv[1]);
	}
	for (;;) {
		x = fscanf(input, "%s%s", precedes, follows);
		if (x == EOF)
			break;
		if (x != 2)
			error("odd data", empty);
		i = stringindex(precedes);
		j = stringindex(follows);
		if (i == j || present(i, j))
			continue;
		t = (struct predlist *) malloc(sizeof(struct predlist));
		t->nextpred = j->inedges;
		t->pred = i;
		j->inedges = t;
	}
	for (;;) {
		x = 0;		/*anything LIVE on this sweep? */
		for (i = &firstnode; i->nextnode != NULL; i = i->nextnode) {
			if (i->live == LIVE) {
				x = 1;
				if (!anypred(i))
					break;
			}
		}
		if (x == 0)
			break;
		if (i->nextnode == NULL)
			i = findloop();
		printf("%s\n", i->name);
		i->live = DEAD;
	}
}