Esempio n. 1
0
int removeItem (struct ListaLigada * listaLigada,int posicao){
	if (listaLigada != NULL){
		if (posicao == 0){
			return removeDoComeco(listaLigada);
		}
		if (posicao == listaLigada->total - 1){
			return removeDoFim(listaLigada);
		}
		if (posicao >= listaLigada->total)
			return 0;
		struct Celula * anterior = listaLigada->primeira;
		int i = 0;
		while (i++ < posicao - 1){
			anterior = anterior->proxima;
		}
		struct Celula * atual = anterior->proxima;
		struct Celula * proxima = atual->proxima;

		anterior->proxima = proxima;
		proxima->anterior = anterior;
		free (atual);
		listaLigada->total--;
		return 1;
	}
	return 0;
}
Esempio n. 2
0
void EvaluateLispForm(int inst, Attribute * item)
{
	Lista * arguments = &item->formArguments;

	int i;
	while (!listaVazia(arguments)) 
	{
		static int firstIteration = 1;
		removeDoFim(arguments, &i);
		Attribute shittyHack;
		shittyHack.num = i;
		PushInstruction(BIPUSH, shittyHack);
		if(!firstIteration)
		{
			PushInstruction(inst, shittyHack);

		} else firstIteration = 0;
	}
}