Example #1
0
void old_gbc(int n, int a) {
	int i, s;
	CELLP *sp1;
	DWORD start_time, end_time;
	counter_old_gbc_cell++;
	timeBeginPeriod(1);
	start_time = timeGetTime();
	if(n) {
		counter_old_gbc_num++;
	}
	if(a) {
		counter_old_gbc_atom++;
	}
//printf("=%d= ", __LINE__);
	if(verbose) {
		if(n & a) {
			fprintf(stdout, "\n[You surprised OLDGBC.]\n");
		}
		else {
			fprintf(stdout, "\n[OLDGBC surprised You.]\n");
		}
	}
//printf("\n%d-->", __LINE__);getchar();
	if(verbose) {
		fprintf(stdout, "[OLDGC Marking oblist start.]\n");
	}
	for(i = 0; i < TABLESIZ; ++i) {
		mark(oblist[i], n);
	}
	if(verbose) {
		fprintf(stdout, "[OLDGC Marking oblist end.]\n");
	}
	if(verbose) {
		fprintf(stdout, "[OLDGC Marking stack start.]\n");
	}
	for(sp1 = stacktop; sp1 <= sp; ++sp1) {
		mark(*sp1, n);
	}
	if(verbose) {
		fprintf(stdout, "[OLDGC Marking stack end.]\n");

		fprintf(stdout, "[OLDGC Marking AUX start.]\n");
	}
	old_gc_aux(n);
	if(verbose) {
		fprintf(stdout, "[OLDGC Marking AUX end.]\n");

		fprintf(stdout, "[OLDGC Collectiong Cell start.]\n");
	}
	i = col_cell(); //ec;//N//
	if(verbose) {
		fprintf(stdout, "[OLDGC Collectiong Cell end.]\n");
	}
	rem_mark_cell();

	if(n) {
		if(verbose) {
			fprintf(stdout, "[OLDGC Collectiong Num start.]\n");
		}
		n = col_num(); //ec;//N//
		if(verbose) {
			fprintf(stdout, "[OLDGC Collectiong Num end.]\n");
		}
	}
	rem_mark_num();
	end_time = timeGetTime();
	gc_time += (end_time - start_time);
	if(a) {
		//     fprintf(stdout, "[OLDGC Collectiong Str start.]\n");
		//	  s = col_str();
		//     fprintf(stdout, "[OLDGC Collectiong Str end.]\n");
		if(verbose) {
			fprintf(stdout, "[OLDGC Collectiong Atom start.]\n");
		}
		a = col_atom(); //ec;//N//
		if(verbose) {
			fprintf(stdout, "[OLDGC Collectiong Atom end.]\n");
		}
	}
	rem_mark_atom();

	if(verbose) {
		fprintf(stdout, "===== OLDGBC infomation ======\n");
		fprintf(stdout, "[OLDGC Cell Counter: %d]\n",counter_old_gbc_cell);
		fprintf(stdout, "\tfree cell %d\n", i);
		if(n) {
			fprintf(stdout,"[OLDGC Num Counter: %d]\n",counter_old_gbc_num);
			fprintf(stdout, "\tfree num = %d\n", n);
		}
		if(a) {
			fprintf(stdout,"[OLDGC Atom Counter: %d]\n",counter_old_gbc_atom);
			fprintf(stdout, "\tfree atom = %d\n", a);
			fprintf(stdout, "\tfree str = %d\n", s);
		}
	}
	//fprintf(stdout,"[OLDGC Finished]\n");
//printf("\n%d-->", __LINE__);getchar();

//printf("=%d= ", __LINE__);
	return;
}
Example #2
0
 bool cell::is_neighbor( const cell* C ) const {
     return ( row_num() == C->row_num() )
         || ( col_num() == C->col_num() );
 }