indexing description: "[ This class is made, to create an example using all library classes. ]" date: "$Date$" revision: "$Revision$" class OBSOLETE_FINDER create make feature {NONE} -- Initialization make is -- Start processing library local a_directory: DIRECTORY do io.put_string ("Generating output folder%N") create a_directory.make (target) if not a_directory.exists then a_directory.create_dir end io.put_string ("Generating build.eant%N") generate_eant io.put_string ("Generating system.xace%N") generate_xace io.put_string ("Generating all_classes.e%N") generate_root_class (process_directory (source)) end feature -- Generation generate_eant is -- Generate example eant-file local a_file: PLAIN_TEXT_FILE do create a_file.make_create_read_write (target + "/build.eant") a_file.put_string("%N") a_file.put_string("%N") a_file.put_string("%N") a_file.put_string("%N") a_file.put_string("%T%N") a_file.put_string("%T%Tdescription: %"Eiffel Ant file for all_classes example%"%N") a_file.put_string("%T%Tsystem: %"EiffelMedia examples%"%N") a_file.put_string("%T%Tcopyright: %"Copyright (c) 2004, Till G. Bay and others%"%N") a_file.put_string("%T%Tlicense: %"Eiffel Forum License v2 (see forum.txt)%"%N") a_file.put_string("%T%Tdate: %"$Date$%"%N") a_file.put_string("%T%Trevision: %"$Revision$%"%N") a_file.put_string("%T%N") a_file.put_string("%N") a_file.put_string("%T%N") a_file.put_string("%T%T%N") a_file.put_string("%T%T%T%N") a_file.put_string("%T%T%N") a_file.put_string("%T%N") a_file.put_string("%N") a_file.put_string("%T%N") a_file.put_string("%N") a_file.put_string("%T%N") a_file.put_string("%T%T%N") a_file.put_string("%T%T%N") a_file.put_string("%T%N") a_file.put_string("%N") a_file.put_string("%N") a_file.flush a_file.close end generate_xace is -- Generate example xace-file local a_file: PLAIN_TEXT_FILE do create a_file.make_create_read_write (target + "/system.xace") a_file.put_string("%N") a_file.put_string("%N") a_file.put_string("%N") a_file.put_string("%T%N") a_file.put_string("%T%Tsystem: %"EiffelMedia all_classes application%"%N") a_file.put_string("%T%Tcopyright: %"Copyright (c) 2004, Till G. Bay and others%"%N") a_file.put_string("%T%Tlicense: %"Eiffel Forum License v2 (see forum.txt)%"%N") a_file.put_string("%T%Tdate: %"$Date$%"%N") a_file.put_string("%T%Trevision: %"$Revision$%"%N") a_file.put_string("%T%N") a_file.put_string("%T%N") a_file.put_string("%T%N") a_file.put_string("%T%N") a_file.put_string("%N") a_file.put_string("%T%N") a_file.put_string("%N") a_file.put_string ("%T%N") a_file.put_string ("%T%T%N") a_file.put_string ("%T%T%N") a_file.put_string ("%T%N") a_file.put_string ("%N") a_file.put_string ("%T%N") a_file.put_string ("%T%T%N") a_file.put_string ("%N") a_file.put_string ("%T%N") a_file.put_string ("%T%T%N") a_file.put_string ("%N") a_file.put_string ("%T%N") a_file.put_string ("%T%T%N") a_file.put_string ("%N") a_file.put_string ("%T%N") a_file.put_string ("%T%T%N") a_file.put_string ("%N") a_file.put_string ("%T%N") a_file.put_string ("%N") a_file.put_string ("%T%N") a_file.put_string ("%N") a_file.put_string("%T%N") a_file.put_string("%T%N") a_file.put_string("%T%N") a_file.put_string("%T%N") a_file.put_string("%N") a_file.put_string("%N") a_file.flush a_file.close end process_directory (a_path: STRING): DS_LINKED_LIST [STRING] is -- process directory require a_path_not_void: a_path /= Void local a_directory: DIRECTORY a_file: RAW_FILE a_linear_representation: ARRAYED_LIST [STRING] an_extension: STRING do create Result.make create a_directory.make (a_path) if a_directory.exists then from a_linear_representation := a_directory.linear_representation a_linear_representation.start until a_linear_representation.after loop -- If not special folders ".", "..", "CVS" and "generated_wrapper" if not (a_linear_representation.item.is_equal (".") or else a_linear_representation.item.is_equal ("..") or else a_linear_representation.item.is_equal ("generated_wrapper") or else a_linear_representation.item.is_equal ("CVS")) then create a_file.make (a_path + "/" + a_linear_representation.item) if a_file.exists then -- If file is a directory and we do recursive search, enter the folder. if a_file.is_directory and then not a_file.is_symlink then Result.append_last (process_directory (a_file.name)) else -- List all *.e files. create an_extension.make_from_string (a_file.name) an_extension.keep_tail ((".e").count) if an_extension.is_equal (".e") then Result.put_last (a_file.name) end end end end a_linear_representation.forth end end end generate_root_class (a_list: DS_LINKED_LIST [STRING]) is -- Generate example root class local a_file: PLAIN_TEXT_FILE a_name: STRING genericity: STRING do create a_file.make_create_read_write (target + "/all_classes.e") a_file.put_string("indexing%N") a_file.put_string("%N") a_file.put_string("%Tdescription: %"[%N") a_file.put_string("%N") a_file.put_string("%T%TUses all EiffelMedia classes.%N") a_file.put_string("%N") a_file.put_string("%T]%"%N") a_file.put_string("%Tdate: %"$Date$%"%N") a_file.put_string("%Trevision: %"$Revision$%"%N") a_file.put_string("%N") a_file.put_string("class ALL_CLASSES%N") a_file.put_string("%N") a_file.put_string("create%N") a_file.put_string("%N") a_file.put_string("%Tmake%N") a_file.put_string("%N") a_file.put_string("feature -- Initialization%N") a_file.put_string("%N") a_file.put_string("%Tmake is%N") a_file.put_string("%T%Tdo%N") a_file.put_string("%T%Tend%N") a_file.put_string("%N") a_file.put_string("feature -- Variables%N") a_file.put_string("%N") from a_list.start until a_list.after loop a_name ?= a_list.item_for_iteration if a_name /= Void then genericity := get_genericity (a_name) a_name.remove_head (a_name.last_index_of ('/', a_name.count)) a_name.remove_tail ((".e").count) a_name.to_lower a_file.put_string ("%T" + a_name + ": ") a_name.to_upper a_file.put_string (a_name + genericity + "%N") end a_list.forth end a_file.put_string("%Nend%N") a_file.flush a_file.close end get_genericity (a_name: STRING): STRING is -- Detect genericity local a_file: PLAIN_TEXT_FILE class_name: STRING generic: STRING class_found: BOOLEAN revision_passed: BOOLEAN can_break: BOOLEAN do from create Result.make_empty create a_file.make_open_read (a_name) create class_name.make_from_string (a_name) class_name.remove_head (class_name.last_index_of ('/', class_name.count)) class_name.remove_tail ((".e").count) class_name.to_upper a_file.start class_found := False revision_passed := False can_break := False until can_break or else a_file.after loop a_file.read_line if a_file.last_string.has_substring ("revision") then revision_passed := True end if revision_passed and then a_file.last_string.has_substring ("class") then class_found := True end if revision_passed and then class_found and then a_file.last_string.has_substring (class_name) and then a_file.last_string.has_substring ("[") and then a_file.last_string.has_substring ("]") then from can_break := True Result.append (" [") create generic.make_from_string (a_file.last_string) until not generic.has (',') loop generic.remove_head (generic.index_of (',', 1)) Result.append ("INTEGER, ") end Result.append ("INTEGER]") end if revision_passed and then class_found and a_file.last_string.has_substring ("feature") then can_break := True end end a_file.close end feature -- Constants source: STRING is "../../../library" -- library folder target: STRING is "../../../example/all_classes" -- target folder end