From: Howard T. <how...@di...> - 2007-08-22 00:11:14
|
Hi Eric, In working on my Eiffel comparison code, I found that the process_features feature of ET_AST_ITERATOR fails to process features in some classes. According to feedback from my EDP project, this feature is not part of the reachable feature set of the Eiffel compilation process in 'gec' and is therfeore untested in that environment. I append a reimplementation that seems to work somewhat better, although not yet proven correct: process_features (a_class: ET_CLASS) is -- Process feature clauses of `a_class'. require a_class_not_void: a_class /= Void local a_feature_clauses: ET_FEATURE_CLAUSE_LIST a_feature_clause: ET_FEATURE_CLAUSE l_queries: ET_QUERY_LIST l_query: ET_QUERY l_procedures: ET_PROCEDURE_LIST l_procedure: ET_PROCEDURE i, nb: INTEGER j, nb_queries: INTEGER k, nb_procedures: INTEGER do a_feature_clauses := a_class.feature_clauses if a_feature_clauses /= Void then from -- Setup for 'feature' sequence i := 1 nb := a_feature_clauses.count -- Setup for 'queries' sequence j := 1 l_queries := a_class.queries nb_queries := l_queries.count if j <= nb_queries then l_query := l_queries.item (j) else l_query := Void end -- Setup for 'procedures' sequence k := 1 l_procedures := a_class.procedures nb_procedures := l_procedures.count if k <= nb_procedures then l_procedure := l_procedures.item (k) else l_procedure := Void end until i > nb loop -- Set feature clause for this iteration a_feature_clause := a_feature_clauses.item (i) -- Process either the next query, or the next procedure -- and select the next query or procedure ... if l_query /= Void and then l_query.feature_clause = a_feature_clause then if l_procedure /= Void and then l_procedure.feature_clause = a_feature_clause then if l_query.name.position < l_procedure.name.position then -- Here, both the current query and the current procedure lie within -- the current feature, and the query comes first l_query.process (Current) j := j + 1 if j <= nb_queries then l_query := l_queries.item (j) else l_query := Void end else -- Here, both the current query and the current procedure lie within -- the current feature, and the procedure comes first l_procedure.process (Current) k := k + 1 if k <= nb_procedures then l_procedure := l_procedures.item (k) else l_procedure := Void end end -- if else -- Here, only the query lies in the current feature clause l_query.process (Current) j := j + 1 if j <= nb_queries then l_query := l_queries.item (j) else l_query := Void end end -- if elseif l_procedure /= Void and then l_procedure.feature_clause = a_feature_clause then -- Here, only the current procedure lies within the current feature clause l_procedure.process (Current) k := k + 1 if k <= nb_procedures then l_procedure := l_procedures.item (k) else l_procedure := Void end end -- if -- If both the current query and procedure are not in -- the current feature clause, then select the next feature clause if (l_query = Void or else l_query.feature_clause /= a_feature_clause) and then (l_procedure = Void or else l_procedure.feature_clause /= a_feature_clause) then i := i + 1 end -- if end -- loop end -- if end Cheers, Howard Thomson By the way, did you get my previous e-mail about waiting for me to update SF svn ? -- "Only two things are infinite, the universe and human stupidity, and I'm not sure about the former." -- Albert Einstein |