[BACK]Return to generate_unions.adb CVS log [TXT][DIR] Up to [local] / OpenXM_contrib / PHC / Ada / Root_Counts / Product

Annotation of OpenXM_contrib/PHC/Ada/Root_Counts/Product/generate_unions.adb, Revision 1.1.1.1

1.1       maekawa     1: procedure Generate_Unions ( k,first,last : in integer ) is
                      2:
                      3:   acc : boolean_array(first..last) := (first..last => false);
                      4:   cont : boolean := true;
                      5:
                      6:   procedure Generate ( k,start,last : in integer;
                      7:                        acc : in out boolean_array ) is
                      8:   begin
                      9:     if k = 0
                     10:      then process(acc,cont);
                     11:      elsif k > last - start + 1
                     12:          then return;
                     13:          else for i in start..last loop
                     14:                 acc(i) := true;
                     15:                 generate(k-1,i+1,last,acc);
                     16:                 exit when not cont;
                     17:                 acc(i) := false;
                     18:               end loop;
                     19:     end if;
                     20:   end Generate;
                     21:
                     22: begin
                     23:   Generate(k,first,last,acc);
                     24: end Generate_Unions;

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>