/** @function @name @description @return @param @param @param @author @see - */ int Expresion_Parsear (TExpresion* expr, const char* string, const char* var) { TPila sufijo; expr->infijo = (char*)malloc(sizeof(char)*strlen(string)+1); expr->var = (char*)malloc(sizeof(char)*strlen(var)+1); strcpy(expr->infijo,string); strcpy(expr->var,var); P_Crear(&sufijo,sizeof(TLiteral)); if (infijo_a_sufijo(string,var,&sufijo)==0) return -1; if (P_Vacia(sufijo)) return -2; /* P_Sacar(&sufijo,&auxLiteral); printf ("Elem a ingresar: %s\n",auxLiteral.valor); AB_Insertar((&expr->expresion),RAIZ,&auxLiteral,&error);*/ /* obtengo el primer elemento de la pila y lo ingreso en la raíz del árbol */ ParsearAux (expr,&sufijo,RAIZ); P_Vaciar(&sufijo); return 1; }
/** @function @name TIN_Crear @description Recibe todos los elementos de una incidencia y arma un elemento del tipo TIN que recibe por parámetro. @return int @param tin:TIN* @param inci_id:int @param inci_type:tipo_inci_t @param inci_priority:prior_inci_t @param inci_user:int @param inci_assigned_user:int @param inci_date_created:char* @param inci_project_id:int @param inci_summary:char* @param inci_description:char* @author Batman @see - */ int TIN_Crear ( TIN* tin, int inci_id, tipo_inci_t inci_type, prior_inci_t inci_priority, int inci_user, int inci_assigned_user, char* inci_date_created, int inci_project_id, char* inci_summary, char* inci_description){ tin->inci_id = inci_id; tin->inci_type = inci_type; tin->inci_priority = inci_priority; tin->inci_user = inci_user; tin->inci_assigned_user = inci_assigned_user; tin->inci_date_created = inci_date_created; tin->inci_project_id = inci_project_id; tin->inci_summary = inci_summary; tin->inci_description = inci_description; /* Seteamos el estado de resuelto, a incompleto por defecto */ tin->inci_resolved = TIN_NONE; tin->inci_date_solved = (char*)malloc(sizeof(char)*(strlen(inci_date_created)+1)); strcpy(tin->inci_date_solved,inci_date_created); /* Creamos la pila */ P_Crear (&(tin->inci_stat_hist),sizeof(inci_status_t)); C_Crear (&(tin->inci_comm),sizeof(inci_comment_t)); return RES_OK; }
int main( int argc, char* args[] ){ stack = malloc(sizeof(TPila)); P_Crear( stack, sizeof(double) ); // char* script = "45.90 333333.2 +4*2p dsf89"; char* script = "12 p "; char* scriptWithSpaces = getSpaceSeparatedString(script); fputs( scriptWithSpaces, stdout ); execute(scriptWithSpaces); free(scriptWithSpaces); free(stack); return 0; }
/** @function @name TIN_GetEstados @description Obtiene todos los estados que tuvo una incidencia y los devuelve en una pila @return int @param tin:TIN* @param estados:TPila* @author Batman @see - */ int TIN_GetEstados(TIN* tin, TPila* estados) { TPila pilaAux; inci_status_t statAux; P_Crear (&pilaAux,sizeof(inci_status_t)); while(!P_Vacia(tin->inci_stat_hist)) { P_Sacar(&(tin->inci_stat_hist),&statAux); P_Agregar(&pilaAux,&statAux); } while(!P_Vacia(pilaAux)) { P_Sacar (&pilaAux,&statAux); P_Agregar (&(tin->inci_stat_hist),&statAux); P_Agregar (estados,&statAux); } return RES_OK; }
/** @function @name TIN_CrearVacio @description Crea la pila y la cola necesarias para almacenar los estados y los comentarios de una incidencia. @return void @param tin:TIN* @author Batman @see - */ void TIN_CrearVacio (TIN *tin) { P_Crear (&(tin->inci_stat_hist),sizeof(inci_status_t)); C_Crear (&(tin->inci_comm),sizeof(inci_comment_t)); }