home *** CD-ROM | disk | FTP | other *** search
Wrap
Text File | 1990-06-13 | 52.0 KB | 1,966 lines
$MACRO_FILE MESYS; {****************************************************************************** MESYS is loaded automatically by Multi-Edit upon startup. Multi-Edit will abort if it cannot find the MESYS macro file. MESYS contains the following macros: UNDO Executes an UNDO or REDO SETSCRN Sets up the screen based on the selected style. XZOOM Toggles between screen styles. INSTGL Toggles insert/overwrite mode. BSWORD Deletes the word before the cursor. DELWORD Deletes the word under the cursor. DELEOL Delete to end of line. HOME Implements the multi-stroke start of line/window/file function. END Implements the multi-stroke end of line/window/file function. CR Implements carriage return with indenting styles. DATETIME Stamps the date and time into a file. GOTOLINE Prompts for a line number to go to. TOPBLOCK Cursor to top of block. ENDBLOCK Cursor to end of block. TOPWIN Cursor to top of window. BOTWIN Cursor to bottom of window. SCROLLUP Scroll the window up one line. SCROLLDN Scroll the window down one line. PAGEBRK Insert a line with a page break. FIND_EXT Retrieves the extension specific setup from EXT.DB. MAKEUSERPATH Searches for a user specific file name. Creates it if neccesary. XLATECMDLINE Translates special "aliases", like <FILE>, <EXT>, etc. SETTABS Creates a temporary format line from the tab spacing parameter. EXTSETUP Setup a file/window format based on its extension. PATHSEARCH Searches for a filename in a given path SETFILENAME Adds in the default directory for an extension. CREATEWINDOW Creates a new window at the end of the window list. LDFILES Load files into windows. Allows wildcards. AUTOSAVE Implements the automatic save feature. PARMS1 Process command line switches. PARMLOAD Load files from the command line. *******************************************************************************} $MACRO UNDO; {*******************************MULTI-EDIT MACRO****************************** Name: UNDO Description: Performs an UNDO or REDO Parameters: /R causes a REDO instead of an UNDO (C) Copyright 1989 by American Cybernetics, Inc. ******************************************************************************} if xpos('/R', caps(mparm_str),1) then redo; else undo; end; END_MACRO; $MACRO SETSCRN; {*******************************MULTI-EDIT MACRO******************************* Name: SETSCRN Description: Sets up the screen based on the screen style set in the global int CUR_SCRN. This is setup in the installation and setup menu. (C) Copyright 1989 by American Cybernetics, Inc. ******************************************************************************} def_int( jx, wx, temp_win, old_row, old_min_col, old_max_col ); def_int( mb, fx,sx,mx, old_max, old_min, ny1, ny2, tr, nx1, nx2 ); def_int( w_id, skipg, ignore_icons ); def_str( win_parms[100], tstr[80]); def_char( tchar ); tr := refresh; refresh := false; temp_win := cur_window; SET_GLOBAL_INT('@MENUROW@', 0); old_max := max_window_row; old_min := min_window_row; old_max_col := max_window_col; old_min_col := min_window_col; ignore_icons := parse_int('/ICON=', mparm_str ); win_parms := parse_str('/P=', mparm_str); If parse_int('/M=',mparm_str) = 1 THEN min_window_row := parse_int('/MWR=', mparm_str); goto set_windows_only; END; tchar := Char(Global_Int('CUR_SCRN') + 64); If (tchar = 'A') or (tchar = 'B') then win_parms := global_str('@SCREEN_SET' + tchar); fx := parse_int( '/F=',win_parms ); sx := parse_int( '/S=',win_parms ); mx := parse_int( '/M=',win_parms ); mb := parse_int( '/MB=', win_parms ); min_window_col := parse_int( '/LB=', win_parms ); max_window_col := (screen_width + 1) - parse_int( '/RB=', win_parms ); status_macro(''); status_str := 'L: C: Multi-Edit ' + version + copy(' ', 1, 8 - length(version)) + '[ ] '; mode_col := 37; insert_col := 54; mem_col := 58; time_col := 65; caps_col := 52; record_col := 50; line_col := 3; col_col := 11; message_col := 1; message_length := 80; working_col := 37; Set_Global_Int('COM_MENU_BAR', 0 ); IF FX = 0 THEN Fkey_Row := 0; ELSE Fkey_Row := Screen_Length; END; If SX = 0 THEN Status_Row := 0; message_row := 1 + (mb <> 0); else Status_Row := 1; message_row := 2 + (mb <> 0); end; if mx = 0 then message_Row := 0; min_window_row := status_row + 1 + (mb <> 0); else min_window_row := message_row + 1; end; if mb <> 0 THEN Set_Global_Int('COM_MENU_BAR', 1 ); menu_bar_row := status_row + 1; menu_bar_col := 1; Else menu_bar_row := 0; end; max_window_Row := Screen_Length + (fx = 0); set_windows_only: jx := xpos('/MACRO=', win_parms, 1 ); if jx <> 0 then tstr := shorten_str(copy( win_parms, jx + 7, 40 )); if tstr <> '' then RM(tstr); end; end; set_windows: jx := 0; while jx < window_count do IF NOT(ignore_icons AND ((window_attr AND $40) <> 0)) THEN nx1 := win_x1; nx2 := win_x2; IF nx1 = old_min_col THEN nx1 := min_window_col; END; IF nx2 = old_max_col THEN nx2 := max_window_col; END; wx := win_y1 - old_min; ny1 := min_window_row + wx; if ny1 > (max_window_Row - 2) then ny1 := max_window_row - 2; end; wx := old_max - win_y2; ny2 := max_window_row - wx; if ny2 < (min_window_row + 2) then ny2 := min_window_row + 2; end; IF (window_attr and $40) <> 0 THEN ny2 := ny1; END; Size_window(nx1,ny1,nx2,ny2); END; ++jx; Switch_Window(cur_window + 1); end; end; Mouse := Mouse; Mou_Set_Limits( 1, 1, Screen_Width, Screen_Length ); new_screen; refresh := tr; END_MACRO; $MACRO XZOOM TRANS; {*******************************MULTI-EDIT MACRO******************************* Name: XZOOM Description: toggles between screen styles. (C) Copyright 1989 by American Cybernetics, Inc. ******************************************************************************} def_int(jx); jx := Global_Int('CUR_SCRN'); if jx = 1 then jx := 2; else jx := 1; end; set_global_int('Cur_Scrn',jx); RM('SETSCRN'); new_screen; END_MACRO; $MACRO INSTGL; {*******************************MULTI-EDIT MACRO******************************* Name: INSTGL Description: toggles between insert and overwrite modes. (C) Copyright 1989 by American Cybernetics, Inc. ******************************************************************************} Insert_Mode := NOT( Insert_Mode ); END_MACRO; $MACRO BSWORD FROM EDIT; {*******************************MULTI-EDIT MACRO******************************* Name: BSWORD Description: This macro deletes the word before the cursor(And you thought it had something to do with cow pies). (C) Copyright 1989 by American Cybernetics, Inc. ******************************************************************************} Push_Undo; IF C_Col = 1 THEN BACK_SPACE; GOTO EXIT; END; IF at_eol THEN eol; END; LEFT; IF xpos(cur_char,' |9|255',1) THEN kill_white_space: while xpos(cur_char,' |9|255',1) AND (c_col > 1) do del_char; left; END; END; IF xpos(cur_char,word_delimits,1) = 0 THEN while (xpos(cur_char,word_delimits,1) = 0) AND (c_col > 1) DO del_char; left; END; right; goto exit; END; while (xpos(cur_char,word_delimits,1) <> 0) AND (c_col > 1) DO del_char; left; END; right; EXIT: Pop_Undo; END_MACRO; $MACRO DELWORD FROM EDIT; {*******************************MULTI-EDIT MACRO******************************* Name: DELWORD Description: This macro deletes the word after the cursor (C) Copyright 1989 by American Cybernetics, Inc. ******************************************************************************} def_int(jx,tr); tr := refresh; jx := 0; Push_Undo; If (AT_EOL) THEN Del_Char; Goto Exit; End; refresh := false; Delete1: {IF on white space, then delete only to non-white space } IF xpos(cur_char,' |255|9', 1) <> 0 THEN delete_white_space: WHILE NOT(At_Eol) AND (xpos(cur_char,' |255|9', 1) <> 0) DO ++jx; Del_Char; END; IF jx = 1 THEN goto delete_word_delimits; END; goto exit; END; ++jx IF (XPOS(Cur_Char,Word_Delimits,1) <> 0) THEN delete_word_delimits: WHILE (NOT(AT_EOL)) AND (XPOS(Cur_Char,Word_Delimits,1) <> 0) DO ++jx; del_char; END; GOTO Exit; END; WHILE (NOT(AT_EOL)) AND (XPOS(Cur_Char,Word_Delimits,1) = 0) DO ++jx; Del_Char; END; goto delete_white_space; EXIT: refresh := tr; Pop_Undo; END_MACRO; $MACRO DELEOL FROM EDIT; {*******************************MULTI-EDIT MACRO******************************* Name: DELEOL Description: Deletes to the end of a line (C) Copyright 1989 by American Cybernetics, Inc. ******************************************************************************} Def_Int(jx); Jx := Length(Get_Line); Del_Chars(jx - c_col + 1); END_MACRO; $MACRO HOME; {*******************************MULTI-EDIT MACRO******************************* Name: HOME Description: Implements the home function as follows: If the home key is pressed once, then the cursor will go to: A. The current indent level if the cursor is beyond the current indent level. B. Column 1 if the cursor is less than or equal to the current indent level. The following stuff requires that the /T=nn parameter be passed to HOME where nn is the number of milliseconds to wait for the next keypress. If the home key is pressed twice in rapid succession and the cursor is NOT at the top of the window, then the cursor will go to the top of the window. If the cursor is at the top of the window, then the cursor will be moved to the top of the file. If the home key is pressed three times in rapid succession, then the cursor will be moved to the top of the file. (C) Copyright 1989 by American Cybernetics, Inc. ******************************************************************************} def_int( k1, k2, tm, tc ); k1 := key1; k2 := key2; PUSH_UNDO; loop: tc := c_col; IF tc > 1 THEN first_word; END; IF (c_col > 1) AND (c_col < tc) THEN goto exit; END; if (at_eol) then if tc > indent_level then goto_col(indent_level); end; else if c_col >= tc then goto_col(1); end; end; tm := Parse_Int( '/T=', MParm_Str ); IF ( tm > 0 ) THEN if check_key then goto home_on; end; delay(TM); if check_key then home_on: if (key1 = k1) and (key2 = k2) then if c_row = 1 then goto try_tof; end; while c_row > 1 do up; end; goto_col(1); if check_key then goto home_on2; end; delay(TM); if check_key then home_on2: if (key1 = k1) and (key2 = k2) then try_tof: tof; goto exit; end; end; end; goto push_exit; end; END; goto exit; push_exit: push_key( key1, key2 ); exit: POP_UNDO; END_MACRO; $MACRO END; {*******************************MULTI-EDIT MACRO******************************* Name: END Description: Implements the end of line function as follows: If the end key is pressed once then, the cursor will go to the end of line. The following stuff requires that the /T=nn parameter be passed to END where nn is the number of milliseconds to wait for the next keypress. If the end key is pressed twice in rapid succession and the cursor is NOT at the bottom of the window, then the cursor will go to the bottom of the window. If the cursor is at the bottom of the window, then the cursor will be moved to the end of the file. If the end key is pressed three times in rapid succession, then the cursor will be moved to the end of the file. (C) Copyright 1989 by American Cybernetics, Inc. ******************************************************************************} def_int( k1, k2, wl, tm ); k1 := key1; k2 := key2; PUSH_UNDO; loop: eol; tm := Parse_Int( '/T=', MParm_Str ); IF ( tm > 0 ) THEN if check_key then goto end_on; end; delay(TM); if check_key then end_on: if (key1 = k1) and (key2 = k2) then wl := win_y2 - win_y1 - 1; if c_row = wl then goto try_eof; end; while c_row < wl do down; end; eol; if at_eof then eof; end; if check_key then goto end_on2; end; delay(TM); if check_key then end_on2: if (key1 = k1) and (key2 = k2) then try_eof: eof; goto exit; end; end; end; goto push_exit; end; END; goto exit; push_exit: push_key( key1, key2 ); exit: POP_UNDO; END_MACRO; $MACRO CR; {*******************************MULTI-EDIT MACRO****************************** Name: CR Description: Performs a carriage return according to INDENT_STYLE: 0 = None. Just do a plain carriage return 1 = Auto. Indents to first word of previous line. 2 = Smart. Uses language specific smart indenting. (C) Copyright 1989 by American Cybernetics, Inc. ******************************************************************************} Def_Str(tstr); Def_Int(jx, temp_ins); Push_Undo; {If auto-indent then} IF Indent_Style = 1 THEN JX := C_COL; FIRST_WORD; IF At_EOL = False THEN SET_INDENT_LEVEL; END; GOTO_COL(JX); Goto ExitX; END; IF Indent_Style = 2 THEN TStr := Global_Str('.'+Get_Extension(file_name)); TStr := Parse_Str('LS=',TStr); IF TStr <> '' THEN RM( TSTR + '^' + Copy(TStr,1,3) + '_IND' ); If Error_Level <> 0 THEN Error_Level := 0; Make_Message('Smart indent macro NOT found.'); Goto ExitX; END; Goto Exit; END; GOTO EXITX; END; EXITX: {If in then insert a hard carriage return if one is defined} IF (HARD_CR <> '') and (HARD_CR <> '|0') THEN Temp_Ins := Insert_Mode; Insert_Mode := True; Text(Hard_CR); CR; IF wrap_stat THEN word_wrap_line( FALSE, TRUE ); END; Insert_Mode := Temp_Ins; ELSE jx := c_col; CR; if (insert_mode = false) and (jx >= indent_level) then goto_col(indent_level); end; END; EXIT: Pop_Undo; END_MACRO; $MACRO DATETIME; {*******************************MULTI-EDIT MACRO****************************** Name: DATETIME Description: Writes the current date and time onto the current line. (C) Copyright 1989 by American Cybernetics, Inc. ******************************************************************************} TEXT( DATE + ' ' + STR_DEL(TIME,6,3)); END_MACRO; $MACRO GOTOLINE; {*******************************MULTI-EDIT MACRO****************************** Name: GOTOLINE Description: Prompts for a line number, then moves the cursor to that line. Parameters: /X= The column to place the prompt box. /Y= The line to place the prompt box. (C) Copyright 1989 by American Cybernetics, Inc. ******************************************************************************} DEF_INT(jx,jj); Return_Str := ''; Return_Int := Global_Int('@GOTOLINE#'); IF return_int < 1 then return_int := 1; end; RM('userin^QUERYBOX /N=1/Min=1/L=' + parse_str('/Y=', mparm_str) + '/C=' + parse_str('/X=', mparm_str) + '/W=12/P=Line number: /T=GO TO LINE/H=GOTOLINE'); IF Return_Str = 'TRUE' THEN GOTO_LINE(return_int); Set_Global_Int('@GOTOLINE#', return_int); return_int := 100; Else return_int := 0; END; END_MACRO; $MACRO TOPBLOCK; {*******************************MULTI-EDIT MACRO****************************** Name: TOPBLOCK Description: Take cursor to top of currently defined block (C) Copyright 1989 by American Cybernetics, Inc. ******************************************************************************} If Block_Stat <> 0 THEN Goto_Line( Block_Line1 ); If Block_Stat <> 1 THEN Goto_Col( Block_Col1 ); END; Redraw; END; END_MACRO; $MACRO ENDBLOCK; {*******************************MULTI-EDIT MACRO****************************** Name: ENDBLOCK Description: Take cursor to bottom of currently defined block (C) Copyright 1989 by American Cybernetics, Inc. ******************************************************************************} If Block_Stat <> 0 THEN Goto_Line( Block_Line2 ); If Block_Stat <> 1 THEN Goto_Col( Block_Col2 ); END; Redraw; END; END_MACRO; $MACRO TOPWIN; {*******************************MULTI-EDIT MACRO****************************** Name: TOPWIN Description: Take cursor to top of the window (C) Copyright 1989 by American Cybernetics, Inc. ******************************************************************************} WHILE (C_Row > 1) DO Up; END; END_MACRO; $MACRO BOTWIN; {*******************************MULTI-EDIT MACRO****************************** Name: BOTWIN Description: Take cursor to bottowm of the window (C) Copyright 1989 by American Cybernetics, Inc. ******************************************************************************} WHILE (C_Row < ((Win_Y2 - Win_Y1) - 1)) DO Down; END; END_MACRO; $MACRO SCROLLUP; {*******************************MULTI-EDIT MACRO****************************** Name: SCROLLUP Description: Scroll screen up one line (C) Copyright 1989 by American Cybernetics, Inc. ******************************************************************************} def_int( jx ); jx := refresh; refresh := false; Goto_Line(C_Line + 1); Redraw; refresh := jx; END_MACRO; $MACRO SCROLLDN; {*******************************MULTI-EDIT MACRO****************************** Name: SCROLLDN Description: Scroll screen down one line (C) Copyright 1989 by American Cybernetics, Inc. ******************************************************************************} def_int( jx ); jx := refresh; refresh := false; Goto_Line( C_Line - 1 ); Redraw; refresh := jx; END_MACRO; $MACRO PAGEBRK; {*******************************MULTI-EDIT MACRO****************************** Name: PAGEBRK Description: Insert a page break (C) Copyright 1989 by American Cybernetics, Inc. ******************************************************************************} UP; EOL; CR; GOTO_COL(1); TEXT( PAGE_STR ); UP; DOWN; END_MACRO; $MACRO FIND_EXT; {*******************************MULTI-EDIT MACRO****************************** Name: FIND_EXT Description: Makes sure extension specific setup globals are loaded for the passed extension. Parameters: /EXT=str Str is the extension to use (including the leading "."). Returns: RETURN_STR contains the name of the global to use to access the extension specific setup. (C) Copyright 1989 by American Cybernetics, Inc. ******************************************************************************} Def_Str(Ext[8]); Ext := Caps(Parse_Str('/EXT=',MParm_Str)); IF (Ext = '.') THEN Goto DEFAULT; END; IF (Global_Str(Ext) = '!DEFAULT!') THEN goto DEFAULT; END; IF (Global_Str(Ext) = '') THEN RM('USERIN^DB /F=MECONFIG.DB/NDF=1/DPT=EXT.DB/GLO=' + Ext + '/RR=1/FV=' + Copy(Ext,2,3)); IF (Return_Int = -1) THEN DEFAULT: Set_Global_Str(Ext, '!DEFAULT!'); Ext := '.DEFAULT'; IF (Global_Str(Ext) = '') THEN RM('USERIN^DB /F=MECONFIG.DB/NDF=1/DPT=EXT.DB/GLO=' + Ext + '/RR=1/FV=DEFAULT'); END; Return_Int := -1; ELSE Return_Int := 0; END; IF xpos( ext + '', Global_Str('EXTENSIONS'), 1 ) = 0 THEN Set_Global_Str('EXTENSIONS',Global_Str('EXTENSIONS') + Ext + ''); END; ELSE Return_Int := 0; END; EXIT: return_str := ext; END_MACRO; $MACRO MAKEUSERPATH; {*******************************MULTI-EDIT MACRO****************************** Name: MakeUserPath Description: Takes the filename in RETURN_STR and converts it to a complete path and filename for the current USER_ID. Automatically creates a .USR subdirectory if one doesn't exist for the current USER_ID. Parameters: /DF=n 1 = Copy default file if specified file doesn't exist. (C) Copyright 1989 by American Cybernetics, Inc. ******************************************************************************} def_int( t_attr, jx ); def_str( tstr[120], t_search_rec[64] ); Return_Str := Truncate_Path( return_str ); t_attr := File_Search_Attr; t_search_rec := file_search_rec; File_Search_Attr := $37; IF user_id = '' THEN Return_Str := Me_Path + Return_Str; goto exit; END; tstr := me_path + user_id + '.USR'; IF (first_file( tstr ) <> 0) THEN IF MkDir( tstr ) <> 0 THEN error_level := 3003; tstr := me_path; goto exit2; END; END; tstr := tstr + '\'; exit2: return_str := tstr + return_str; File_Search_Attr := $27; IF (first_file( return_str ) <> 0) THEN IF parse_int('/DF=',mparm_Str) THEN jx := Copy_File( me_path + truncate_path(return_str), return_str, false ); END; END; exit: file_search_rec := t_search_rec; File_Search_Attr := t_attr; END_MACRO; $MACRO XLATECMDLINE; {*******************************MULTI-EDIT MACRO****************************** Name: XlateCmdLine Description: Translates RETURN_STR so that any occurances of <FILE>, <NAME>, <EXT>, <PATH>, <ME_PATH>, <USER_PATH> are expanded out. Parameters: /F=str The filename to use. (C) Copyright 1989 by American Cybernetics, Inc. ******************************************************************************} def_str( fname[128] ); def_int( jx ); fname := parse_str('/F=', mparm_str ); INSERT_FILE: JX := XPOS('<FILE>',Caps(return_str),1); IF jx <> 0 THEN return_str := Str_Del(return_str,jx,6); return_str := Str_Ins(Truncate_Extension(fname),return_str,jx); Goto INSERT_FILE; END; INSERT_EXT: JX := XPOS('<EXT>',Caps(return_str),1); IF jx <> 0 THEN return_str := Str_Del(return_str,jx,5); return_str := Str_Ins(Get_Extension(fname),return_str,jx); Goto INSERT_EXT; END; INSERT_NAME: JX := XPOS('<NAME>',Caps(return_str),1); IF jx <> 0 THEN return_str := Str_Del(return_str,jx,6); return_str := Str_Ins(Truncate_Path(Truncate_Extension(fname)),return_str,jx); Goto INSERT_NAME; END; INSERT_PATH: JX := XPOS('<PATH>',Caps(return_str),1); IF jx <> 0 THEN return_str := Str_Del(return_str,jx,6); return_str := Str_Ins(Get_Path(fname),return_str,jx); Goto INSERT_PATH; END; INSERT_ME_PATH: JX := XPOS('<ME_PATH>',Caps(return_str),1); IF jx <> 0 THEN return_str := Str_Del(return_str,jx,9); return_str := Str_Ins(me_path,return_str,jx); Goto INSERT_ME_PATH; END; INSERT_COMSPEC: JX := XPOS('<COMSPEC>',Caps(return_str),1); IF jx <> 0 THEN return_str := Str_Del(return_str,jx,9); return_str := Str_Ins(comspec,return_str,jx); Goto INSERT_COMSPEC; END; INSERT_USER_PATH: JX := XPOS('<USER_PATH>',Caps(return_str),1); IF jx <> 0 THEN return_str := Str_Del(return_str,jx,11); IF user_id = '' THEN return_str := Str_Ins(me_path,return_str,jx); ELSE return_str := Str_Ins(me_path + user_id + '.USR\',return_str,jx); END; Goto INSERT_USER_PATH; END; INSERT_USER_ID: JX := XPOS('<USER_ID>',Caps(return_str),1); IF jx <> 0 THEN return_str := Str_Del(return_str,jx,9); return_str := Str_Ins(User_id,return_str,jx); Goto INSERT_USER_ID; END; END_MACRO; $MACRO SETTABS; {*******************************MULTI-EDIT MACRO****************************** Name: SETTABS Description: Sets up even interval tab spacing. Parameters: /TS=nn Tab spacing. (C) Copyright 1989 by American Cybernetics, Inc. ******************************************************************************} Def_Int( Tab_Size, jx, margin ); Def_Str( tformat[2048]); Tab_Size := Parse_Int('/TS=', mparm_str ); Margin := Parse_Int('/RM=', mparm_str ); IF (Margin < 1) or (Margin > 2048) THEN Margin := 128; END; TFormat := ' '; While SVL(TFormat) < Margin DO Jx := 1; While jx < Tab_Size DO TFormat := TFormat + ' '; ++jx; END; TFormat := TFormat + '|16'; END; Format_Line := TFormat; Format_Stat := False; END_MACRO; $MACRO EXTSETUP; {*******************************MULTI-EDIT MACRO****************************** Name: EXTSETUP Description: Is called to setup a window/file based on the files extension. If the extension is not found in the global extension list, then the default extension setup is used. Parameters: /PRE= If 1, then post-load macro will not be run, such as would be the case if this was run after the file had already been loaded. Returns: Return_Str = default directory for file. (C) Copyright 1989 by American Cybernetics, Inc. ******************************************************************************} {Need to find out how right_margin is getting set to 254, then make it so that if UT=0 and TS=0 and RM>0, then right_margin will still be set correctly. Make_Message('Before RM=' + Str(Right_Margin)); Read_Key; Right_margin := 0; } Def_Str(TStr1[2048],TStr2,Tstr3); Def_Int(JX,jy,default); default := false; RM( 'FIND_EXT /EXT=.' + get_extension( file_name ) ); Tstr3 := Return_Str; TStr1 := Global_Str(tstr3); Wrap_Stat := Parse_Int('WW=', TStr1 ); indent_style := Parse_Int('IND=', TStr1 ); IF (Indent_Style > 0) THEN Indent_Style := Indent_Style - 1; END; Doc_Mode := Parse_Int('DOC=', TStr1 ); IF Format_Stat = 0 THEN IF (Parse_Int('UF=',TStr1) = 0) THEN JX := Parse_Int('TS=',TStr1); IF (JX <> 0) THEN RM('SETTABS /TS=' + str( jx ) + '/RM=' + PARSE_str( 'RM=',TStr1 ) ); JX := Parse_Int('RM=',TStr1); IF (JX <> 0) THEN Right_Margin := jx; ELSE Right_Margin := 80; END; {Here, we are deleting any defined format line from the global to conserve ram} Jx := XPos('FORMAT=',Tstr1,1); IF (Jx) THEN Jy := Length(Parse_Str('FORMAT=',Tstr1)); Set_Global_Str(TStr3,Str_Del(TStr1,Jx,Jy + 8)); END; ELSE Goto USE_FORMAT; END; ELSE USE_FORMAT: TStr2 := Parse_Str('FORMAT=',TStr1); If Tstr2 <> '' then Format_Line := TStr2; Format_Stat := false; END; IF (XPos('R',Caps(Format_Line),1) = 0) THEN {If there is no right_margin defined in the format line, see if there is one defined explicity} Right_Margin := Parse_Int('RM=',TStr1); END; END; END; IF Parse_Int('/PRE=', MParm_Str) = 0 THEN TStr3 := Parse_Str('LS=', tstr1); RM( copy(tstr3,1,8) + '^' + copy(tstr3,1,3) + 'SETX'); error_level := 0; TStr3 := Parse_Str('MAC=',TStr1); If TStr3 <> '' THEN RM(TStr3); END; END; EXIT: { Make_Message('After RM=' + Str(Right_Margin)); Read_Key; } END_MACRO; $MACRO PATHSEARCH; {*******************************MULTI-EDIT MACRO****************************** Name: PathSearch Description: Searches for a filename in a given path Parameters: /F=str The filename RETURN_STR contains the path. For example: "\;C:\ME;C:\MASM" (C) Copyright 1989 by American Cybernetics, Inc. ******************************************************************************} def_str( fname[20], fpath[120] ); def_int( jx, jy ); fname := parse_str('/F=',mparm_str); jy := 0; fpath := ''; goto first_time; LOOP: IF jy > length(return_str) THEN RETURN_INT := 0; goto exit; END; CALL parse_path; first_time: IF file_exists( fpath + fname ) THEN return_int := 1; return_str := fexpand(fpath + fname); goto exit; END; goto loop; Parse_Path: jx := XPos( ';', return_str, jy + 1 ); IF jx = 0 THEN jx := LENGTH( return_str ) + 1; END; fpath := Copy( return_str, jy + 1, jx - jy - 1 ); if (SVL(fpath) > 0) AND (copy(fpath,SVL(fpath),1) <> '\') then fpath := fpath + '\'; end; jy := jx; RET; EXIT: END_MACRO; $MACRO SETFILENAME; {*******************************MULTI-EDIT MACRO****************************** Name: SETFILENAME Description: Completes a filename (no wildcards). Adds in the default directory for that extension if none is specified. Parameters: Return_Str = Filename Returns: Return_Str = new Filename (C) Copyright 1989 by American Cybernetics, Inc. ******************************************************************************} def_str( tstr[128], gstr[20] ); def_int( jx ); tstr := return_str; if get_path(tstr) = '' then RM( 'FIND_EXT /EXT=.' + get_extension( tstr ) ); gstr := return_str; return_str := parse_str('DIR=',Global_Str(gstr)); RM('PathSearch /F=' + tstr); IF return_int = 0 THEN return_str := parse_str('DIR=',Global_Str(gstr)); jx := xpos(';', return_str, 1); IF jx = 0 THEN jx := length(return_str) + 1; END; return_str := copy(return_str,1, jx - 1); if (Length(return_str) > 0) AND (copy(return_str,Length(Return_Str),1) <> '\') then return_str := return_str + '\'; end; return_str := return_str + tstr; END; END; Expand_Exit: return_str := fexpand( return_str ); END_MACRO; $MACRO CREATEWINDOW; {*******************************MULTI-EDIT MACRO****************************** Name: CreateWindow Description: Creates a new window at the end of the window list. (C) Copyright 1989 by American Cybernetics, Inc. ******************************************************************************} def_int( jx, tr, x1, x2, y1, y2, ox1,oy1 ); def_str( tstr[40] ); tr := refresh; refresh := FALSE; jx := cur_window; Switch_Window(Window_COunt); Error_Level := 0; CREATE_WINDOW; IF error_level = 0 THEN screen_num := global_int('@SCREEN_COUNT') + 1; if screen_num <= 1 then screen_num := 2; end; set_global_int('@SCREEN_COUNT', screen_num ); tstr := global_str('@INIT_WINDOW_PARMS'); IF tstr <> '' THEN x1 := parse_int('/X1=', tstr); x2 := parse_int('/X2=', tstr); y1 := parse_int('/Y1=', tstr); y2 := parse_int('/Y2=', tstr); IF x1 < min_window_col THEN x1 := min_window_col; END; IF (x2 = 0) OR (x2 > max_window_col) THEN x2 := max_window_col; END; IF y1 < min_window_row THEN y1 := min_window_row; END; IF (y2 = 0) OR (y2 > max_window_row) THEN y2 := max_window_row; END; size_window( x1, y1, x2, y2 ); END; ELSE switch_window(jx); END; refresh := TR; END_MACRO; $MACRO LDFILES; {*******************************MULTI-EDIT MACRO****************************** Name: LDFILES Description: Loads files into windows. Handles wild card characters. Normally, LDFILES checks to see if the file is already loaded. Parameters: RETURN_STR = the filename; /LC=load_count /MC=max_count /NW=1 no wildcards allowed. /NC=1 no check for the file already loaded. /X= X coordinate for prompt box. /Y= Y coordinate for prompt box. /PRE= Will pass this parameter to EXTSETUP /CW=1 create new window immediately, regardless of /LC= If LDFILES is entered with LOAD_COUNT set to zero, then the first file will be loaded into the current window. Subsequent files will be loaded into new windows. Returns: Return_Int = LOAD_COUNT. Also, Global integer LOAD_COUNT will be set to /LC=nn + the number of files loaded. (C) Copyright 1989 by American Cybernetics, Inc. ******************************************************************************} Def_Int( Load_Count, lc2 , good_load); Def_Str( Tstr[128], TStr2[128], t_search_rec[64] ,MSTr[128]); def_int( t_win, x1, y1, tr, max_count, wild_cards, load_check,T_File_Search_Attr ); x1 := parse_int('/X=', mparm_str); y1 := parse_int('/Y=', mparm_str); good_load := False; t_search_rec := file_search_rec; T_File_Search_Attr := File_Search_Attr; File_Search_Attr := $27; if x1 = 0 then x1 := 2; end; if y1 = 0 then y1 := 2; end; TStr := return_str; load_check := (parse_int('/NC=', mparm_str) = 0); wild_cards := (parse_int('/NW=', mparm_str) = 0); Load_Count := parse_int('/LC=',mparm_str); max_count := parse_int('/MC=',mparm_str); if max_count = 0 then max_count := 1000; end; lc2 := parse_int('/CW=', mparm_str ); IF (wild_cards) and ((POS('*',TStr) > 0) or (POS('?',TStr) > 0)) THEN TStr2 := Get_Path(TStr); IF FIRST_FILE(TSTR) = 0 THEN TStr := TStr2 + LAST_FILE_NAME; Call Do_Load_File; WHILE (NEXT_FILE = 0) and (Load_Count < max_count) DO TStr := TStr2 + LAST_FILE_NAME; Call Do_Load_File; END; END; ELSE return_str := tstr; RM('SetFileName'); tstr := return_str; Call DO_LOAD_FILE; END; Set_Global_Int('LOAD_COUNT',Load_Count); return_int := load_count; GOTO Exit; DO_LOAD_FILE: tstr := caps(FExpand(TStr)); t_win := cur_window; tr := refresh; refresh := false; if load_check then if switch_file( tstr ) then RM( 'USERIN^VERIFY /H=FL/T=' + tstr + ' already loaded, load again? /L=' + str(y1) + '/C=' + str(x1) ); IF return_int <= 0 then ++Load_Count; window_attr := 0; refresh := tr; good_load := False; ret; end; switch_window( t_win ); end; end; IF (Load_Count + lc2) > 0 THEN Error_Level := 0; If Window_Count >= 100 THEN Goto NO_WINDOWS; END; IF load_count > 0 THEN refresh := FALSE; ELSE refresh := TRUE; END; RM('CreateWindow'); Redraw; IF Error_Level <> 0 THEN no_windows: Load_Count := 20000; Error_Level := 0; Make_Message('OUT OF WINDOWS!!!'); good_load := False; RET; END; END; if load_count = 0 then refresh := tr; end; Make_Message('Loading "' + TStr + '"...'); If Load_Count > 0 then XLoad_File(Tstr); Else Load_File(TStr); END; If Error_Level = 3002 then mstr := ''; Error_Level := 0; RETURN_INT := 0; IF global_str('@FNF_LOAD_MACRO@') <> '' THEN RM( global_str('@FNF_LOAD_MACRO@') + ' /F=' + tstr ); END; IF return_int = 0 THEN If File_Name = '?No-File?' THEN MStr := TStr + ' NOT Found, NEW file assumed.'; File_Name := FExpand(TStr); Else Error_level := 3002; Mstr := 'Error:'+Str(Error_Level)+' occured loading "' + TStr + '"'; END; END; ELSIf error_level <> 0 then RM('MEERROR^ERRMSG'); Mstr := '"' + TStr + '": Error ' + str(error_level) + ' ' + return_str; ELSIF (Load_Count > 0) or (EOF_IN_MEM > 0) THEN If Read_Only THEN TStr := ' (Read-Only).'; ELSE TStr := '.'; END; Mstr := '"' + File_Name + '" loaded' + tstr; ELSE Mstr := 'Insufficient RAM to load all of file, swapping will occur.'; END; IF mstr <> '' THEN Make_Message(MStr); END; if error_level = 0 then RM( 'EXTSETUP /PRE=' + parse_str('/PRE=',mparm_str)); end; ++Load_Count; File_Changed := False; good_load := True; RET; EXIT: test2: file_search_rec := t_search_rec; File_Search_Attr := T_File_Search_Attr; RM('WINDOW^SetWindowNames'); END_MACRO; $MACRO AUTOSAVE; {*******************************MULTI-EDIT MACRO****************************** Name: AUTOSAVE Description: Checks all windows and saves all modified files. Can be invoked by the autosave timer system, or as part of the exit macro. Parameters: /EX=1 tells autosave to clean up autosave files and save all changed files if the global autosave_ext was defined. /EX=2 tells autosave to clean up autosave files and exit if the global autosave_ext was defined. if the global autosave_ext is not defined the parameter /EX has no effect (C) Copyright 1989 by American Cybernetics, Inc. ******************************************************************************} Def_Int(Save_Count,JX,OLD_WIN, t_error, b1, old_refresh); {Start of .ASV modification block 1 } Def_Str(f_name, flg_name, ASV_name, save_ext); def_int (t_Ex, tmp_backup); t_Ex := Parse_Int('/EX=', mparm_str); {End of .ASV modification block 1 } old_refresh := refresh; Refresh := False; OLD_WIN := CUR_WINDOW; Save_Count := 0; t_error := 0; b1 := 0; JX := 1; While jx <= Window_Count DO Switch_Window(jx); ++jx; {Start of .ASV modification block 2 } save_ext := '.' + global_str( 'autosave_ext' ); flg_name := Truncate_Extension(Truncate_Path(File_Name)) + save_ext; IF (t_Ex) THEN IF (Global_Int(flg_name)) THEN if (backups = 2) Then ASV_Name := Backup_Path + Truncate_Extension(Truncate_Path(File_Name)) + save_ext; else ASV_Name := Truncate_Extension(File_name) + save_ext; end; Put_Box( 20, 5, 60, 8, 0, m_s_color, 'REMOVING AUTOSAVE FILES...', TRUE ); Draw_Char( 32, 22, 6, m_t_color, 35 ); Write( truncate_path( ASV_name ), 26, 6, 0, m_t_color ); Set_File_Attr(ASV_name,0); del_file(ASV_name); {delete autosave file if exiting} File_changed := TRUE; END; save_ext := '.'; END; IF ((t_Ex = 2) and (global_str( 'autosave_ext' ) <> '')) THEN goto ASV_quit; END; {End of .ASV modification block 2 } IF (File_Changed <> 0) AND ((window_attr AND $80) = 0) THEN IF NOT(b1) THEN b1 := TRUE; Put_Box( 20, 5, 60, 8, 0, m_s_color, 'SAVING FILES...', TRUE ); END; Draw_Char( 32, 22, 6, m_t_color, 35 ); Write( truncate_path( file_name ), 26, 6, 0, m_t_color ); If CAPS(File_Name) = '?NO-FILE?' THEN Refresh := True; Redraw; RM( 'MEUTIL1^SAVEFILE' ); Refresh := False; ELSE {Start of .ASV modification block 3} IF (save_ext <> '.') THEN f_name := File_Name; if (backups = 2) Then File_Name := Backup_Path + Truncate_Extension(Truncate_Path(File_Name)) + save_ext; else File_Name := Truncate_Extension(File_name) + save_ext; end; Set_Global_Int(flg_name,1); if (CAPS(TRUNCATE_PATH(File_Name)) <> '!BUF.0') and (CAPS(TRUNCATe_PATH(File_Name)) <> 'MEFIND.TMP') then tmp_backup := backups; Backups := 0; SAVE_FILE; Backups := tmp_backup; end; File_Name := f_name; File_Changed := 0; ELSE SAVE_FILE; END; {End of .ASV modification block 3} END; IF Error_Level <> 0 THEN RM( 'MEERROR' ); t_error := true; END; ++Save_Count; END; ASV_quit: END; IF b1 THEN kill_box; END; Switch_Window(OLD_WIN); Refresh := old_refresh; return_int := t_error; END_MACRO; $MACRO AUTOSAVETIMER; {*******************************MULTI-EDIT MACRO****************************** Name: AUTOSAVETIMER Description: Manages autosave timer events. The timer can be based on the amount of time that has passed since the last time the user pressed a key (or moved the mouse), or on an absolute interval. This macro is only intended to be run by assigning it as a timer event macro. EXAMPLE: Timer_Handle := SET_TIMER_EVENT('AUTOSAVETIMER /NOW=0/T=10/S=0', 18, EDIT); Parameters: /NOW= If <> 0, will immediately autosave. This is for the absolute interval method. IF 0, then the keyboard inactivity method is used. /S= If <> 0, then the complete status of the editor is saved as well as the files. (C) Copyright 1989 by American Cybernetics, Inc. ******************************************************************************} IF (Global_Int('Menu_Level')) THEN {We don't want to autosave in the middle of a menu or prompt} Goto EXIT; END; IF parse_int('/NOW=', mparm_str) THEN goto GO_AUTOSAVE; END; IF global_int('@LAST_AUTOSAVE_TIME') < last_keypress_time THEN IF (last_event_time - last_keypress_time) >= parse_int('/T=', mparm_str) THEN GO_AUTOSAVE: set_global_int( '@LAST_AUTOSAVE_TIME', last_event_time ); SET_GLOBAL_INT('@TEMP_RETURN_INT', return_int ); SET_GLOBAL_STR('@TEMP_RETURN_STR', return_str ); RM('AUTOSAVE'); IF (Parse_Int('/S=',MParm_Str)) THEN RM('EXIT^STATUS'); END; return_int := Global_Int('@TEMP_RETURN_INT'); return_str := Global_Str('@TEMP_RETURN_STR'); set_global_int('@TEMP_RETURN_INT',0); set_global_str('@TEMP_RETURN_STR',''); update_status_line; END; END; EXIT: END_MACRO; $MACRO SETAUTOSAVE; {*******************************MULTI-EDIT MACRO****************************** Name: SETAUTOSAVE Description: Creates 1 or 2 autosave events from parameters passed by the installation and setup screen. Parameters: /H1= Existing timer event handle. This macro will release this handle before assigning a new one to replace it. The new handles are saved into GLOBAL_STR( '@AUTOSAVEPARMS') using identical parameter syntax. You must pass these handles to this macro, or they will remain in force. /H2= Same as above. /T1= Timeout factor for event 1 in seconds. /T2= Timeout factor for event 2. /M1= Timeout method for event 1. 0=Keyboard inactivity method. 1=Absolute interval method. /M2= Timeout method for event 2. (C) Copyright 1989 by American Cybernetics, Inc. ******************************************************************************} def_int( h1,h2,T1,T2,M1,M2,S1,S2); def_str( astr[80] ); astr := Global_str('@AUTOSAVEPARMS'); h1 := parse_int('/H1=', astr ); h2 := parse_int('/H2=', astr ); m1 := 0; m2 := 0; S1 := parse_int('/S1=', mparm_str ); S2 := parse_int('/S2=', mparm_str ); IF h1 <> 0 THEN kill_timer_event( h1 ); h1 := 0; END; IF h2 <> 0 THEN kill_timer_event( h2 ); h2 := 0; END; T1 := parse_int('/T1=', mparm_str ) * 18; T2 := parse_int('/T2=', mparm_str ) * 18; IF T1 > 0 THEN M1 := parse_int('/M1=', mparm_str ); IF M1 = 0 THEN h1 := set_timer_event('AUTOSAVETIMER /T=' + str( T1 ) + '/S=' + Str(S1), 28, EDIT); ELSIF M1 = 1 THEN h1 := set_timer_event('AUTOSAVETIMER /NOW=1/S=' + Str(S1), T1, edit); END; END; IF T2 > 0 THEN M2 := parse_int('/M2=', mparm_str ); IF M2 = 0 THEN h2 := set_timer_event('AUTOSAVETIMER /T=' + str( T2 ) + '/S=' + Str(S2), 28, EDIT); ELSIF M2 = 1 THEN h2 := set_timer_event('AUTOSAVETIMER /NOW=1/S=' + Str(S2), T2, edit); END; END; Set_Global_STR( '@AUTOSAVEPARMS', '/H1=' + str(H1) + '/H2=' + str(H2) + '/M1=' + str(M1) + '/M2=' + str(M2) + '/T1=' + str(T1 / 18) + '/T2=' + str(T2 / 18) + '/S1=' + str(S1) + '/S2=' + str(S2) ); END_MACRO; $MACRO PARMS1 DUMP; {*******************************MULTI-EDIT MACRO****************************** Name: PARMS1 Description: Called by Multi-Edit internally to process most command line parameters. Gets called before PARMLOAD, after INIT and before STARTUP. (C) Copyright 1989 by American Cybernetics, Inc. ******************************************************************************} Def_Int(Parm_Number); Def_Int(jx, default_back, kspeed ); Def_Str(TStr); Def_CHar(Tchar); kspeed := (Global_Int('NO_KEYSPEED') = 0); {Do we need to set default colors?} if global_int('DEFAULT_COLORS') then intr($11); if (r_ax and $0030) = $0030 then call set_mono; else call set_color; end; end; Parm_Number := 1; WHILE Parm_Number <= PARAM_COUNT DO TStr := Caps(PARAM_STR(Parm_Number)); IF XPOS(Copy(TStr,1,1),'/-',1) <> 0 THEN TStr := Copy(TStr,2,80); TChar := Copy(Tstr,1,1); IF (Length(TSTR) > 1) and (XPos(Copy(Tstr,2,1),'0123456789',1) <> 0) then IF VAL(jx, Copy(Tstr,2,8)) = 0 then end; ELSE If (Length(tstr) = 2) and (XPOS(Copy(Tstr,2,1), 'YN', 1) <> 0) then IF (Copy(Tstr,2,1) = 'Y') then jx := true; else jx := false; end; IF TChar = 'K' THEN Set_Global_Int('NO_KEYSPEED', jx = 0 ); kspeed := jx; end; If TChar = 'N' then Name_Line := jx; end; If TChar = 'L' then Logo_Screen := jx; end; ELSE If (Length(TStr) = 1) THEN {This is a list of command line options that occurs if a /? is used on the command line.} IF (Tchar = '?') THEN Write_Sod('The following command line options are available:|13|10'); Write_Sod(' /LN = Disable logo, /LY = Enable logo|13|10'); Write_Sod(' /MN = Mouse disable, /MY = Mouse enable|13|10'); Write_Sod(' /KN = Don''t change keyspeed, /KY = Change keyspeed|13|10'); Write_Sod(' /NR = No restore; Does not change the setup|13|10'); Write_Sod(' /B = Use black and white colors, /C = Use default colors|13|10'); Write_Sod(' /Xn = Sets screen width to n.|13|10'); Write_Sod(' /Yn = Sets screen height to n.|13|10'); Write_Sod(' /An = Sets memory for DOS to n.|13|10'); Write_Sod(' /O = OS/2 switch on.|13|10'); Write_Sod(' /EN = Don''t try to use enhanced keyboard|13|10'); Write_Sod(' /D = Use direct video. Bypass Desq-View/Windows|13|10'); Write_Sod(' /V = Don''t wait for retrace on CGA video I/O.|13|10'); Write_Sod(' /R macro_name = Run the macro: macro_name.|13|10'); Write_Sod(' /# = Use MONROE style video adapter.|13|10'); Write_Sod(' /EMSOFF = Do NOT use expanded memory.|13|10'); Write_Sod(' /EMSX = Use EMS for macros and spell checker.'); quit(0); END; If TChar = 'B' THEN {/B force monochrome defaults} Set_Global_Int('COM_DEFAULT_COLORS',1); call set_mono; END; If TChar = 'C' then Set_Global_Int('COM_DEFAULT_COLORS',1); call set_color; END; END; END; END; Next_While: END; Parm_Number := Parm_Number + 1; END; IF kspeed THEN R_BX := (Global_Int('KEYDELAY') shl 8) or GLOBAL_INT('KEYSPEED'); R_AX := $0305; INTR( $16 ); Set_Global_Int('NO_KEYSPEED', 0 ); END; goto exit; color_defaults: stat1_color := lightgray or default_back; stat2_color := white or default_back; message_color := lightgray or default_back; fnum_color := lightgray or default_back; fkey_color := 112; w_t_color := LightGray or default_back; w_s_color := yellow or default_back; w_b_color := lightgray or default_back; w_h_color := 112; w_eof_color := white or default_back; w_c_color := white or default_back; m_t_color := LightGray or default_back; m_s_color := white or default_back; m_b_color := white or default_back; m_h_color := 112; d_t_color := m_t_color; d_s_color := m_s_color; d_b_color := m_b_color; d_h_color := m_h_color; h_t_color := lightgray or default_back; h_s_color := white or default_back; h_r_color := yellow or default_back; h_b_color := lightgray or default_back; h_h_color := 112; h_f_color := 112; h_t1_color := 33; h_t2_color := 41; h_t3_color := 240; working_color := 240; background_color := default_back or white; Error_color := white or default_back; Shadow_Color := LightGray or default_back; Shadow_Char := Char(177); ret; set_color: default_back := $10; Call Color_Defaults; working_color := (red shl 4) or $80; error_color := (red shl 4) or white; w_eof_color := default_back or red; w_b_color := default_back or lightcyan; w_s_color := default_back or yellow; m_t_color := lightgray shl 4; m_s_color := (lightgray shl 4) + blue; m_b_color := lightgray shl 4; m_h_color := magenta shl 4; h_s_color := default_back or $F; h_t1_color := default_back or $B; h_t2_color := default_back or $C; h_t3_color := 127; d_t_color := m_t_color; d_s_color := m_s_color; d_b_color := m_b_color; d_h_color := m_h_color; shadow_color := $08; shadow_char := '|0'; background_color := default_back; ret; set_mono: default_back := 0; Call Color_Defaults; ret; exit: END_MACRO; $MACRO PARMLOAD DUMP; {*******************************MULTI-EDIT MACRO****************************** Name: PARMLOAD Description: This macro is called by Multi-Edit directly after STARTUP. It takes care of loading in files and executing macros from the command line. (C) Copyright 1989 by American Cybernetics, Inc. ******************************************************************************} Def_Int(Load_Count,Parm_Number); Def_Int(jx, tw, tr ); Def_Int(restore_enable); Def_Str(TStr, TStr2 ); make_message('Welcome to Multi-Edit V' + Version + '. Press <F1> for help.'); RM('.STARTUP^STARTUP'); {Setup mouse sensitivity} jx := parse_int('/S=',global_str('@MOUSEPARMS')); IF mou_installed and (jx <> 0) THEN r_bx := jx; r_cx := jx; r_dx := jx; r_ax := 26; intr($33); END; {Check and see if MECONFIG is read_only. If so then prompt the user, to see if he/she wants them unlocked} tw := window_id; IF user_id = '' THEN tstr := me_path + 'MECONFIG.DB'; ELSE tstr := me_path + user_id + '.USR\MECONFIG.DB'; END; IF switch_file( tstr ) THEN IF read_only THEN RM('MEERROR^MessageBox /NW=1/T=WARNING!!/M=Your configuration files are locked. Before unlocking them, insure that there are NOT multiple copies of Multi-Edit running with your user id.'); RM('USERIN^XMENU /B=1/X=25/Y=8/T=1/L=ACTION:/M=Unlock configuration files()Ignore and leave files locked()'); kill_box; IF return_int = 1 THEN tr := refresh; refresh := false; make_message('Unlocking configuration files...'); working; delete_window; IF user_id = '' THEN tstr := me_path + '*.DB'; call unlock_files; tstr := me_path + '*.ME'; call unlock_files; ELSE tstr := me_path + user_id + '.USR\*.*'; call unlock_files; END; tstr := user_id + 'MEERR.TMP'; call unlock_files; tstr := me_path + user_id + '*.TMP'; call unlock_files; goto config_unlocked; unlock_files: jx := FIRST_FILE(TSTR); WHILE jx = 0 DO Set_File_Attr( get_path( tstr ) + last_file_name, last_file_attr AND $FE ); jx := next_file; END; ret; config_unlocked: make_message('Configuration files unlocked.'); refresh := tr; END; END; END; switch_win_id( tw ); restore_enable := TRUE; error_level := 0; Error_Level := 0; load_count := 0; Parm_Number := 1; refresh := true; WHILE Parm_Number <= PARAM_COUNT DO TStr := PARAM_STR(Parm_Number); TStr := Caps(Remove_Space(TStr)); IF Xpos(Copy(Tstr,1,1),'/-',1) THEN Tstr := Copy(Tstr,2,80); If TStr = 'NR' then restore_enable := False; END; If (TStr = 'R') then Parm_Number := Parm_Number +1; restore_enable := False; Refresh := True; IF PARAM_Str(Parm_Number) <> '' THEN RM(PARAM_Str(Parm_Number)); END; END; else IF (Load_Count < 20000) and (Pos(copy(TStr,1,1),'/-') = 0) and (copy(TStr,1,1) <> ';') THEN restore_enable := False; Set_Global_Int('LOAD_COUNT',Load_Count); return_str := tstr; RM('LDFILES /LC=' + str(load_count)); Load_Count := return_int; END; END; Parm_Number := Parm_Number+1; END; If (Restore_Enable <> 0) and (Global_Int('RESTORE') <> 0) THEN RM( 'EXIT^RESTORE' ); Error_Level := 0; END; {Load keystroke macros if present} RM('KEYMAC^KEYMAC_LOAD /NE=1'); Error_Level := 0; {This is for the "post restore" startup macro which can be used to do stuff that you don't want restore to undo like setting globals} RM( 'STARTUP2' ); Error_Level := 0; EXIT: refresh := true; If load_count > 0 THEN switch_window(1); END; exit2: IF window_name = '' THEN RM('WINDOW^SetWindowNames'); END; RM('SetAutoSave ' + Global_Str('@AUTOSAVEPARMS')); END_MACRO;