%apply;tt()

%define;cousin_lex(vvv,www) [*cousins.vvv.www]1 %end; %define;tt() %apply;a_of_b_gr_eq_lev%with; %apply;cousin_lex(evar.v1,evar.v2)%nn; %and; %if;(public_name != "")%public_name;%else;%first_name;%end; %if;(qualifier != "") %qualifier;%end; %sp;%surname; %end; %end; %include;css %include;hed %message_to_wizard;
%include;perso_utils %include;menubar
[*select person to compute relationship]
%define;on_side(xxx) [*on %s's side:::xxx] %end; %let;my_first_name_key;%first_name_key;%in; %let;my_surname_key;%surname_key;%in; %let;my_occ;%occ;%in %define;url(xxx,yyy) %xxx; %xxx.dates; %if;(evar.spouse="on" and "xxx"!="ancestor")%foreach;family;%if;(xxx.spouse!="? ?") & %xxx.spouse; %xxx.spouse.dates;%end;%end;%end; %end; %empty_sorted_list; %define;add_to_sorted_list(xxx,ccc) %apply;add_in_sorted_list%with;&i%expr(ccc+1)=%xxx.index;%end; %end;

### %if;(evar.v1=0 and evar.v2=0)%if;(sex=0)[*him/her]0%else;[*him/her]1%end; %else;

### %apply;a_of_b%with;%apply;cousin_lex(evar.v1,evar.v2)%and;%self;%end;%end;

%( siblings and half-siblings %) %if;(evar.v1=1 and evar.v2=1) %if;(has_parents) %let;my_index;%self.index;%in; %let;my_father;%self.father;%in; %let;my_mother;%self.mother;%in; %if;father.has_children;

%foreach;father.family; %if;(has_children and father.spouse = my_mother)
- %apply;on_side%with;%father;%end; [and] %father.spouse;[:]

%reset_count; %foreach;child; %if;(child.index!=my_index) %incr_count;
- %apply;url("child","father")
%apply;add_to_sorted_list("child",count) %end; %end;

%end; %end; %foreach;father.family; %if;(has_children and father.spouse != my_mother)
- %apply;on_side%with;%father;%end; [and] %father.spouse;[:]

%foreach;child; %incr_count;
- %apply;url("child","father")
%apply;add_to_sorted_list("child",count) %end;

%end; %end;

%end; %if;mother.has_children;

%foreach;mother.family; %if;(has_children and mother.spouse != my_father)
- %apply;on_side%with;%mother;%end; [and] %mother.spouse;[:]

%foreach;child; %incr_count;
- %apply;url("child","mother")
%apply;add_to_sorted_list("child",count) %end;

%end; %end;

%end; %end; %elseif;(evar.v1=0) %if;(evar.v2=0 or evar.v2="") %self; %else; %reset_count;

%foreach;descendant_level; %if;(level=evar.v2) %foreach;descendant; %incr_count;
- %apply;url("descendant","")
%apply;add_to_sorted_list("descendant",count) %end; %end; %end;

%end; %elseif;(evar.v2=0) %reset_count;%reset_count1;%reset_count2;

%foreach;ancestor_level; %if;(level=evar.v1+1) %foreach;ancestor; %incr_count; %if;(count%2=1)
- %if;(ancestor="? ?")%incr_count1;%end;%end; %if;(count%2=0 and ancestor!="? ?" and count1!=1) & %end; %if;(ancestor!="? ?")%apply;url("ancestor","")%end; %if;(count%2=0)
%reset_count1;%end; %apply;add_to_sorted_list("ancestor",count) %if;(ancestor="? ?")%incr_count2;%end; %end; %end; %end;

%else; That should not happen! %end; %if;(count!="" and count>1) Graphe RLM %if;(evar.v2=0 or evar.v2="")Graphe ASC.%end; %if;(evar.v1=0 and evar.v2>0)Graphe DESC.%end; %end;
Total[:] %if;(evar.v2=0)%expr(count-count2)%else;%count;%end; %if;(count=0 or count=1)[person/persons]0%else;[person/persons]1%end;.
%base_trailer; %include;copyr

%include;js