/* ************************************************************
	naming module
*************************************************************** */

% construct the create predicate name according to the name and number argument
% i.e. create_N_name
create_name(Name,IdList,CName) :-
	name(Name,NList),
	append(IdList,NList,IdNList),
	append("create_",IdNList,CList),
	name(CName,CList).

% construct the destroy predicate name according to the name and number argument
% i.e. destroy_N_name
destroy_name(Name,IdList,DName) :-
	name(Name,NList),
	append(IdList,NList,IdNList),
	append("destroy_",IdNList,DList),
	name(DName,DList).

% construct the set predicate name according to the name and number argument
% i.e. set_N_name
set_name(Name,IdList,SName) :-
	name(Name,NList),
	append(IdList,NList,IdNList),
	append("set_",IdNList,SList),
	name(SName,SList).

% construct the ins_key predicate name according to the name and number argument
% i.e. ins_key_N_name
inskey_name(BeforeName,IdList,IKName) :-
	name(BeforeName,NList),
	append(IdList,NList,IdNList),
	append("ins_key_",IdNList,IKList),
	name(IKName,IKList).

key_name(BeforeName,IdList,KeyName) :-
	name(BeforeName,NList),
	append(IdList,NList,IdNList),
	append("key_",IdNList,VList),
	name(KeyName,VList).
val_name(Before,IdList,ValName) :-
	name(Before,NList),
	append(IdList,NList,IdNList),
	append("val_",IdNList,VList),
	name(ValName,VList).	
ins_name(Name,InsName) :-
	name(Name,NameList),
	append("ins_",NameList,InsList),
	name(InsName,InsList).
del_name(Name,DelName) :-
	name(Name,NameList),
	append("del_",NameList,DelList),
	name(DelName,DelList).
insertedname(Name,IName) :-
	name(Name,NameList),
	append("i_",NameList,IList),
	name(IName,IList).
deletedname(Name,DName) :-
	name(Name,NameList),
	append("d_",NameList,DList),
	name(DName,DList).
dbname(Name,DBName) :-
	name(Name,NameList),
	append("db_",NameList,DBList),
	name(DBName,DBList).

temp_name(X,NewName) :-
	name(X,XList),
	append("temp_",XList,NameList),
	name(NewName,NameList).
loop_name(X,NewName) :-
	name(X,XList),
	append("loop_",XList,NameList),
	name(NewName,NameList).

file_name(Name,NArgs,FName) :-
	name(Name,NList),
	name(NArgs,NAList),
	append(NAList,"_rules.pl",FList),
	append(NList,FList,FNList),
	append("Rules/",FNList,DFNList),
	name(FName,DFNList).
index_list(NArgs,IdList) :-
	name(NArgs,NAList),
	append(NAList,"_",IdList).

