! Eve Plus - Extensions to EVE ! ! This is a collection of TPU procedures to aid in building custom ! section files. ! ! This file doesn't contain any of the hacks, rather it defines a ! few basic building blocks and three procedures comprising an ! "include" feature and then executes a buffer which includes the ! various pacakages that make up "EVE plus". The three procedures ! are used thusly: ! ! eveplus_start_build; ! Set-up to gather TPU$LOCAL_INITs ! ! eveplus_include("..."); ! Include the first file ! eveplus_include("..."); ! Include the next file ! : ! eveplus_include("..."); ! Include the last file ! ! eveplus_complete_build; ! Compile the accumulated local init ! procedure eveplus_start_build ! Make init buffer & check environment local old_buffer; ! Buffer when we were entered old_buffer := current_buffer; ! Remember where we were eve_buffer("messages"); update (current_window); eveplus_local_init := create_buffer("eveplus_local_init"); set(no_write, eveplus_local_init); ! Create an RO buffer eveplus_local_init_name := "tpu$local_init"; position(eveplus_local_init); ! Put in our minimal local_init copy_text("procedure "); ! procedure which updates EVE's copy_text(eveplus_local_init_name); ! version number by adding a split_line; ! "+" to the end of it. copy_text(" eve$x_version := eve$x_version + '+';"); split_line; copy_text(" eveplus_g_shift_key := ctrl_y_key; "); split_line; copy_text(" eveplus_building := FALSE;"); split_line; copy_text("endprocedure"); split_line; eveplus_building := TRUE; position(old_buffer); ! Go back endprocedure procedure eveplus_include(file_name) ! Include a .TPU file local temp_buffer, ! Buffer to compile in compiled_code, ! The compiled code expanded_file, ! Full name after defaulting etc. master_file, ! Name of the file associated with ! the current buffer - for defaulting init_code, ! The tpu$local_init from this file old_buffer, ! Buffer when we were entered temp, ! Junk end_pattern, ! "endprocedure" pattern white_space, ! White-space spanning pattern the_pattern; ! Pattern that matches the whole ! tpu$local_init procedure master_file := get_info(current_buffer, "file_name"); expanded_file := file_parse(file_name, ".TPU;", master_file); temp := file_search(""); ! Reset file_search if (file_search(expanded_file) = "") then ! Does it exist? message(" "); message("Can't find: " + expanded_file);! Nope. else message(" "); message("Including "+expanded_file); old_buffer := current_buffer; ! Remeber where we were temp_buffer := create_buffer(expanded_file, expanded_file); set(no_write, temp_buffer); position(temp_buffer); ! Go to the init buffer end_pattern := line_begin & ! Build a pattern that'll match "endprocedure"; ! a tpu$local_init definition white_space := " " + ascii(9); ! with the procedure and the_pattern := line_begin & ! endprocedure both at the "procedure" & ! left margin. spanl(white_space) & eveplus_local_init_name & end_pattern; init_code := eveplus_search_quietly(the_pattern, FORWARD); ! Find the init code if (init_code <> 0) then ! and copy it position(eveplus_local_init); ! to the init buffer split_line; ! after a blank line. copy_text(init_code); endif; set(informational, on); ! Compile the buffer compiled_code := compile(temp_buffer); ! (including the if (compiled_code <> 0) then ! tpu$local_init execute(compiled_code); ! procedure!) endif; set(informational, off); position(old_buffer); ! Go back and clean up erase(temp_buffer); delete(temp_buffer); endif; temp := file_search(""); ! Keep from affecting ! other file_searches endprocedure ! ! Procedure to combine the colloected tpu$local_init procedures and ! compile them. ! procedure eveplus_complete_build ! Compile all the local inits local old_buffer, ! Buffer when we were entered proc_pattern, ! "procedure" pattern white_space, ! White-space spanning pattern the_junk, the_pattern; ! Pattern that matches the extra ! endprocedure/procedure pairs old_buffer := current_buffer; ! Remember where we were white_space := " " + ascii(9); ! Create a pattern to proc_pattern := line_begin & ! match an endprocedure "procedure" & ! followed by a ! procedure tpu$local_init spanl(white_space) & ! NOTE: eveplus_local_init_name; ! Any lines between the the_pattern := line_begin & ! end of one procedure "endprocedure" & ! and the beginning of proc_pattern; ! the next will go away position(beginning_of(eveplus_local_init)); loop ! Search and destroy the_junk := eveplus_search_quietly(the_pattern, FORWARD); ! the extraneous exitif (the_junk = 0); ! statements erase(the_junk); endloop; position(beginning_of(eveplus_local_init)); loop ! Remove any blank lines the_junk := eveplus_search_quietly(line_end & line_end, FORWARD); exitif (the_junk = 0); position(beginning_of(the_junk)); erase(the_junk); move_horizontal(1); exitif (mark(none) = end_of(current_buffer)); move_horizontal(-1); split_line; move_vertical(-1); endloop; compile(eveplus_local_init); ! And compile what's left. position(old_buffer); ! Go back erase(eveplus_local_init); ! And clean up. delete(eveplus_local_init); eveplus_define_keys; ! Define the keys execute(eveplus_local_init_name); ! Execute the local init endprocedure procedure eveplus_define_keys ! Dummy key definition procedure endprocedure procedure eveplus_get_kernel ! Compile EVEPLU_KERNEL.TPU local temp_buffer, command_file, the_directory, parse_complete, full_spec; on_error if (parse_complete) then return(0); endif; endon_error; parse_complete := 0; command_file := get_info(command_line, "command_file"); the_directory := file_parse(command_file, "", "", device) + file_parse(command_file, "", "", directory); full_spec := file_parse("EVEPLUS_KERNEL.TPU", the_directory); message("Getting kernel file: " + full_spec); parse_complete := 1; temp_buffer := create_buffer(full_spec, full_spec); compile(temp_buffer); erase(temp_buffer); delete(temp_buffer); return(1); endprocedure; if (not eveplus_get_kernel) then message(" "); message("*** The EVEplus build procedure must be able to find ***"); message("*** EVPLUS_KERNEL.TPU in order build EVEplus. It expects ***"); message("*** to find it where EVEPLUS_BUILD.TPU is kept, which is ***"); message("*** usually in TPU$EVEPLUS:. It has been unable to find it ***"); message("*** please make sure the kit is in the right place. ***"); message(" "); quit; endif; message (" "); message ("Beginning Eve plus build procedure."); execute (current_buffer); message ("The Eve plus build procedure has completed."); position ( end_of ( message_buffer )); update (current_window);