cblock_with_abort(Spec,Name,Call,Args,Abort,Rules) :-
dnf((nonvar(Abort);Spec),DNF),!,
AllArgs = [Abort|Args],
create_block(DNF,Name,AllArgs,Block),
copy_term([AllArgs,Abort],[Args1,Abort1]),
copy_term([AllArgs,Call],[Args2,Call2]),
Head1 =.. [Name|Args1],
Head2 =.. [Name|Args2],
Rules = [Block, (Head1:-nonvar(Abort1),!), (Head2:-Call2)].
cblock_with_abort(ground(G),Name,Call,Args,Abort,[R1,Block,R2Abort,R2]) :-
atom_concat(Name,'__ground2',Name2),
create_ground_abort1(G,Name,Name2,Call,Args,Abort,R1),
create_ground_abort_block(Name2,Args,Block),
create_ground_abort2a(Name2,Args,R2Abort),
create_ground_abort2(Name2,Call,Args,R2).
cblock_with_abort( (A;B),Name,Call,Args,Abort,[Or|Rules]) :-
copy_term([A,B,Call,Args,Abort],[NA,NB,NCall,NArgs,NAbort]),
cblock_or(NA,NB,Name,NCall,NArgs,Rules,CallA,CallB,AbortA,AbortB),
Head =.. [Name,NAbort|NArgs],
Or = ( Head :- fastwhen:or_abort(NAbort,AbortA,AbortB), CallA, CallB ).
cblock_with_abort( (A,B),Name,Call,Args,Abort,Rules) :-
atom_concat(Name,'__and2',Name2),
CallToB =.. [Name2,Abort|Args],
cblock_with_abort(A,Name,CallToB,Args,Abort,RulesA),
cblock_with_abort(B,Name2,Call,Args,Abort,RulesB),
append(RulesA,RulesB,Rules).