! FORMS_FDE_EDIT.TPU 19-SEP-1991 14:50 Page 1 ! DECforms: TPU Startup File ! ! COPYRIGHT (c) 1988,1989 BY ! DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASSACHUSETTS. ! ALL RIGHTS RESERVED. ! ! THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED ! ONLY IN ACCORDANCE OF THE TERMS OF SUCH LICENSE AND WITH THE ! INCLUSION OF THE ABOVE COPYRIGHT NOTICE. THIS SOFTWARE OR ANY OTHER ! COPIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY ! OTHER PERSON. NO TITLE TO AND OWNERSHIP OF THE SOFTWARE IS HEREBY ! TRANSFERRED. ! ! THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE ! AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT ! CORPORATION. ! ! DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY OF ITS ! SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DIGITAL. ! !++ ! FACILITY: ! DECforms ! ! ABSTRACT: ! This is the startup routine for TPU and LSE when called from the ! Form Development Environment (FDE) of DECforms ! ! This module: ! ! 1) sets up HELP FORMS command (for EVE interfaces) ! 2) (Vn: splits out main editing stuff into FORMS$EDIT buffer) ! 3) Switches to FORMS$MAIN as the main buffer ! 4) Deletes any procedures/globals after init is finished ! ! ENVIRONMENT: ! DECforms Form Development Environment and callable TPU ! ! AUTHOR: ! DEC ! ! CREATION DATE: 27-Jul-1987 ! ! MODIFICATION HISTORY: ! ! DECforms V1.3 Released. ! ! 19-SEP-1991 JDN Make editorial comment changes to help/prompt messages. ! !-- ! FORMS_FDE_EDIT.TPU 27-JAN-1989 11:46 Page 2 !++ ! Table of Contents ! ! FORMS_FDE_EDIT.TPU ! 27-JAN-1989 11:46 ! ! Procedure name Page Description ! -------------- ---- ------------ ! ! FORMS$HELP 3 User Help for DECforms ! eve_help_forms 4 HELP FORMS command (under EVE) ! FORMS$HELP_V4 5 Help for TPU V1.2 ! forms$in_eve 6 Does User section contain EVE? ! forms$in_lse 7 Is User running under LSE? ! forms$fancy_eve_help 8 EVE V2.0 help routines avail? ! forms$eve_help_constants 9 Define topics for EVE V2.0 help ! forms$help_EVE_012 10 V1.2 EVE Help interface ! forms$help_TPU 11 non-EVE Help interface ! forms$initialize_help 12 Initialize Help Library, etc. ! forms$cut_buff 13 Cut partial edit to new buffer ! forms$startup 14 Initialization routine ! forms$exit 15 Exit routine combines buffers !-- ! FORMS_FDE_EDIT.TPU 27-JAN-1989 11:46 Page 3 !+ ! ! Help for DECforms ! !- procedure FORMS$HELP (topic) ! User Help for DECforms !procedure FORMS$HELP (;topic) ! User Help for DECforms ! The ";" requires TPU V2.0+ local user_topic; ! ! Since the topic is an optional param, we need to set a default ! if get_info(topic,"type") <> STRING then topic := forms$help_topic; endif; ! ! Check for in_lse first, since lse is now including eve help routines. ! if forms$in_lse then Message ("Press PF1-PF2 for help while positioned on a keyword or token."); else if forms$fancy_eve_help then ! ! Call EVE help ! ! Because we have a procedure called EVE_HELP_FORMS, we end up ! coming here if the user types HELP FORM. But, of course, the ! eve parser has stripped the topic "FORMS" from the command line ! in the process of calling our procedure. So we need to put it ! back on. ! if topic = "" then user_topic := "?"; ! Get list of topics, first else user_topic := topic; endif; return eve_help("forms " + user_topic); else if forms$in_eve then if topic = "" then user_topic := forms$help_topic; else user_topic := topic; endif; return forms$help_EVE_012( user_topic ); else if topic = "" then user_topic := forms$help_topic; else user_topic := topic; endif; return forms$help_TPU( user_topic ); endif; ! for forms$in_EVE endif; ! for Fancy_EVE_help endif; ! for forms$in_LSE endprocedure; ! FORMS_FDE_EDIT.TPU 27-JAN-1989 11:46 Page 4 !+ ! ! HELP Procedure for EVE V2.0+ ! !- procedure eve_help_forms(topic) ! HELP FORMS command (under EVE) return forms$help(topic); endprocedure; ! FORMS_FDE_EDIT.TPU 27-JAN-1989 11:46 Page 5 procedure FORMS_HELP_V4 ! Help for TPU V1.2 return forms$help(forms$help_topic); endprocedure; ! FORMS_FDE_EDIT.TPU 27-JAN-1989 11:46 Page 6 !+ ! ! Are we in EVE? ! !- procedure forms$in_eve !Does User section contain EVE? local eve_ver; on_error return (0); !False endon_error; ! ! WARNING: Expand_Name returns the names of all variables ! that are REFERENCED as well as DEFINED. Make sure that ! the variable name in the Expand_Name is not used ANYWHERE ! (even inside of an IF). ! eve_ver := expand_name("eve$x_version", VARIABLES); return (1); !True endprocedure; ! FORMS_FDE_EDIT.TPU 27-JAN-1989 11:46 Page 7 !+ ! ! Are we in LSE? ! !- procedure forms$in_lse !Is User running under LSE? local lse_ver; on_error return (0); !False endon_error; ! ! WARNING: Expand_Name returns the names of all procedures ! that are REFERENCED as well as DEFINED. Make sure that ! the procedure name in the Expand_Name is not used ANYWHERE ! (even inside of an IF). ! lse_ver := expand_name("lse$get_environment", PROCEDURES); return (1); !True endprocedure; ! FORMS_FDE_EDIT.TPU 27-JAN-1989 11:46 Page 8 !+ ! ! Do we have fancy EVE help available? ! !- procedure forms$fancy_eve_help !EVE V2.0 help routines avail? local fancy_eve; on_error return (0); !False endon_error; ! ! WARNING: Expand_Name returns the names of all procedures ! that are REFERENCED as well as DEFINED. Make sure that ! the procedure name in the Expand_Name is not used ANYWHERE ! (even inside of an IF). ! fancy_eve := expand_name("eve$get_help_item", PROCEDURES); return (1); !True endprocedure; ! FORMS_FDE_EDIT.TPU 27-JAN-1989 11:46 Page 9 !+ ! ! This procedure defines help topic constants. These are necessary ! so that the eve parser can handle abbreviations of multi-word topics ! (which are of course, separated by underscores in the real library topic) ! !- procedure forms$eve_help_constants !Define topics for EVE V2.0 help ! ! Define initial help constants so eve v2.0 help can use the parser on topics ! if not FORMS$IN_LSE then ! ! These constants are of the form: ! ! eve$kt_topic_forms_ := ""; ! ! They enable the eve parser to handle topics that are multi-word ! and pass them correctly to the help librarian ! eve$kt_topic_forms_copy_file := "copy_file"; eve$kt_topic_forms_copy_field := "copy_field"; eve$kt_topic_forms_form := "form"; !for ambiguities eve$kt_topic_forms_forms := "forms"; !for ambiguities !** eve$kt_topic_forms_form_data := "data"; !synonym !** eve$kt_topic_forms_form_record := "record"; !synonym eve$kt_topic_forms_data := "data"; !needed to resolve ambiguity with DATA_TYPE eve$kt_topic_forms_data_types := "data_type"; eve$kt_topic_forms_function_keys := "function_keys"; eve$kt_topic_forms_response_steps := "response_steps"; eve$kt_topic_forms_ifdl_concepts := "ifdl_concepts"; endif; endprocedure; ! FORMS_FDE_EDIT.TPU 27-JAN-1989 11:46 Page 10 !+ ! ! Help for EVE V1.2 ! !- procedure forms$help_EVE_012 (user_topic) ! V1.2 EVE Help interface local temp_buffer, this_window, this_buffer; ! ! We are in EVE, but we don't have the new fancy help procedures ! that are in V2.0 and later. ! ! So, we mimic EVE V1.2 help ! this_window := current_window; this_buffer := get_info (current_window, "buffer"); ! incase info_window ! ! From EVE$CORE.TPU ! (initialize Help_buffer) ! if get_info (help_buffer, "type") <> BUFFER then ! user may have deleted the help buffer temp_buffer := get_info (BUFFERS, "find_buffer", "Help"); if temp_buffer <> 0 then ! user must have created own help buffer delete (temp_buffer); ! delete it... endif; help_buffer := eve$init_buffer ("Help", ""); endif; erase (help_buffer); map ( info_window, help_buffer ); !** eve$map_help( help_buffer ); set (status_line, info_window, reverse, " Help on DECforms (Press Return if done)"); ! ! Get the help text itself from a help library ! help_text("FORMS$HELPLIB", user_topic, on, help_buffer); ! ! Restore eve screen to what it was... ! (From EVE$CORE.TPU procedures) ! !** if this_window <> TPU$x_show_window !** then !** eve$unmap_help; !** position (this_window); !** else map (this_window, this_buffer); ! probably show_buffer !** endif; return (1); !True (For LEARN sequences) endprocedure; ! FORMS_FDE_EDIT.TPU 27-JAN-1989 11:46 Page 11 !+ ! ! Help for TPU (no EVE interface) ! !- procedure forms$help_TPU (user_topic) ! non-EVE Help interface local temp_buffer, this_window, this_buffer; ! ! We are not in EVE, so no eve$xxx procedures are available ! this_window := current_window; this_buffer := get_info (current_window, "buffer"); ! incase info_window if get_info (help_buffer, "type") <> BUFFER then ! user may have deleted the help buffer temp_buffer := get_info (BUFFERS, "find_buffer", "Help"); if temp_buffer <> 0 then ! user must have created own help buffer delete (temp_buffer); ! delete it... endif; help_buffer := create_buffer ("Help", ""); endif; erase (help_buffer); map (info_window, help_buffer ); set (status_line, info_window, reverse, " Help on DECforms (Press Return if done)"); ! ! Get the help text itself from a help library ! help_text("FORMS$HELPLIB", user_topic, on, help_buffer); ! ! Restore eve screen to what it was... ! (From EVE$CORE.TPU procedures) ! if this_window <> TPU$x_show_window then eve$unmap_help; position (this_window); else map (this_window, this_buffer); ! probably show_buffer endif; return (1); !True (For LEARN sequences) endprocedure; ! FORMS_FDE_EDIT.TPU 27-JAN-1989 11:46 Page 12 !++ ! ! FORMS$INITIALIZE_HELP ! ! This procedure does all that's necessary to initialize help ! !-- procedure forms$initialize_help !Initialize Help Library, etc. ! ! Declare eve variable types ! if forms$in_eve then eve$arg1_help_forms := 'string'; endif; ! ! If fancy EVE help exists, then initialize it ! If forms$fancy_eve_help then eve$declare_help_library( "FORMS", ! Facility name "FORMS$HELPLIB", ! Help lib "", ! prefixing Topic in lib "For help on DECforms, type FORMS and press RETURN."); endif; ! ! Initialize help constants for the eve parser ! forms$eve_help_constants; !Setup eve help constants ! ! Tell user how to get the help stuff ! (Since LSE is including EVE stuff, we must check for LSE 1st) ! If forms$in_lse then Message ("Press PF1-PF2 when you are on a keyword or token for help on IFDL syntax."); else if forms$fancy_eve_help then Message ("For help on DECforms IFDL syntax, press DO and type HELP FORMS."); else if forms$in_eve then Message ("For help on DECforms IFDL syntax, press DO and type TPU FORMS$HELP_V4."); else Message ("Execute the TPU procedure FORMS$HELP for help on DECforms IFDL syntax."); endif; endif; endif; endprocedure; ! FORMS_FDE_EDIT.TPU 27-JAN-1989 11:46 Page 13 !++ ! ! FORMS$CUT_BUFF ! ! This procedure cuts any partial edit session to separate buffer ! !-- procedure forms$cut_buff(user_window) !Cut partial edit to new buffer local start_location, !location to start CUT end_location; !location to end CUT ! Cut from the beginning of the Start line, to the END_OF the End line If FORMS$END_LINE > 0 then ! If end line isn't > 0, caller isn't ! requesting buffer to be chopped ! into two buffers ! Position to the start of the user's edit section position( beginning_of(forms$main) ); move_vertical( FORMS$START_LINE - 1 ); start_location := mark(none); move_vertical( FORMS$END_LINE - FORMS$START_LINE -1 ); if (current_character <> "") AND (mark(NONE) <> end_of(current_buffer)) then !empty line position (search (line_end, FORWARD) ); endif; end_location := mark(none); position( start_location ); !Default to Start of edit section ! Cut range of text to FORMS$EDIT forms$range := create_range( start_location, end_location, BOLD); forms$edit := create_buffer( 'Forms$EDIT' ); set (EOB_TEXT, forms$edit, "[End of !AS section]" ); position (forms$edit); copy_text (forms$range); !copy: but save original set (MODIFIED, forms$edit, OFF); !Buffer is NEW, not modified yet ! Position in edit buffer, and place it on the screen position( start_location ); !Leave cursor at start of cut !area for when we return to !it position( beginning_of(forms$edit) ); map (user_window, forms$edit); endif; !if forms$end_line > 0 endprocedure; ! FORMS_FDE_EDIT.TPU 27-JAN-1989 11:46 Page 14 !++ ! ! FORMS$STARTUP ! ! This procedure sets things up for FORMS editing. ! ! 1) Positions to proper range in buffer ! 2) Positions to FORMS$MAIN (if we aren't cutting text) ! -or- Cuts Text to FORMS$EDIT (if we are cutting text) ! 3) Sets up help constants for EVE V2.0 help ! 4) Tells user how to get help ! !-- procedure forms$startup !Initialization routine local user_window, !User's initial window user_buffer; !User's initial buffer user_buffer := current_buffer; !save these user_window := current_window; ! ! Delete unused MAIN buffer (if it's not permanent,system, or modified) ! if get_info( user_buffer, "TYPE" ) = BUFFER then if (not get_info (user_buffer, "permanent")) and (not get_info (user_buffer, "system")) and (not get_info (user_buffer, "modified")) and (get_info (user_buffer, "record_count") = 0) then delete( user_buffer ) endif endif; ! ! Default to top line, if negative number sent ! if forms$start_line <= 0 then forms$start_line := 1 endif; !catch errors ! ! Cut from the beginning of the Start line, to the END_OF the End line ! If FORMS$END_LINE > 0 then ! If end line isn't > 0, caller isn't ! requesting buffer to be chopped ! into two buffers forms$cut_buff ( user_window ); endif; ! ! Position to FORMS$MAIN if we aren't cutting any text ! If FORMS$END_LINE <= 0 then ! if end line isn't > 0, caller isn't ! requesting buffer to be chopped ! into two buffers position( beginning_of(forms$main) ); move_vertical( FORMS$START_LINE - 1 ); ! Start line for edit map (user_window, forms$main); endif; ! ! Force status line update (No generic way to do it if not lse or eve) ! And window update ! if forms$in_eve then eve$update_status_lines endif; if forms$in_lse then lse$set_status_line (user_window) endif; !** if forms$in_tpu then ??? endif; ! ! If LSE, change the COMPILE command to include /DEPENDENCY ! -- if that's what the user wants ! if forms$in_lse then ! ! If undefined, then we don't want /DEPENDENCY ! if get_info(forms$dependency_data, "type") = UNSPECIFIED then forms$dependency_data := 0; endif; ! ! Change the language compile string ! if forms$dependency_data then lse$do_command('MODIFY LANGUAGE IFDL/COMPILE="FORMS TRANSLATE/DEPENDENCY_DATA"'); endif; endif; ! ! Initialize whatever we can for help ! forms$initialize_help; !Initialize Help Library, etc. ! ! Now, force all output to the screen ! update (user_window); !Make sure we see it on screen before !we execute PGM below endprocedure; ! FORMS_FDE_EDIT.TPU 27-JAN-1989 11:46 Page 15 !+ ! ! FORMS$EXIT ! ! Paste edited parts back into WHOLE file on EXIT ! !- procedure forms$exit !Exit routine combines buffers if FORMS$END_LINE > 0 then position ( forms$range ); !Position to CUT/PASTE point erase ( forms$range ); !Erase old text move_text ( forms$edit ); !Copy new text delete ( forms$edit ); !Delete no longer used buffer endif; !if forms$end_line > 0 !** return (1) !Let EVE, etc do the rest of their exit processing endprocedure; ! FORMS_FDE_EDIT.TPU 27-JAN-1989 11:46 Page 16 !+ ! Startup all the forms procedures !- forms$startup; !startup forms things