# OCS shape version binding rules 
# $Id: BindRules 615 2010-09-30 15:49:42Z florenz@TU-BERLIN.DE $
# wg 9-93

# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Select most recent

most_recent:-
	*.exp, eq(state,busy);
	*.opt, eq(state,busy);
	*.a, eq(state,busy);
	*, eq(state,busy),
	   msg(Using busy $_af_unixname$.);
	*, max(version),
	   msg(Using $_af_state$ $_af_bound$ of $_af_author$).

# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Select most recent from user and only better-then-saved from others

most_recent_author(author):-
	*.exp, eq(state,busy);
	*.opt, eq(state,busy);
	*.a, eq(state,busy);
	OCS/*.h, eq(state,busy);
	*, eq(state,busy),
	   msg(Using busy $_af_unixname$.);
	*, max(version), eq (state, saved), eq (author,$_author$),
	   msg(Using last saved $_af_bound$ of $_author$);
	*, gt (state, saved), max(version),
	   msg(Using $_af_state$ $_af_bound$ of $_af_author$).

# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Select most recent saved from user and only better-then-saved from others

most_recent_saved(author):-
	*.exp, eq(state,busy);
	*.opt, eq(state,busy);
	*.a, eq(state,busy);
	OCS/*.h, eq(state,busy);
	*, max(version), eq (state, saved), eq (author,$_author$),
	   msg(Using last saved $_af_bound$ of $_author$);
	*, gt (state, saved), max(version),
	   msg(Using $_af_state$ $_af_bound$ of $_af_author$).


# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Select from symbolic named release 

from_release(release):-
	*.exp, eq(state,busy);
	*.opt, eq(state,busy);
	*.a, eq(state,busy);
	*, eq(__SymbolicName__, $_release$),
	   msg(Using $_af_bound$ from $_release$).


# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Select last proposed

most_recent_proposed:-
	*.exp, eq(state,busy);
	*.opt, eq(state,busy);
	*.a, eq(state,busy);
	OCS/*.h, eq(state,busy);
	*, ge(state,proposed), max(version),
	   msg(Using $_af_state$ $_af_bound$ of $_af_author$).

# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Select last publishd

most_recent_publishd:-
	*.exp, eq(state,busy);
	*.opt, eq(state,busy);
	*.a, eq(state,busy);
	OCS/*.h, eq(state,busy);
	*, ge(state,publishd), max(version),
	   msg(Using $_af_state$ $_af_bound$ of $_af_author$).
