Example #1
0
File: image.c Project: edisonqkj/c
/// paint
void Paint(int x, int y, int color){
	printf("Position: (%d,%d)\n",x,y);
	printf("Repaint color %d to %d\n",image[y-1][x-1],color);
	pIntStack stack=(pIntStack)malloc(sizeof(IntStack));
	IntInit(stack);
	/// push start point
	IntPush(stack,x-1);
	IntPush(stack,y-1);
	Iteration(stack,image[y-1][x-1],color);
}
Example #2
0
int main(void){
		IntInit();
		init_leds();
	     DoUndef();
	     DoSWI();
	     DoDabort();

	while(1);
	return (0);
}
Example #3
0
Type * ParseConstList(Type * type)
{
	Bool id_required;
	Var * var;
	BigInt last_n, * c;

	IntInit(&last_n, 0);

	EnterBlockWithStop(TOKEN_VOID);
		
	id_required = false;

	while (TOK != TOKEN_ERROR && !NextIs(TOKEN_BLOCK_END)) {

		while(NextIs(TOKEN_EOL));

		if (TOK == TOKEN_ID || (TOK >= TOKEN_KEYWORD && TOK <= TOKEN_LAST_KEYWORD)) {
			var = VarAllocScope(NO_SCOPE, INSTR_CONST, NAME, 0);
			NextToken();
			if (NextIs(TOKEN_EQUAL)) {
				SyntaxError("Unexpected equal");
			}

			if (NextIs(TOKEN_COLON)) {
				c = ParseIntConstExpression(type->owner);
				if (TOK) {
					IntModify(&last_n, c);
				}
/*
				// Parse const expression
				if (TOK == TOKEN_INT) {
					last_n = LEX.n;
					NextToken();
				} else {
					SyntaxError("expected integer value");
				}
*/
			} else {
				IntAddN(&last_n, 1);
			}

			var->var = VarN(&last_n);

			if (type->owner != SCOPE) {
				type = TypeDerive(type);
			}

			TypeAddConst(type, var);

		} else {
			if (id_required) {
				SyntaxError("expected constant identifier");
			} else {
				ExitBlock();
				break;
			}
		}
		id_required = false;
		// One code may be ended either by comma or by new line
		if (NextIs(TOKEN_COMMA)) id_required = true;
		NextIs(TOKEN_EOL);
	}
	IntFree(&last_n);
	return type;
}