home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-05-25 | 40.5 KB | 1,508 lines |
- $MACRO_FILE MEUTIL2;
- {******************************************************************************
- S_AND_R - The general purpose search and search/replace macro.
- SEARCH - This is the user interface for a SEARCH.
- S_REPL - This is the user interface for a SEARCH AND REPLACE.
- REPSRCH - This repeats the last search or search/replace.
- UNDBLK - Undent block macro.
- INDBLK - Indent block macro.
- MARKBLCK - Mark line block macro.
- MCOLBLCK - Mark columnar block macro.
- MSTRBLCK - Mark stream of text block macro.
- BLOCKOFF - Turn block mark off.
- BLOCKOP - Move, copy, and delete block operations.
- CUT - Copies, Moves or Appends text into a hidden buffer.
- PASTE - Copies block from buffer into current file.
- BLCKMATH - Performs math operations on blocks of text.
-
- Copyright 1989 by American Cybernetics, Inc.
- ******************************************************************************}
-
- $MACRO S_AND_R;
- {*******************************MULTI-EDIT MACRO*******************************
-
- Name: S_AND_R
-
- Description: Search and search/replace interface.
-
- Parameters:
- /BC= Number of boxes to kill after exiting
- /Y= The Y coordinate for the prompt box
-
- Returns: Return_Int = 0 if <ESC> was pressed at the prompts.
- Return_Int = 1 if search was carried through.
- Global_Int('FOUND_COUNT') = # of occurrences found.
-
- Globals used:
-
- Global_Str('Switches') The search switches:
- I - Ignore case
- G - Global, search entire file
- N - No prompts, search and replace
- unconditionally
- P - Prompt for repeated searches/replaces
- B - Search backwards
- X - Regular expressions off. Faster if
- regs not needed.
- R - Restrict search to marked block
- C - Don't move cursor to the right after
- a replace has occured between
- multiple searches and replaces.
- Applies only to search and replace.
- GLOBAL_STR('SEARCH_STR') String to search for.
- GLOBAL_STR('REPLACE_STR') String to replace with.
- GLOBAL_INT('SEARCH_MODE') Mode 0=search 1=seach and replace
- GLOBAL_INT('REPSEARCH') Simply repeat search or search/replace
- according to previous search. No box
- with prompts.
-
- (C) Copyright 1989 by American Cybernetics, Inc.
- ******************************************************************************}
-
- DEF_INT( FoundNum, count, jm, jz, JX, Start_Row, Box_Ofs,t_col, kill_count, tp,hl );
- DEF_INT( Back_Search, Search_Mode, Restrict, Restrict_Count, orig_line );
- DEF_INT( GLOBALSEARCH, noprompt, S_Prompt,Searching,temp_ins, S_RES ,
- No_Cursor_Movement,New_Line_Num);
- DEF_STR( Search_Str,Replace_Str,SpareString[200], Switches_Str[20], help_str[20],
- Interface_Mac );
-
-
- kill_count := parse_int('/BC=', mparm_str );
- start_row := parse_int('/Y=', mparm_str);
- if start_Row = 0 then
- start_row := 3;
- end;
- Box_Ofs := 0;
-
- Push_Undo;
-
- help_str := 'SEARCH';
- Search_Str := GLOBAL_STR('SEARCH_STR');
- Replace_Str := GLOBAL_STR('REPLACE_STR');
- Search_Mode := GLOBAL_INT('SEARCH_MODE');
-
- if search_mode then
- sparestring := 'REPL_SWITCHES';
- else
- sparestring := 'SWITCHES';
- end;
- Switches_Str := Global_Str(sparestring);
-
- FoundNum := 0;
- count := 0;
-
- IF GLOBAL_INT('REPSEARCH') = 0 THEN
-
- If Search_Mode THEN
- Box_Ofs := 1;
- END;
- if search_mode then
- help_str := 'SRCHREPL';
- end;
- Set_Global_Int('MENU_RESULT',FALSE);
-
- {This allows the user to call an alternate search interface}
- Interface_Mac := Global_Str('@SRCH_INTR_MACRO!');
- IF (Interface_Mac = '') THEN
- Interface_Mac := 'SRCHINTR ';
- END;
- IF (XPOS(' ',Interface_Mac,1) = 0) THEN
- Interface_Mac := Interface_Mac + ' ';
- END;
-
- {Call the search/replace user interface macro}
- RM(Interface_Mac + '/M=' + str( search_mode ) + '/H=' + help_str +
- '/X=1/Y=' + str(start_Row) + '/SRG=SEARCH_STR/RPG=REPLACE_STR/SWG='
- + sparestring);
-
- search_str := Global_Str('SEARCH_STR');
- replace_str := Global_Str('REPLACE_STR');
- switches_str := Global_Str( sparestring );
- IF NOT( Return_Int ) THEN
- Goto S_AND_R_EXIT;
- END;
- END;
-
- Return_Int := True;
- while box_count > kill_count do
- kill_box;
- end;
- refresh := true;
-
- Start_Search:
- Switches_Str := CAPS( Switches_Str );
- Ignore_Case := (XPos('I',Switches_Str,1) <> 0);
-
- GlobalSearch := (XPos('G',Switches_Str,1) <> 0);
- If Global_Int('REPSEARCH') <> 0 THEN
- GlobalSearch := false;
- end;
- NoPrompt := (XPos('N',Switches_Str,1) <> 0);
- S_Prompt := (XPos('P',Switches_Str,1) <> 0);
- Back_Search := (XPos('B',Switches_Str,1) <> 0);
- No_Cursor_Movement := False;
- IF (Search_Mode = True) THEN
- SpareString := Search_Str;
- Return_Str := Replace_Str;
- IF (Ignore_Case) THEN
- SpareString := Caps(SpareString);
- Return_Str := Caps(Return_Str);
- END;
- IF (SpareString <> Return_Str) THEN
- {Don't allow 'C' switch if search_str = replace_str. This would cause a
- continuous loop}
- No_Cursor_Movement := (XPos('C',Switches_Str,1) <> 0);
- END;
- Set_Global_Str('!SREV#1', '/T=Replace/KC=<ENTER>/W=14/K1=13/K2=28/R=1/Y=' + str(message_row) + '/X=' + str(message_col));
- Set_Global_Str('!SREV#2', '/T= Skip/KC=<Space>/W=12/K1=32/K2=57/R=2/Y=' + str(message_row) + '/X=' + str(message_col + 14));
- Set_Global_Str('!SREV#3', '/T= Abort/KC=<ESC>/W=11/K1=27/K2=1/R=3/Y=' + str(message_row) + '/X=' + str(message_col + 26));
- Set_Global_Str('!SREV#4', '/T= Non-Stop/KC=<CtrlN>/W=16/K1=14/K2=49/R=4/Y=' + str(message_row) + '/X=' + str(message_col + 37));
- ELSE
- Set_Global_Str('!SREV#1', '/T=Search again/KC=<Any key>/W=21/K1=13/K2=28/R=1/Y=' + str(message_row) + '/X=' + str(message_col));
- Set_Global_Str('!SREV#2', '/T= Abort/KC=<ESC>/W=11/K1=27/K2=1/R=2/Y=' + str(message_row) + '/X=' + str(message_col + 21));
- END;
- Reg_Exp_Stat := (XPos('X',Switches_Str,1) = 0);
- restrict_count := 0;
- orig_line := c_line;
- Mark_Pos;
- Restrict := XPos('R',Switches_Str,1) <> 0;
- If (Restrict) THEN
- if block_stat = 0 THEN
- RM('USERIN^VERIFY /H=SR/BL=NO BLOCK MARKED/T=Perform search on file?');
- IF return_int = 0 THEN
- make_message('No block marked.');
- refresh := true;
- redraw;
- Error_level := 0;
- goto s_and_r_exit;
- END;
- restrict := 0;
- END;
- IF restrict and ((C_Line < Block_Line1) or (C_Line > Block_Line2)) THEN
- Goto Restrict1;
- END;
- END;
-
- IF GlobalSearch = TRUE THEN
- Restrict1:
- IF Back_Search THEN
- If Restrict THEN
- Goto_Line( Block_Line2 );
- EOL;
- ELSE
- EOF;
- END;
- ELSE
- If Restrict THEN
- Goto_Line( Block_Line1 );
- Goto_Col( 1 );
- ELSE
- GOTO_Line(1);
- Goto_Col(1);
- END;
- END;
- END;
-
- make_message('');
- Temp_Ins := Insert_Mode;
- Insert_Mode := TRUE;
- searching := TRUE;
-
- IF NoPrompt AND Search_Mode THEN
- Refresh := FALSE;
- END;
-
- Error_level := 0;
-
- WHILE Searching do
- refresh := false;
- IF NoPRompt THEN
- If Search_Mode THEN
- make_message( 'Searching... Replaces:' + str(count) + ' <CtrlBREAK> to abort.');
- ELSE
- make_message( 'Searching... Occurrences:' + str(foundnum) + ' <CtrlBREAK> to abort.');
- END;
- ELSE
- make_message('Searching... <CtrlBREAK> to abort.');
- END;
- WORKING;
- orig_line := c_line;
- IF Back_Search THEN
- If Restrict Then
- Restrict_Count := C_Line - Block_Line1 + 1;
- if restrict_count < 1 then
- goto search_out;
- end;
- sagain2:
- S_Res := Search_BWD(Search_Str, Restrict_Count );
- if s_res then
- if block_stat > 1 then
- {
- if block_stat = 2 then
- }
- if (c_col < block_col1) or (c_col > block_Col2) then
- call searchmove;
- goto sagain2;
- end;
- end;
- end;
- ELSE
- S_Res := Search_BWD(Search_Str, Restrict_Count );
- END;
- ELSE
- If Restrict Then
- Restrict_Count := Block_Line2 - C_Line + 1;
- if restrict_count < 1 then
- goto search_out;
- end;
- sagain:
- S_Res := Search_FWD(Search_Str, Restrict_Count );
- if s_res then
- if block_stat > 1 then
- {
- if block_stat = 2 then
- }
- if (c_col < block_col1) or (c_col > block_Col2) then
- call searchmove;
- goto sagain;
- end;
- end;
- end;
- ELSE
- S_Res := Search_FWD(Search_Str, Restrict_Count );
- END;
- END;
- {This only occurs if user pressed <CTRL-BREAK>}
- If Error_Level = 1015 Then
- Make_message('Search aborted by user.');
- refresh := true;
- redraw;
- Error_level := 0;
- GOTO S_And_R_Exit;
- end;
- IF S_Res THEN
- IF FoundNum = 0 THEN
- Pop_Mark;
- END;
- ++FoundNum;
- IF NOPROMPT = FALSE THEN
- make_message('');
- END;
- IF Search_Mode THEN
- CALL Do_Replace_Prompt;
- ELSE
- CALL Do_Search_Prompt;
- END;
- ELSE
- Searching := FALSE;
- IF FoundNum = 0 THEN
- Goto_Mark;
- END;
- END;
- END;
- search_out:
- Set_Global_Int('MENU_RESULT',TRUE);
-
- if Search_Mode then { ldh }
- call Center_Line; { ldh }
- end; { ldh }
- Make_Message('String Found ' + STR(FoundNum) + ' Times.');
- Refresh := TRUE;
- Insert_Mode := Temp_Ins;
- GOTO S_And_R_Exit;
-
-
- Do_Replace_Prompt:
- IF noprompt = FALSE THEN
- call highlight_find;
- IF NOT(S_Prompt) THEN
- Searching := False;
- END;
- Make_Message('');
- RM('UserIn^CheckEvents /M=2/G=!SREV#/#=4');
- key_loop1:
- Read_Key;
- IF (key1 = 0) AND (key2 = 250) THEN
- RM('UserIn^CheckEvents /M=1/G=!SREV#/#=4');
- ELSE
- RM('UserIn^CheckEvents /M=0/G=!SREV#/#=4');
- END;
- IF return_int THEN
- return_int := parse_int('/R=', return_str);
- ELSE
- goto key_loop1;
- END;
- make_message('');
- IF return_int = 2 THEN
- call searchmove;
- RET;
- ELSIF return_int = 4 THEN
- noprompt := true;
- goto NON_STOP;
- ELSIF return_int = 3 THEN
- Searching := FALSE;
- RET;
- ELSIF return_int = 1 THEN
- T_Col := C_Col;
- Replace( Replace_Str );
- IF (No_Cursor_Movement) THEN
- Goto_Col(T_Col);
- ELSE
- If Back_Search THEN
- Goto_Col(T_Col);
- Left;
- ELSE
- while NOT(at_eol) and (cur_char = '|255') do
- right;
- END;
- IF At_Eol then
- right;
- end;
- END;
- END;
- ++count;
- Redraw;
- RET;
- END;
- goto do_replace_prompt;
- ELSE
- NON_STOP:
- T_Col := C_Col;
- Replace( Replace_Str );
- IF (No_Cursor_Movement) THEN
- Goto_Col(T_Col);
- ELSE
- If Back_Search THEN
- Goto_Col(T_Col);
- Left;
- ELSE
- while NOT(at_eol) and (cur_char = '|255') do
- right;
- END;
- IF At_Eol then
- right;
- end;
- END;
- END;
- ++count;
- END;
- RET;
-
- highlight_find:
- refresh := false;
- if c_line > orig_line then
- if (c_line - orig_line) <= ((win_y2 - win_y1) - c_row) then
- tp := c_line;
- goto_line(orig_line);
- while c_line <> tp do
- down;
- end;
- else { ldh }
- call Center_Line; { ldh }
- end;
- else
- if (orig_line - c_line) <= ((win_y2 - win_y1) - ((win_y2 - (win_y1 + c_row)))) then
- tp := c_line;
- goto_line(orig_line);
- while c_line <> tp do
- up;
- end;
- else { ldh }
- call Center_Line; { ldh }
- end;
- end;
- refresh := true;
- redraw;
- sparestring := found_str;
- expand_tabs( sparestring, hl );
- hl := length( sparestring );
- tp := c_col;
- goto_col(c_col + hl);
- goto_col(tp);
- if (win_x2 - wherex) < hl then
- hl := win_x2 - wherex;
- end;
- draw_attr( wherex, wherey, h_color or ($80), hl);
- ret;
-
- Do_Search_Prompt:
- IF (Noprompt) THEN
- Call searchmove;
- ret;
- END;
-
- IF NOT(S_Prompt) THEN
- call highlight_find;
- Make_Message('String Found ' + STR(FoundNum) + ' Times.');
- Searching := False;
- Read_Key;
- push_key(key1,key2);
- RET;
- END;
- call highlight_find;
- Make_Message('');
- RM('UserIn^CheckEvents /M=2/G=!SREV#/#=2');
- key_loop2:
- Read_Key;
- IF (key1 = 0) AND (key2 = 250) THEN
- RM('UserIn^CheckEvents /M=1/G=!SREV#/#=2');
- ELSE
- RM('UserIn^CheckEvents /M=0/G=!SREV#/#=2');
- IF return_int = 0 THEN
- return_int := 1;
- goto search_promptx;
- END;
- END;
- IF return_int THEN
- return_int := parse_int('/R=', return_str);
- ELSE
- goto key_loop2;
- END;
- search_promptx:
- make_message('');
- IF return_int = 2 THEN
- Searching := FALSE;
- ELSE
- call searchmove;
- END;
- RET;
-
- searchmove:
- IF Back_Search THEN
- LEFT;
- ELSE
- RIGHT;
- while not(at_eol) and (cur_char = '|255') do
- right;
- end;
- IF At_Eol then
- right;
- end;
- END;
- ret;
-
- {<<<Added 12-Apr-90 ldh *****************************************************}
- Center_Line:
- New_Line_Num := C_Line;
- {These 6 lines will center the selected line on the screen if possible}
- WHILE (C_Row > ((Win_Y2 - Win_Y1) / 2)) DO
- Up;
- END;
- WHILE (C_Row < ((Win_Y2 - Win_Y1) / 2)) DO
- Down;
- END;
- Goto_Line(New_Line_Num);
- ret;
- {******************************************************************* Added>>>}
-
- s_and_r_exit:
- RM('UserIn^CheckEvents /M=3/F=1/G=!SREV#/#=4');
- Set_Global_Int('FOUND_COUNT', foundnum);
- Pop_Undo;
- SET_GLOBAL_INT('REPSEARCH',0);
- Reg_Exp_Stat := True;
- redraw;
- END_MACRO;
-
- $MACRO SrchIntr;
- {*******************************MULTI-EDIT MACRO******************************
-
- Name: SrchIntr
-
- Description: Search (and Replace) User Interface. This macro is called
- by S_AND_R.
-
- Parameters: /M=n Mode, 0 = Search, 1 = Search and Replace
- /H=str Help String
- /X=n X coordinate
- /Y=n Y coordinate
- /SRG=str Name of the global_str to put the search str in
- /RPG=str Name of the global_str to put the replace str in
- /SWG=str Name of the global_str to put the switches str in
- /SWONLY=1 Edit switches only
-
- Returns:
- Return_Int > 0 IF START_SEARCH WAS SELECTED
-
- (C) Copyright 1989 by American Cybernetics, Inc.
- ******************************************************************************}
- Def_Int( search_mode,x,y, sr_pos, rp_pos, sw_pos, go_pos );
- Def_Int( ic, gs, ps, regs, rb, continuous, bs, np, smode, cs, count, am );
- Def_Str( help_str[40] );
-
- help_str := Global_Str(parse_str('/SWG=', mparm_str));
-
- ic := (xpos( 'I', help_str, 1 ) = 0);
- gs := (xpos( 'G', help_str, 1 ) <> 0);
- ps := (xpos( 'P', help_str, 1 ) <> 0);
- bs := (xpos( 'B', help_str, 1 ) = 0);
- continuous := (xpos( 'N', help_str, 1 ) <> 0);
- regs := (xpos( 'X', help_str, 1 ) = 0);
- rb := (xpos( 'R', help_str, 1 ) <> 0);
- np := (xpos( 'N', help_str, 1 ) <> 0);
- cs := (xpos( 'C', help_str, 1 ) <> 0);
- smode := 1;
- IF np THEN
- smode := 3;
- END;
- IF ps THEN
- smode := 2;
- END;
- {
- help_str := global_str( '@SEARCH_ORDER' );
- IF help_str <> '' THEN
- sr_pos := parse_int('/SR=', help_str );
- rp_pos := parse_int('/RP=', help_str );
- sw_pos := parse_int('/SW=', help_str );
- go_pos := parse_int('/GO=', help_str );
- ELSE
- }
- sr_pos := 1;
- rp_pos := 2;
- go_pos := 3;
- sw_pos := 4;
- {
- END;
- }
-
- x := parse_int('/X=',mparm_str);
- y := parse_int('/Y=',mparm_str);
- IF x = 0 THEN
- x := 2;
- END;
- IF y = 0 THEN
- y := 3;
- END;
-
- search_mode := parse_int( '/M=', mparm_str );
-
- IF search_mode = 0 THEN
- sr_pos := sr_pos - (rp_pos < sr_pos);
- sw_pos := sw_pos - (rp_pos < sw_pos);
- go_pos := go_pos - (rp_pos < go_pos);
- END;
-
- IF parse_int('/SWONLY=', mparm_str) THEN
- am := 2;
- sw_pos := 1;
- count := 6 + search_mode;
- ELSE
- am := 3;
- count := (search_mode * 2) + 8;
- Set_Global_Str('SRISTR_' + str(sr_pos),
- Global_Str(parse_str('/SRG=', mparm_str)));
- Set_Global_Str('SRIPARM_'+ str(sr_pos),'/T=Search For:/C=1/W=63/ML=254/HISTORY=SEARCH_HISTORY');
- If Search_Mode THEN
- Set_Global_Str('SRISTR_' + str(rp_pos),Global_Str(parse_str('/RPG=', mparm_str)));
- Set_Global_Str('SRIPARM_' + str(rp_pos),'/HISTORY=REPLACE_HISTORY/T=Replace With:/C=1/W=61/ML=254');
- Set_Global_Str('SRIPARM_' + str(go_pos),'/T=>>>>/TP=6/W=24/C=1');
- Set_Global_Str('SRISTR_' + str(go_pos),'START SEARCH AND REPLACE');
- ELSE
- Set_Global_Str('SRIPARM_' + str(go_pos),'/T=>>>>/TP=6/W=12/C=1');
- Set_Global_Str('SRISTR_' + str(go_pos),'START SEARCH');
- END;
- END;
- Set_Global_Str('SRISTR_' + str(sw_pos + 0),'/F=Backward/T=Forward');
- Set_Global_Int('SRIINT_' + str(sw_pos + 0), bs);
- Set_Global_Str('SRIPARM_' + str(sw_pos + 0),'/TP=5/T=Search direction: /C=1/W=8');
- IF search_mode THEN
- Set_Global_Str('SRISTR_' + str(sw_pos + 1),'Replace first occurrence only()Prompt for each replace()replace All occurrences()');
- Set_Global_Int('SRIINT_' + str(sw_pos + 1), smode);
- Set_Global_Str('SRIPARM_' + str(sw_pos + 1),'/TP=3/T=Mode: /C=1/W=29');
- ELSE
- Set_Global_Str('SRISTR_' + str(sw_pos + 1),'Stop on first occurrence()Prompt for next search()Find all occurrences without stopping()');
- Set_Global_Int('SRIINT_' + str(sw_pos + 1), smode);
- Set_Global_Str('SRIPARM_' + str(sw_pos + 1),'/TP=3/T=Mode: /C=1/W=37');
- END;
-
- Set_Global_Str('SRISTR_' + str(sw_pos + 2),'/T=X');
- Set_Global_Int('SRIINT_' + str(sw_pos + 2), ic);
- Set_Global_Str('SRIPARM_' + str(sw_pos + 2),'/TP=5/T=Case sensitive: /C=1/W=1/L=' + str(sw_pos + 3));
-
- Set_Global_Str('SRISTR_' + str(sw_pos + 4),'/T=X');
- Set_Global_Int('SRIINT_' + str(sw_pos + 4), regs);
- Set_Global_Str('SRIPARM_' + str(sw_pos + 4),'/TP=5/T=Regular expressions:/C=1/W=1/L=' + str(sw_pos + 4));
-
- Set_Global_Str('SRISTR_' + str(sw_pos + 3),'/T=X');
- Set_Global_Int('SRIINT_' + str(sw_pos + 3), gs);
- Set_Global_Str('SRIPARM_' + str(sw_pos + 3),'/TP=5/T=Global search: /C=37/W=1/L=' + str(sw_pos + 3));
-
- Set_Global_Str('SRISTR_' + str(sw_pos + 5),'/T=X');
- Set_Global_Int('SRIINT_' + str(sw_pos + 5), rb);
- Set_Global_Str('SRIPARM_' + str(sw_pos + 5),'/TP=5/T=Restrict to marked block:/C=37/W=1/L=' + str(sw_pos + 4));
-
- Set_Global_Str('SRISTR_' + str(sw_pos + 6),'/F=End of replace string/T=Start of replace string');
- Set_Global_Int('SRIINT_' + str(sw_pos + 6), cs);
- Set_Global_Str('SRIPARM_' + str(sw_pos + 6),'/TP=5/T=Leave cursor at: /C=1/W=23');
-
- IF search_mode THEN
- help_str := 'SEARCH AND REPLACE';
- ELSE
- help_str := 'SEARCH';
- END;
- RM('USERIN^Data_In /PRE=SR/S=1/A=' + str(am) + '/#=' + str( count ) +
- '/X=' + str(x) + '/Y='+Str(y) +'/T=' + help_str + '/H=' + parse_str('/H=', mparm_str));
- IF search_mode and (parse_int('/SWONLY=', mparm_str) = 0) THEN
- Set_Global_Str(parse_str('/RPG=', mparm_str), Global_Str('SRISTR_' + str(rp_pos)));
- END;
-
- help_str := '';
- IF global_int('SRIINT_' + str(sw_pos)) = 0 THEN
- help_str := help_str + 'B';
- END;
- smode := global_int('SRIINT_' + str(sw_pos + 1));
- IF smode = 2 THEN
- help_str := help_str + 'P';
- ELSIF smode = 3 THEN
- help_str := help_str + 'N';
- END;
-
- IF global_int('SRIINT_' + str(sw_pos + 2)) = 0 THEN
- help_str := help_str + 'I';
- END;
- IF global_int('SRIINT_' + str(sw_pos + 3)) THEN
- help_str := help_str + 'G';
- END;
- IF global_int('SRIINT_' + str(sw_pos + 4)) = 0 THEN
- help_str := help_str + 'X';
- END;
- IF global_int('SRIINT_' + str(sw_pos + 5)) THEN
- help_str := help_str + 'R';
- END;
- IF global_int('SRIINT_' + str(sw_pos + 6)) THEN
- help_str := help_str + 'C';
- END;
-
-
- Set_Global_Str(parse_str('/SWG=', mparm_str), help_str);
- IF parse_int('/SWONLY=', mparm_str) = 0 THEN
- Set_Global_Str(parse_str('/SRG=', mparm_str), Global_Str('SRISTR_' + str(sr_pos)));
- END;
-
- ic := 0;
- WHILE ic < 15 DO
- Set_Global_Str( 'SRISTR_' + str(ic),'');
- Set_Global_Int( 'SRIINT_' + str(ic),0);
- ++ic;
- END;
- END_MACRO;
-
- $MACRO SEARCH FROM EDIT;
- {*******************************MULTI-EDIT MACRO*******************************
-
- Name: SEARCH
-
- Description: Calls S_and_R in search only mode.
-
- (C) Copyright 1989 by American Cybernetics, Inc.
- ******************************************************************************}
- SET_GLOBAL_INT('SEARCH_MODE',0);
- SET_GLOBAL_INT('REPSEARCH',0);
- RM( 'S_AND_R '+mparm_str);
- END_MACRO;
-
- $MACRO S_REPL FROM EDIT;
- {*******************************MULTI-EDIT MACRO*******************************
-
- Name: S_REPL
-
- Description: Calls S_and_R in search and replace mode.
-
- (C) Copyright 1989 by American Cybernetics, Inc.
- ******************************************************************************}
- SET_GLOBAL_INT('SEARCH_MODE',1);
- SET_GLOBAL_INT('REPSEARCH',0);
- RM( 'S_AND_R '+mparm_str );
- END_MACRO;
-
- $MACRO REPSRCH;
- {*******************************MULTI-EDIT MACRO*******************************
-
- Name: S_REPL
-
- Description: Calls S_and_R in search and replace mode.
-
- (C) Copyright 1989 by American Cybernetics, Inc.
- ******************************************************************************}
-
- Mark_Pos;
-
- IF XPOS('B',Caps(Global_Str('SWITCHES')),1) THEN
- Left;
- ELSE
- Right;
- while NOT(at_eol) and (cur_char = '|255') do
- right;
- END;
- END;
- IF (Global_Str('SEARCH_STR') <> '') THEN
- SET_GLOBAL_INT('REPSEARCH',1);
- END;
- RM( 'S_AND_R /NG=1' + mparm_str );
-
- If (return_int > 0) and (global_int('FOUND_COUNT') = 0) Then
- Goto_Mark;
- Make_Message('No more occurrences.');
- ELSE
- Pop_Mark;
- END;
- END_MACRO;
-
-
- $MACRO FS TRANS;
- {*******************************MULTI-EDIT MACRO******************************
-
- Name: fs
-
- Description: Multi-File search. Will prompt for a filespec (wild cards are
- allowed), a search string and search switches, and (using
- MEFIND.EXE) perform a search through all the files matching the
- filespec, and then put up a list of all the matching files. The
- user may then select one of the files, and the cursor will
- automatically go the the line where the match was found.
-
- Parameters: /N= Skips directly to the filename list, using the last
- set of files found by MEFIND.
- /Y= The Y coordinate of the prompt box
- /X= The X coordinate of the prompt box
-
-
- (C) Copyright 1989 by American Cybernetics, Inc.
- ******************************************************************************}
-
- def_str( search_str[80], switches_str[10], filespec[80], sstr );
- def_int( t_win, file_count, str_count, nl, nc, jx, x1, y1, t_swap_mem );
- def_int( search_dirs, use_reg_exp, case_sensitive, result );
- def_str( tc[1] );
-
-
- t_win := window_id;
- refresh := false;
-
- result := 0;
-
- switches_str := caps(Global_Str('FSWITCHES'));
- use_reg_exp := xpos('R',switches_str, 1) <> 0;
- case_sensitive := xpos('C',switches_str, 1) <> 0;
- search_dirs := xpos('S',switches_str, 1) <> 0;
-
- y1 := parse_int('/Y=', mparm_str);
- if y1 = 0 then
- y1 := 4;
- ELSE
- --Y1;
- end;
-
- x1 := parse_int('/X=', mparm_str);
- if x1 = 0 then
- x1 := 4;
- end;
-
- if xpos('/N', caps(mparm_str), 1 ) then
- sstr := me_path + user_id + 'MEFIND.TMP';
- if switch_file(sstr) then
- goto make_file_menu;
- else
- goto load_find_file;
- end;
- end;
-
- search_str := Global_Str('SEARCH_STR');
-
- filespec := Global_Str('FFILESPEC');
-
- Set_Global_Str('ISTR_1',filespec);
- Set_Global_Str('IPARM_1','/HISTORY=FILESPEC_HISTORY/T=Filespec:/C=1/W=60/ML=80/L=1');
- Set_Global_Str('ISTR_2',Search_Str);
- Set_Global_Str('IPARM_2','/HISTORY=SEARCH_HISTORY/T=Search For:/C=1/W=63/ML=128/H=FILESEARCH/L=2');
- Set_Global_Str('IPARM_3','/T=>>>>/C=1/H=FILESEARCH/W=17/L=3/TP=6');
- Set_Global_Str('ISTR_3','START FILE SEARCH');
-
- Set_Global_Int('IINT_4',search_dirs);
- Set_Global_Str('ISTR_4','/T=X');
- Set_Global_Str('IPARM_4','/T=Search Subdirectories:/C=1/W=1/L=4/TP=5');
- Set_Global_Str('ISTR_5',global_str('FSEARCH_PATH'));
- Set_Global_Str('IPARM_5','/T=Starting path: /C=1/W=40/L=5');
- Set_Global_Int('IINT_6',case_sensitive);
- Set_Global_Str('ISTR_6','/T=X');
- Set_Global_Str('IPARM_6','/T=Case Sensitive: /C=1/W=1/L=6/TP=5');
- Set_Global_Int('IINT_7',use_reg_exp);
- Set_Global_Str('ISTR_7','/T=X');
- Set_Global_Str('IPARM_7','/T=Regular Expressions: /C=1/W=1/L=7/TP=5');
-
- RM('UserIn^Data_In /H=FILESEARCH/S=1/A=3/#=7/X=1/T=SEARCH FILES/Y=' + str(y1));
- filespec := global_str('ISTR_1');
- search_str := global_str('ISTR_2');
- SET_GLOBAL_STR('FLAST_CHOICE', '');
- set_Global_Str('FFILESPEC', filespec);
- set_Global_Str('SEARCH_STR', search_str);
- set_Global_Str('FSEARCH_STR', search_str);
-
- search_dirs := global_int('IINT_4');
- set_global_str('FSEARCH_PATH', global_str('ISTR_5'));
- case_sensitive := global_int('IINT_6');
- use_reg_exp := global_int('IINT_7');
-
- set_global_str('ISTR_1','');
- set_global_str('ISTR_2','');
- set_global_str('ISTR_3','');
- set_global_str('ISTR_4','');
- set_global_str('ISTR_5','');
- set_global_str('ISTR_6','');
- set_global_str('ISTR_7','');
-
- switches_str := '';
- sstr := '/D /F' + ME_PATH + USER_ID + 'MEFIND.TMP ' +
- '/P' + global_str('FSEARCH_PATH') + ' ';
- if use_reg_exp then
- sstr := sstr + '/R ';
- switches_str := 'R';
- end;
- if case_sensitive then
- sstr := sstr + '/C ';
- switches_str := switches_str + 'C';
- end;
- if search_dirs then
- sstr := sstr + '/S ';
- switches_str := switches_str + 'S';
- end;
-
- set_Global_Str('FSWITCHES', switches_str);
-
- if return_int then
- working;
- put_box(4,y1,72,y1 + 15, 0, m_b_color, 'Searching through files', true);
- draw_char(196,5,y1+2,m_b_color,64);
- write('Press <ESC> to abort search.',23,y1 + 14, 0, m_b_color );
- gotoxy(5, y1 + 1);
- if switch_file( me_path + user_id + 'MEFIND.TMP' ) then
- delete_window;
- end;
- t_swap_mem := swap_mem;
- swap_mem := 6250;
- shell_to_dos(me_path + 'MEFIND.EXE ' + filespec + ' ' + sstr + '/X /E' + search_str, false);
- swap_mem := t_swap_mem;
- kill_box;
-
- set_Global_Str('SEARCH_STR', search_str);
- sstr := '';
- if case_sensitive = 0 then
- sstr := sstr + 'I';
- end;
- if use_reg_exp = 0 then
- sstr := sstr + 'X';
- end;
-
- set_global_str('SWITCHES', sstr);
- SET_GLOBAL_INT('SEARCH_MODE',0);
-
- jx := exit_code;
- if jx <> 0 then
- IF jx = 2 THEN
- sstr := 'Error writing to ' + me_path + USER_ID +
- 'MEFIND.TMP, file may be marked READ-ONLY. To reset, load in the file,' +
- ' toggle its LOCKED status from the MAIN - File - Information menu, and then save the file.';
- ELSIF jx = 3 THEN
- sstr := 'Multi-file search aborted by user.';
- ELSE
- sstr := 'Search string may be invalid.';
- END;
- rm('MEERROR^MessageBox /B=2/T=Multi-File Search Error/M=' + sstr );
- goto exitx;
- end;
- if error_level = 0 then
- load_find_file:
- if switch_file( me_path + user_id + 'MEFIND.TMP' ) then
- delete_window;
- end;
- switch_window( window_count );
- create_window;
- no_create:
- window_attr := window_attr or $81; {make it hidden and invisible}
- if error_level = 0 then
- load_file( ME_PATH + USER_ID + 'MEFIND.TMP' );
- if error_level = 0 then
-
- make_file_menu:
- tof;
- IF at_eof THEN
- RM('MEERROR^MESSAGEBOX /B=2/T=NO MATCHED FILES FOUND');
- goto exitx;
- end;
- Set_Global_Str('FSEV1', '/T=Edit file/K1=13/K2=28/R=1/LL=1');
- Set_Global_Str('FSEV2', '/T=Cancel/K1=27/K2=1/R=0/LL=1');
- RM('USERIN^WMENU /EV=FSEV/EV#=2/B=1/K=1/T=MATCHED FILES/H=FILESEARCH/X=' + str(x1) +
- '/S=' + str(global_int('@FLAST_CHOICE')) +
- '/Y=' + str(y1));
-
- window_attr := window_attr or $81; {make it hidden and invisible}
- if return_int <> 1 then
- switch_win_id(t_win);
- goto exit;
- end;
-
- result := 1;
-
- jx := insert_mode;
- insert_mode := FALSE;
- text('|175');
- insert_mode := jx;
- file_changed := false;
- return_str := shorten_str(get_word(' '));
- forward_till(':');
- right;
- sstr := get_word(' ');
- if val(nl,sstr) <> 0 then
- end;
- set_global_int('@FLAST_CHOICE', c_line);
- forward_till_not(' ');
- return_str := fexpand( get_word('') + return_str);
- IF xpos('|254', return_str,1) <> 0 THEN
- goto exitx;
- END;
- IF switch_file( return_str ) THEN
- make_message( return_str + ' already loaded.');
- tof;
- goto no_load;
- END;
- RM('LdFiles /LC=1');
- if error_level = 0 then
- Make_Message('"' + File_Name + '" loaded.');
- no_load:
- down; down; down; down;
- goto_line( nl );
- if format_stat then
- up;
- end;
- goto_col( 1 );
- left;
- reg_exp_stat := XPos('R',switches_str,1);
- ignore_case := (XPos('C',switches_str,1) = 0);
- If search_fwd(global_str('FSearch_Str'),0) then
- end;
- reg_exp_stat := true;
- else
- switch_win_id(t_win);
- end;
- else
- RM('MEERROR^Beeps /C=1');
- delete_window;
- error_level := 0;
- end;
- end;
- end;
- end;
- exit:
- if error_level <> 0 then
- exitx:
- switch_win_id(t_win);
- end;
- return_int := result;
- update_status_line;
- END_MACRO;
-
-
- $MACRO UNDBLK TRANS;
- {*******************************MULTI-EDIT MACRO*******************************
-
- Name: UNDBLK
-
- Description: Undents the current line marked block
-
- (C) Copyright 1989 by American Cybernetics, Inc.
- ******************************************************************************}
-
- Def_Int(jx,j1);
-
- Working;
- Push_Undo;
- Refresh := False;
- Messages := False;
- Mark_Pos;
- If Marking then
- block_end;
- end;
- IF Block_Stat = 1 THEN
- Goto_Line(Block_Line1);
- WHILE C_Line <= Block_Line2 DO
- First_Word;
- J1 := C_Col;
- Tab_Left;
- If AT_EOL = FALSE THEN
- Del_Chars(j1 - C_Col);
- END;
- DOWN;
- END;
- END;
- Macro_Exit:
- Refresh := True;
- Goto_Mark;
- Messages := True;
- Pop_Undo;
- END_MACRO;
-
- $MACRO INDBLK FROM EDIT TRANS;
- {*******************************MULTI-EDIT MACRO*******************************
-
- Name: INDBLK
-
- Description: Indents the current line marked block
-
- (C) Copyright 1989 by American Cybernetics, Inc.
- ******************************************************************************}
-
- Def_Int(Temp_Ins);
- Push_Undo;
- Temp_Ins := Insert_Mode;
- Insert_Mode := True;
- Refresh := False;
- Messages := False;
- Mark_Pos;
- If Marking then
- block_end;
- end;
- IF Block_Stat = 1 THEN
- Goto_Line(Block_Line1);
- WHILE C_Line <= Block_Line2 DO
- First_Word;
- IF Not(At_Eol) THEN
- Tab_Right;
- END;
- DOWN;
- END;
- END;
-
- Macro_Exit:
- Refresh := True;
- Insert_Mode := Temp_Ins;
- Goto_Mark;
- Pop_Undo;
- Messages := True;
- END_MACRO;
-
- $MACRO MARKBLCK FROM EDIT;
- {*******************************MULTI-EDIT MACRO*******************************
-
- Name: MARKBLCK
-
- Description: Starts and stops line oriented block marking.
-
- (C) Copyright 1989 by American Cybernetics, Inc.
- ******************************************************************************}
-
- IF Marking THEN
- BLOCK_END;
- Make_Message('Block marked.');
- ELSE
- BLOCK_BEGIN;
- Make_Message('Block marking on. Press ' + Global_Str('!BM_KEY15') + ' to stop.');
- END;
- END_MACRO;
-
- $MACRO MCOLBLCK FROM EDIT;
- {*******************************MULTI-EDIT MACRO*******************************
-
- Name: MCOLBLCK
-
- Description: Starts and stops column oriented block marking.
-
- (C) Copyright 1989 by American Cybernetics, Inc.
- ******************************************************************************}
-
- IF Marking THEN
- BLOCK_END;
- Make_Message('Block marked.');
- ELSE
- COL_BLOCK_BEGIN;
- Make_Message('Columnar block marking on. Press ' + Global_Str('!BM_KEY15') + ' to stop.');
- END;
- END_MACRO;
-
- $MACRO MSTRBLCK FROM EDIT;
- {*******************************MULTI-EDIT MACRO*******************************
-
- Name: MSTRBLCK
-
- Description: Starts and stops stream oriented block marking.
-
- (C) Copyright 1989 by American Cybernetics, Inc.
- ******************************************************************************}
-
- IF Marking THEN
- BLOCK_END;
- Make_Message('Block marked.');
- ELSE
- STR_BLOCK_BEGIN;
- Make_Message('Stream block marking on. Press ' + Global_Str('!BM_KEY15') + ' to stop.');
- END;
- END_MACRO;
-
- $MACRO BLOCKOFF FROM EDIT TRANS;
- {*******************************MULTI-EDIT MACRO*******************************
-
- Name: MARKBLK
-
- Description: Turns the current block marking off.
-
- (C) Copyright 1989 by American Cybernetics, Inc.
- ******************************************************************************}
-
- IF BLOCK_STAT > 0 THEN
- Block_Off;
- Make_Message('Block turned off.');
- ELSE
- Make_Message('No Block Marked.');
- END;
- END_MACRO;
-
- $MACRO BLOCKOP;
- {*******************************MULTI-EDIT MACRO******************************
-
- Name: BLOCKOP
-
- Description: Does a block copy or move and then, if hard_cr is being used,
- does a reformat on the area under the block.
-
- Parameters: /BT=nn nn is the operation type.
- 0 = Block copy
- 1 = Block Move
- 2 = Block Delete
- 3 = Inter-Window Copy
- 4 = Inter-Window Move
-
- (C) Copyright 1989 by American Cybernetics, Inc.
- ******************************************************************************}
-
- def_int( old_refresh, bt, bl, tb );
-
- bt := parse_int( '/BT=', mparm_str );
- tb := block_stat;
-
- bl := block_line1;
-
- if bt = 3 then
- RM( 'WINDOW^COPYBL' );
- tb := block_stat;
- end;
- if bt = 4 then
- RM( 'WINDOW^MOVEBL' );
- tb := block_stat;
- end;
-
- if block_stat = 0 then
- make_message('No block marked.');
- goto exit;
- end;
-
- if bt = 0 then
- Copy_Block;
- Make_Message('Block copied.');
- end;
- if bt = 1 then
- Move_Block;
- Make_Message('Block moved.');
- end;
- if bt = 2 then
- Delete_Block;
- Make_Message('Block deleted.');
- end;
-
-
- Old_refresh := refresh;
- Refresh := false;
- If (tb <> 0) and (Hard_Cr <> '|0') and (Hard_Cr <> '') THEN
- Mark_Pos;
- PUSH_UNDO;
- goto_line( bl );
- While C_Line <= Block_Line2 Do
- RM( 'TEXT^REFORMAT /NR' );
- end;
-
- Goto_Mark;
- POP_UNDO;
- END;
- exit:
- refresh := old_refresh;
- END_MACRO;
-
- $MACRO CUT TRANS;
- {*******************************MULTI-EDIT MACRO******************************
-
- Name: CUT
-
- Description: Copies, Moves or Appends text into a hidden buffer.
-
- Parameters: /M Move text (else copy text)
- /A Append text (else erase old buffer);
- /B=n n = the buffer # (0 is the default);
- /E Erase buffer, perform no move or copy
-
- (C) Copyright 1989 by American Cybernetics, Inc.
- ******************************************************************************}
-
- def_int( buf_num, temp_refresh, source_win, erase_buf, Append_buf, t_block_stat );
- def_str( buf_name );
-
- temp_refresh := refresh;
- refresh := false;
- source_win := cur_window;
- error_level := 0;
- t_block_stat := block_stat;
-
- erase_buf := XPOS('/E', MParm_Str, 1);
- append_buf := XPOS('/A', MParm_Str, 1);
- buf_num := parse_int('/B=', Mparm_Str);
- if buf_num > 999 then
- buf_num := 999;
- end;
- if buf_num < 0 then
- buf_num := 0;
- end;
- buf_name := me_path + '!BUF' + User_Id + '.' + Str(Buf_Num);
- if switch_file(buf_name) = 0 then
- switch_window(window_count);
- create_window;
- if error_level <> 0 then
- goto exit;
- end;
- window_attr := $81;
- file_name := buf_name;
- else
- window_attr := $81;
- if (append_buf = 0) or (erase_buf) THEN
- Erase_Window;
- file_name := buf_name;
- ELSE
- EOF;
- If (c_col <> 1) then
- down;
- goto_col(1);
- end;
- END;
- end;
-
- if erase_buf = 0 then
- if t_block_stat = 0 then
- make_message('No block marked.');
- goto exit;
- end;
- if XPos('/M', MParm_Str,1) = 0 THEN
- Window_Copy(source_win);
- IF append_buf THEN
- Make_Message('Block appended to buffer ' + Str(buf_num));
- ELSE
- Make_Message('Block copied to buffer ' + Str(buf_num));
- END;
- ELSE
- Window_Move(source_win);
- Make_Message('Block moved to buffer ' + Str(buf_num));
- END;
- if append_buf then
- eof;
- block_begin;
- tof;
- block_end;
- end;
- else
- Make_Message('Erased buffer ' + str(buf_num));
- end;
-
- file_changed := false;
- exit:
- switch_window( source_win );
- refresh := temp_refresh;
- END_MACRO;
-
- $MACRO PASTE TRANS;
- {*******************************MULTI-EDIT MACRO******************************
-
- Name: paste
-
- Description: Copies block from buffer into current file.
-
- Parameters: /B=n buffer number
-
- (C) Copyright 1989 by American Cybernetics, Inc.
- ******************************************************************************}
-
- def_int( buf_num, temp_refresh, source_win, buf_win );
- def_str( buf_name );
-
- temp_refresh := refresh;
- refresh := false;
- source_win := cur_window;
- error_level := 0;
-
- buf_num := parse_int('/B=', Mparm_Str);
- if buf_num > 999 then
- buf_num := 999;
- end;
- if buf_num < 0 then
- buf_num := 0;
- end;
- buf_name := me_path + '!BUF' + User_Id + '.' + Str(Buf_Num);
-
- if switch_file(buf_name) = 0 then
- bufferempty:
- make_message('Nothing to paste in buffer ' +str(buf_num));
- switch_window( source_win );
- goto exit;
- end;
-
- window_attr := $81;
- if block_stat = 0 then
- goto bufferempty;
- end;
- buf_win := cur_window;
- switch_window( source_win );
- window_copy( buf_win );
-
- make_message( 'Block copied from buffer ' + str(buf_num));
- exit:
- refresh := temp_refresh;
-
- END_MACRO;
-
- $MACRO BLCKMATH TRANS;
- {*******************************MULTI-EDIT MACRO******************************
-
- Name: BLCKMATH
-
- Description: Performs math operations on blocks of numbers.
-
- Parameters: /O= [*/-+] the math operation to perform.
- If /O= is not specified, the user will be
- prompted for the operation.
- /BC= Amount of boxes to kill upon exit.
-
- (C) Copyright 1989 by American Cybernetics, Inc.
- ******************************************************************************}
-
- def_real( rx, ry );
- def_str( tstr[80], operation[1] );
- def_int( jx, tbc , commas, jy,Negative);
-
- refresh := false;
-
- operation := parse_str('/O=', mparm_str );
- Commas := false;
- IF operation = '' THEN
- tbc := parse_int('/BC=', mparm_str);
- RM('userin^xmenu /L=Select Operation/B=1' + mparm_str +
- '/M=+ (BLOCKMATH)- ()* ()/ ()');
- IF return_int < 1 THEN
- goto exit;
- END;
- operation := copy('+-*/', return_int, 1 );
- while box_count > tbc do
- kill_box;
- end;
- END;
-
- Push_Undo;
- mark_pos;
- If marking then
- block_end;
- end;
- rx := 0.0;
- jx := 0;
- goto_line( block_line1 );
- IF block_stat = 2 THEN
- while (c_line <= block_line2) do
- goto_col( block_col1 );
- col_again:
- while NOT(at_eol) AND
- (XPOS(cur_char,'0123456789-.',1) = 0) AND
- (c_col < block_col2) DO
- RIGHT;
- END;
- IF (c_col <= block_col2) THEN
- tstr := get_word_in( '0123456789.-,' );
- call perform_operation;
- IF (c_col < block_col2) AND NOT( at_eol ) THEN
- goto col_again;
- END;
- END;
- down;
- end;
- ELSE
- goto_col( 1 );
- goto_col( block_col1 );
- IF (block_stat = 1) or (block_stat = 3) THEN
- while (c_line <= block_line2) do
- while NOT(at_eol) AND
- (XPOS(cur_char,'0123456789-.',1) = 0)
- DO
- RIGHT;
- END;
- IF (at_eol) or ( (c_line = block_line2) and (c_col > block_col2)) THEN
- down;
- first_word;
- ELSE
- tstr := get_word_in( '0123456789.-,' );
- call perform_operation;
- end;
- end;
- END;
- END;
- goto_mark;
- tstr := rstr( rx, 0, 10 );
- IF xpos( '.', tstr, 1 ) THEN
- while (copy( tstr, svl(tstr),1 ) = '0') DO
- tstr := copy( tstr, 1, svl(tstr) - 1 );
- end;
- IF (copy( tstr, svl(tstr),1 ) = '.') THEN
- tstr := copy( tstr, 1, svl(tstr) - 1 );
- end;
- END;
- IF (Commas) THEN
- Negative := (Xpos('-',Tstr,1) > 0);
- Jx := Xpos('.',Tstr,1);
- IF (Jx = 0) THEN
- Jx := Svl(tstr);
- ELSE
- --jx;
- END;
- Jx := Jx - Negative;
- Jy := (jx / 3) - ((Jx mod 3) = 0);
- WHILE (Jy) DO
- tstr := Str_Ins(',',tstr,(jx - (Jy * 3)) + 1 + Negative);
- ++jx
- --Jy;
- END;
- END;
- text( tstr );
- Pop_Undo;
- goto exit;
-
- perform_operation:
- remove_commas:
- Jy := XPos(',',Tstr,1);
- IF (Jy) THEN
- Commas := True;
- Tstr := Str_Del(TStr,Jy,1);
- Goto REMOVE_COMMAS;
- END;
- IF rval( ry, tstr ) = 0 THEN
- ++jx;
- IF jx = 1 THEN
- rx := ry;
- ELSE
- IF operation = '+' THEN
- rx := rx + ry;
- END;
- IF operation = '*' THEN
- rx := rx * ry;
- END;
- IF operation = '-' THEN
- rx := rx - ry;
- END;
- IF operation = '/' THEN
- rx := rx / ry;
- END;
- END;
- END;
- ret;
- exit:
-
- END_MACRO;