Example #1
0
static void	ls_loop_content(char *options, t_filedir *tmp_fldr, char dots)
{
	if (isdots(tmp_fldr->name) && !dots)
		return ;
	if (show_entry(options, tmp_fldr->name) || isdots(tmp_fldr->name))
	{
		ls_loop_return(options, tmp_fldr->path);
		ls_buckle(options, ls_gen_filedirs(options, tmp_fldr));
	}
	else if (ft_strchr(options, 'R'))
		ls_loop(options, ls_gen_filedirs(options, tmp_fldr), 0);
}
Example #2
0
int ls_trim()
{
    const int Max_Cycles = 100;
    int Baseline;

    Trimmed = 0;
    if (Symbols_loaded) {

	ls_trim_init();    		/* Initialize Outputs & controls */
	ls_trim_get_vals();  /* Limit the current control settings */
	Baseline = TRUE;
	ls_trim_move_controls();		/* Write out the new values of controls */
	ls_trim_put_controls();
	ls_loop( 0.0, -1 );		/* Cycle the simulation once with new limited
					   controls */

	/* Main trim cycle loop follows */

	while((!Trimmed) && (Trim_Cycles < Max_Cycles))
	    {
		ls_trim_get_vals();
		if (Index == -1)
		    {
			ls_trim_calc_cost();
			/*Adjust_Gain();	*/
			ls_trim_save_baseline_outputs();
			Trimmed = ls_trim_eval_outputs();
		    }
		else
		    {
			ls_trim_calc_h_column();
			Controls[Index].Curr_Val = Saved_Control;
			Controls[Index].Percent  = Saved_Control_Percent;
			Controls[Index].Requested_Percent = Saved_Control_Percent;
		    }
		Index++;
		if (!Trimmed)
		    {
			if (Index >= Number_of_Controls)
			    {
				Baseline = TRUE;
				Index = -1;
				ls_trim_do_step();
			    }
			else
			    { /* Save the current value & pert next control */
				Baseline = FALSE;
				Saved_Control = Controls[Index].Curr_Val;
				Saved_Control_Percent = Controls[Index].Percent;

				if (Controls[Index].Percent < 
				    (1.0 - Controls[Index].Pert_Size) )
				    {
					Controls[Index].Requested_Percent =
					    Controls[Index].Percent +
					    Controls[Index].Pert_Size ;
				    }
				else
				    {
					Controls[Index].Requested_Percent =
					    Controls[Index].Percent -
					    Controls[Index].Pert_Size;
				    }
			    }
			ls_trim_move_controls();
			ls_trim_put_controls();
			ls_loop( 0.0, -1 );
			Trim_Cycles++;
		    }
	    }

	nr_free_matrix( H_Partials, 1, Number_of_Controls, 1, Number_of_Controls );
    }

    if (!Trimmed)  fprintf(stderr, "Trim unsuccessful.\n");
    return Trimmed;

}