home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-06-13 | 36.0 KB | 1,518 lines |
- $MACRO_FILE LANGUAGE;
- {******************************************************************************
- MULTI-EDIT MACRO FILE LANGUAGE
- COMPILE - Compile a program
- CMPERROR - Finds compiler errors then moves cursor to line in the source
- TEMPLATE - Calls the appropriate template macro for the language type
- MATCH - Calls the appropriate matching macro for the language type
-
- (C) Copyright 1989 by American Cybernetics, Inc.
- ******************************************************************************}
-
- $MACRO COMPILE;
- {******************************************************************************
- MULTI_EDIT MACRO
-
- Name: COMPILE
-
- Description: Compiles a program based on the setup for the filename extension
- of the current file.
-
- (C) Copyright 1989 by American Cybernetics, Inc.
-
- We would like to acknowledge the contributions of our user base which are too
- numerous to mention here.
- ******************************************************************************}
-
- Def_Str(TStr,Tstr2,Red_Str[40],Comp_Str,trailer[30],Ext[3],E_F_Name[20]);
- { note comp_str above added for ALSYS }
- Def_Int( meerr_id,
- jx,T_Swap_Mode,T_Swap_Mem,Clear_Screen_Stat,Compiler_Prompt,
- Save_All,Reload_File,Dont_Process,Temp_Id,jx2
- );
-
- { Since PLM does not put the file name on the primary file we need to save
- away the name of the primary file in case we find an error in an include file
- we will know when we press the next error key what file to go back to if
- the error is back in the primary file }
-
- {Get the compiler/program interface data for this extension}
- Refresh := false;
- temp_id := window_id;
- meerr_id := 0;
- T_Swap_Mode := Swap_Mode;
- T_Swap_Mem := Swap_Mem;
- Ext := Get_Extension(File_Name);
- TStr := '';
- RM('USERIN^SETCONFIG /DB=MECONFIG.DB/T=' + Ext + '.PGM');
- IF return_int THEN
- Tstr := Ext;
- jx := 1;
- ELSE
- {
- If we can't find a compiler for this extension, Check to see if there might be
- a default compiler setup, and if so, see if this extension was intended to
- fall under the default setup.
- }
- RM('USERIN^SETCONFIG /DB=MECONFIG.DB/T=DEFAULT.PGM');
- IF (RETURN_INT) THEN
- IF (Ext = '') THEN
- Goto NO_EXTENSION;
- END;
-
- RM('USERIN^DB /F=MECONFIG.DB/DPT=EXT.DB/GLO=PGM/RR=1/FV=' + Ext);
- IF (Return_Int = -1) THEN
- NO_EXTENSION:
- Jx := 1;
- TStr := 'DEFAULT';
- ELSE
- TStr := '';
- Jx := 0;
- END;
- END;
- END;
-
- Switch_Win_Id( temp_id );
-
- IF (Get_Extension(Global_Str('Last_Compiled_Window')) <> Caps(Ext)) THEN
- Set_Global_Int('DB#' + Ext + '.PGM',1);
- END;
- Set_Global_Str('Last_Compiled_Window',Caps(file_name));
-
- Clear_Screen_Stat := False;
- Compiler_Prompt := False;
- Save_All := False;
- Red_Str := ' > ' + user_id + 'MEERR.TMP';
-
- IF (Jx = 0) THEN
- Compiler_Prompt := True;
- Tstr := '';
- Goto COMP_PROMPT;
- END;
-
- RM('USERIN^DB /2TOP=1/F=MECONFIG.DB/HPT=DEFAULT.PGM/DPT=' + TStr +
- '.PGM/GLO=PGM/NOALPHA=1/LO=2/LT=(.' + TStr +
- ')─SELECT A PROGRAM/DT=COMPILER-PROGRAM SETUP/H=FE_PROGRAM/ENC=1');
-
- Jx := Return_Int;
-
- IF (Jx = -1) THEN
- Compiler_Prompt := True;
- Tstr := '';
- Goto COMP_PROMPT;
-
- END;
-
- IF (Jx = 0) THEN
- Make_Message('Compiler/program aborted.');
- Goto EXIT;
- END;
-
- ONLY_ONE:
- TStr2 := Global_Str('PGM');
- {We must parse out the compiler command line before we capitalize TSTR2 because
- some compliers command line options are case sensitive.}
- TStr := Parse_Str('CL=',Tstr2);
- TStr2 := Caps(Tstr2);
- Jx := Parse_Int('SM=',TStr2);
- IF (Jx > 1) THEN
- Swap_Mode := Jx - 2;
- {Set swap memory in paragraphs}
- Swap_Mem := (parse_int('MEM=',tstr2) * 1024) / 16;
- END;
-
- Clear_Screen_Stat := Parse_INT('CS=',TSTR2);
- {This will set COMPILER_PROMPT true if the parameter extists or if the command
- line is null}
- Compiler_Prompt := (Parse_Int('CP=',TSTR2)) or (Tstr = '');
- Save_All := Parse_int('SA=',TSTR2);
- Reload_File := Parse_int('RF=',TSTR2);
- Dont_Process := Parse_int('DP=',TSTR2);
- TStr2 := Parse_Str('PT=',TStr2);
- Set_Global_Str('LAST_COMP',TStr2);
- {THE LINE BELOW IS USED FOR ALSYS ADA,DATAFLEX,CLARION, & MICROSOFT C5.X }
- Comp_Str := Caps(Global_Str('LAST_COMP'));
-
-
- { now see if he has a command line }
- IF (Tstr = '') THEN
- { no command line but we still have set the compiler setup flags }
- { that the user put into file extension compiler/program fields }
- Goto COMP_PROMPT;
- END;
-
- {If it exists then setup}
- If TStr <> '' THEN
-
- CHECK_RED:
- JX := XPOS('<NR>',Caps(TStr),1);
- IF jx <> 0 THEN
- Red_Str := '';
- TStr := Str_Del(Tstr,jx,4);
- Goto CHECK_RED;
- END;
-
- {parse the compiler command to insert filename, path and extensions}
- return_str := tstr;
- {
- Make_Message('[' + TSTR + ']');
- }
- RM('XlateCmdLine /F=' + file_name);
-
- tstr := return_str;
-
- If (Tstr2 = 'STONYBROOK MODULA-2') then
- del_file( truncate_path(truncate_extension(file_name)) + '.ERR');
- END;
-
- { Special processing for PLM-86 }
- { Since we use a lot of compiler defaults I tack them on at the end of
- the command line }
- { Someday I am going to make a menu to choose the options from which will
- build the command line for the user }
- { setting the command line prompt to yes will allow the user to enter
- his own command line for now }
-
- COMP_PROMPT:
- IF ((TStr2 = 'INTEL PLM-86') or (TStr2 = 'INTEL IC-86')) and (TStr = '') then
- IF (TStr2 = 'INTEL PLM-86') then
- TStr := 'PLM86 ' + file_name + ' ';
- ELSE
- TStr := 'IC86 ' + file_name + ' ';
- END;
- return_str := tstr;
- rm('QUERYBOX /P=COMMAND LINE: /T=LA OT(3) NOLI DB PR(CON:) added to invocation line for you.'
- + '/W=73/ML=120' );
- tstr := return_str;
- jx := return_int;
- if jx = 0 then
- TStr := '';
- END;
- kill_box;
- if tstr <> '' then
- tstr := tstr + ' LA OT(3) NOLI DB PR(CON:)';
- Compiler_Prompt := False;
- ELSE
- Make_Message('Compile line null. Compile aborted.');
- Goto EXIT;
- END;
- END;
- {Now I see if command line exists}
- {If it exists then setup}
- IF (Compiler_Prompt) THEN
- Return_Str := Tstr;
- RM('userin^QUERYBOX /H=CP/C=1/L=2/W=74/ML=128/T=ENTER COMPILER/PROGRAM COMMAND');
- IF (Return_Int = False) THEN
- Make_Message('Compiler/program aborted.');
- Goto EXIT;
- END;
- Tstr := Return_Str;
- END;
-
-
- {Get rid of meerr.tmp if it exists in memory}
- {Now find the error window}
- jx := 0;
- While (jx < window_count) and (Caps(Truncate_Path(File_Name)) <> (user_id + 'MEERR.TMP')) do
- jx := jx + 1;
- Switch_Window(jx);
- END;
- if caps(truncate_path(file_name)) = (user_id + 'MEERR.TMP') then
- erase_window;
- meerr_id := window_id;
- end;
- if switch_win_id(temp_id) then
- end;
- refresh := TRUE;
- new_screen;
- refresh := FALSE;
-
- {Check the disk to see if MEERR.TMP is read only on disk and warn the user}
- E_F_Name := User_Id + 'MEERR.TMP';
- Jx := File_attr(E_F_Name);
- IF (Error_Level = 0) THEN
- IF (Jx and 1) THEN
- RM('MEERROR^Beeps /C=1');
- RM('userin^XMENU /H=CP/B=1/X=1/Y=2/L=FILE: ' + E_F_Name +
- ' IS MARKED READ ONLY/M=Reset-read-only-attribute(CP)Abort()');
- IF (Return_Int = 1) THEN
- {Turn off read only flag if user wants to, otherwise abort compile}
- Set_File_Attr(E_F_Name,Jx and $FFFE);
- ELSE
- Make_Message('Compiler/program aborted.');
- Goto EXIT;
- END;
- END;
- ELSE
- Error_Level := 0;
- END;
-
- {Save off source file only or all files if Save_All flag is set}
- IF (Save_All) THEN
- Make_Message('Saving files...');
- jx := 0;
- ELSE
- Make_Message('Saving source file...');
- jx := CUR_Window - 1;
- END;
- While (jx < Window_Count) DO
- jx := jx + 1;
- Switch_Window(jx);
- IF (File_Changed <> 0) and (CAPS(FILE_NAME) <> '?NO-FILE?') THEN
- SAVE_FILE;
- IF Error_Level <> 0 THEN
- Refresh := True;
- Redraw;
- Make_Message('Incorrect file name or error saving file.');
- RM('MEERROR^Beeps /C=1');
- Goto exit;
- END;
- END;
- IF (Save_All = False) THEN
- Jx := Window_Count;
- End;
- END;
-
- if switch_win_id(temp_id) then
- end;
- Refresh := True; { to get rid of the * }
- Redraw;
- working; {Turn on the working sign}
- Refresh := False; {Turn screen off}
-
- gotoxy(1, message_row );
-
- Refresh := False; {Turn screen offf}
-
- {****** 10-11-89 07:20pm ******** }
- { Special processing for Microsoft C5.X }
- { This depends on the switch /FsMeerr.tmp in the CL command line }
- If Comp_Str = 'MICROSOFT C5.X' THEN
- Red_Str := ' > NUL';
- end;
- { END OF MICROSOFT C5.X}
- { Special processing for CLARION }
- { THE FOLOWING BAT FILE MUST BE USED FOR COMPILE }
- { ERASE MEERR.TMP
- ERASE *.ERR
- ccmp %1.cla yes /b
- IF NOT EXIST *.ERR GOTO EXIT
- FOR %%F IN (*.ERR) DO TYPE %%F >> MEERR.TMP
- :EXIT }
- {ALSO SET RED_STR TO BLANK FOR DATAFLEX }
- If (Comp_Str = 'CLARION') or (comp_str = 'DATAFLEX') THEN
- Red_Str := '';
- end;
- { END OF CLARION}
-
- if comp_str = 'DATAFLEX' THEN
- TRAILER := '';
- ELSE
- TRAILER := '|13EXIT|13';
- END;
- {********************}
-
- MAKE_MESSAGE( COPY(TSTR,1,78) );
- WORKING;
- Refresh := False;
- {Compile the program}
- If (Clear_Screen_Stat) THEN
- Rest_Dos_Screen;
- Shell_To_Dos(TStr + Red_Str,true);
- Save_Dos_Screen;
- Refresh := True;
- New_Screen;
- ELSE
- Shell_To_Dos(TStr + Red_Str,true);
- END;
-
-
- Refresh := False; {Turn screen offf}
- jx := error_level; {Get the returned error}
- Set_Global_Str('LAST_COMP',TStr2);
-
- IF jx <> 0 THEN
- Make_message('Unable to run compiler.');
- goto exit;
- END;
-
- {reload file if that flag is set}
- IF (Reload_File) THEN
- LOAD_FILE(File_Name);
- RM('EXTSETUP');
- END;
- IF (Dont_Process) THEN
- Goto EXIT;
- END;
- If (TSTR2 = 'STONYBROOK MODULA-2') then
- {For stonybrook, use the error file which is automatically created.}
-
- Shell_to_Dos('COPY ' + truncate_path(truncate_extension(file_name)) + '.ERR ' + user_id + 'MEERR.TMP > NUL',True);
- END;
-
-
- IF NOT(switch_win_id( meerr_id )) THEN
- Switch_Window(Window_Count);
- Create_Window;
- size_window( 1, max_window_row - 6, 60, max_window_row - 1 );
- c_color := m_s_color;
- t_color := m_t_color;
- b_color := m_b_color;
- eof_color := m_s_color;
- s_color := m_s_color;
- h_color := m_h_color;
- RM('WINDOW^SetWindowNames');
- end;
-
- {Load in the error file}
-
- Load_File(user_id + 'MEERR.TMP');
- meerr_id := window_id;
-
- { SPECIAL PROCESSING FOR DATAFLEX }
- {THIS CODE ASSUMES THE USE OF THE FOLLOWING BATCH FILE:
- ERASE MEERR.TMP
- DFCOMP %1.%2 -CFQ
- COPY %1.PRN MEERR.TMP
- IF ERRORLEVEL 1 GOTO EXIT
- :DOIT
- FLEX %1
- :EXIT
- }
- {note that the filename and extension must be given as 2 seperate parms }
- SET_GLOBAL_INT('FLEX',0);
- {I need to know in cmperror if I have the first or subsequent call }
- IF COMP_STR = 'DATAFLEX' THEN
- EOF;
- JX := SEARCH_BWD('ERRORS: 0',0);
- TOF;
- IF JX = 1 THEN
- delete_window;
- if switch_win_id( temp_id ) then
- end;
- MAKE_MESSAGE('NO ERRORS');
- GOTO EXIT;
- END;
- END;
- { END OF DATAFLEX }
-
-
-
- {SPECIAL PROCESSING FOR ALSYS }
- {Note that entire scheme for doing this compile relies on the
- fact that DOS will not copy a zero length file. Thus the bat file
- adacomp.bat :
- ERASE MEERR.TMP
- ada comp %1.ADA
- COPY %1.LST MEERR.TMP
- EXIT
- will produce a zero lenth .lst file and MEERR.TMP will not exist if
- there are no errors }
- IF ((COMP_STR = 'ALSYS') AND (ERROR_LEVEL <> 0)) THEN
- delete_window;
- if switch_win_id(temp_id) then
- end;
- MAKE_MESSAGE('NO ERRORS');
- GOTO EXIT;
- END;
- { end of alsys }
- { FOR CLARION - MEERR.TMP WILL NOT EXIST ON A GOOD COMPILE }
- IF ((COMP_STR = 'CLARION') AND (ERROR_LEVEL <> 0)) THEN
- delete_window;
- if switch_win_id(temp_id) then
- end;
- MAKE_MESSAGE('NO ERRORS');
- Error_Level := 0;
- GOTO EXIT;
- END;
- { end of CLARION }
-
-
- {Special processing for Intermetrics C ADDED 02-14-90 10:42am
- If no errors are found meerr.tmp will not exist}
-
- IF ((COMP_STR = 'INTERMETRICS C') AND (ERROR_LEVEL <> 0)) THEN
- delete_window;
- if switch_win_id(temp_id) then
- end;
- MAKE_MESSAGE('NO ERRORS FOUND');
- Error_Level := 0;
- GOTO EXIT;
- END;
- {End of intermetrics C}
-
-
- {Special processing for the MULTI_EDIT macro language compiler}
- IF Tstr2 = 'MULTI_EDIT' THEN
- {If no errors then load the macro file}
-
- Ignore_Case := true;
- IF ((Search_Fwd('ERROR',0) = False) and
- (Search_Fwd('OUTPUT-FILE',0) = true)) THEN
- goto_col(c_col + 12);
- while cur_char = ' ' do
- right;
- end;
- If cur_char = '=' then
- right;
- end;
- TStr2 := Remove_Space(Get_Word(''));
- tof;
-
- Load_Macro_File(TStr2);
- if switch_win_id(temp_id) then
- end;
- Refresh := true;
- Redraw;
- Make_Message('No errors. Macro file = ' + tstr2);
- Goto EXIT;
- ELSE
- Tof;
- END;
- END;
- TOF;
- if switch_win_id(temp_id) then
- end;
- {Run the find error macro}
- RM( 'CMPERROR' );
- ELSE
- GOTO COMP_PROMPT;
- END;
- exit:
- Swap_Mode := T_Swap_Mode;
- Swap_Mem := T_Swap_Mem;
- temp_id := window_id;
- working;
- Set_Virtual_Display;
- refresh := true;
- switch_win_id( meerr_id );
- redraw;
- switch_win_id( temp_id );
- redraw;
- Update_Virtual_Display;
- Reset_Virtual_Display;
- END_MACRO;
-
-
- $MACRO CMPERROR TRANS;
- {******************************************************************************
- MULTI_EDIT MACRO
-
- Name: CMPERROR
-
- Description: Finds the next error in the MEERR.TMP window generated by the
- last compile.
-
- (C) Copyright 1989 by American Cybernetics, Inc.
- ******************************************************************************}
-
- Def_Str(m_str[128],file_str[128],comp_str[128],e_word,l_str[128],svword[128], nxt[128],t_str); {note: last 3 for alsys }
- Def_Int(Temp_window,jx,ec,el,tc,tl,ofs_stat,vret,scol,DCNT);
- {note: last 3 for alsys}
-
- Refresh := False;
- Temp_Window := Cur_Window;
- Error_Level := 0;
- Ofs_Stat := 0; {This variable decides whether or not ec is an absolute colum
- position, or an offset from the first word}
-
- { I have changed this macro quite a bit to handle intel languages }
- { instead of one section which the error is found in the are a couple
- based on compiler type }
-
- {Find the error window}
- jx := 0;
- While (jx < window_count) and (Caps(Truncate_Path(File_Name)) <> (user_id + 'MEERR.TMP')) do
- jx := jx + 1;
- Switch_Window(cur_window + 1);
- END;
- {If not found then exit}
- If Caps(Truncate_Path(File_Name) ) <> (user_id + 'MEERR.TMP') then
- Make_Message('No error file loaded.');
- goto exit;
- END;
-
- Ignore_Case := True;
- Reg_Exp_Stat := True;
- m_str := '';
- ec := 1; el := 1;
-
- {Get the compiler type for the last compile}
- Comp_Str := Caps(Global_Str('LAST_COMP'));
-
- If (Comp_Str = 'LAHEY FORTRAN') then
- File_Str := Global_Str('last_compiled_window'); { in main file }
- IF (Search_fwd ('{FATAL}||{WARNING}||{ABORT}',0)) THEN
- up;
- goto_col(1);
- if (Search_fwd('^',1)) then
- ec := c_col - 12;
- jx := search_bwd(':',0);
- first_word;
- word_right;
- jx := val (el,get_word(':'));
- jx := Search_fwd ('{FATAL}||{WARNING}||{ABORT}',0);
- else
- down;
- ec := 0;
- first_word;
- jx := search_fwd('(',0);
- right;
- e_word := get_word(')');
- if (search_fwd('line',1)) then
- word_right;
- jx := val(el,get_word(' .&'));
- jx := Search_bwd ('{FATAL}||{WARNING}||{ABORT}',0);
- end;
- end;
- goto display_error;
- END;
- goto no_more_errors;
- end;
-
- {SPECIAL PROCESSING FOR DATAFLEX}
- IF (COMP_STR = 'DATAFLEX') THEN
- {NOTE THAT THE LINE NUMBERS GIVEN IN THE DATAFLEX ERROR FILE ARE
- MEANINGLESS!!! THEY REFER TO THE SOURCE FILE WITH MACRO EXPANSIONS.
- SO WE CAN'T USE THE NUMBERS TO SHOW THE ERRORS.}
- {
- The DATAFLEX users group says that we must search for a bel ^G character before
- the word ERROR:.
- }
- File_Str := Global_Str('last_compiled_window'); { in main file }
- IF SEARCH_FWD('%ERROR:',0) THEN
- MARK_POS;
- M_STR := GET_LINE;
- VRET := 0;
- RELOOK:
- UP;
- FIRST_WORD;
- SVWORD := GET_WORD(':');
- IF SVWORD = 'ERROR:' THEN
- VRET := 1;
- GOTO RELOOK; {WE JUST SHOWED THIS MESSAGE }
- END;
- L_STR := GET_LINE;
- SCOL := XPOS('>',L_STR,1);
- L_STR := STR_DEL(L_STR,1,SCOL);
- DEBLANK:
- SVWORD := COPY(L_STR,1,1);
- IF SVWORD = ' ' THEN
- L_STR := STR_DEL(L_STR,1,1);
- GOTO DEBLANK;
- END;
- GOTO_MARK;
- EOL;
- GOTO DISPLAY_ERROR_FLEX;
- END;
- GOTO NO_MORE_ERRORS;
- END;
- {end DATAFLEX }
-
- {SPECIAL PROCESSING FOR ALSYS ADA VERSION 4.X}
- IF (COMP_STR = 'ALSYS 4') THEN
- File_Str := Global_Str('last_compiled_window'); { in main file }
- IF SEARCH_FWD('[0-9] *@*',0) THEN
- L_STR := GET_LINE;
- L_STR := COPY(L_STR,1,2);
- NXT := REMOVE_SPACE(L_STR);
- DCNT := 0;
- UP;
- UP;
- RETRY4:
- L_STR := GET_LINE;
- L_STR := COPY(L_STR,1,9);
- M_STR := REMOVE_SPACE(L_STR);
- VRET := VAL(EL,M_STR);
- IF VRET <> 0 THEN
- UP;
- DCNT := DCNT + 1;
- GOTO RETRY4;
- END;
- DOWN;
- scol := 0;
- If search_fwd(nxt,1) then
- up;
- svword := get_word(' :=()-+;');
- down;
- scol := 1;
- end;
- DOWN;
- WHILE DCNT > 0 DO
- DOWN;
- DCNT := DCNT - 1;
- END;
- M_STR := GET_LINE;
- GOTO_COL(80);
- GOTO DISPLAY_ERROR_ADA;
- END;
- GOTO NO_MORE_ERRORS;
- END;
- { end alsys 4.x }
-
-
- {SPECIAL PROCESSING FOR ALSYS ADA }
- IF (COMP_STR = 'ALSYS') THEN
- File_Str := Global_Str('last_compiled_window'); { in main file }
- IF SEARCH_FWD('[0-9] : *@*',0) THEN
- DCNT := 0;
- UP;
- UP;
- UP;
- RETRY:
- L_STR := GET_LINE;
- L_STR := COPY(L_STR,1,7);
- M_STR := REMOVE_SPACE(L_STR);
- VRET := VAL(EL,M_STR);
- IF VRET <> 0 THEN
- UP;
- DCNT := DCNT + 1;
- GOTO RETRY;
- END;
- DOWN;
- scol := 0;
- If search_fwd('^',1) then
- up;
- svword := get_word(' :=()-+;');
- down;
- scol := 1;
- end;
- DOWN;
- DOWN;
- WHILE DCNT > 0 DO
- DOWN;
- DCNT := DCNT - 1;
- END;
- M_STR := GET_LINE;
- GOTO_COL(80);
- GOTO DISPLAY_ERROR_ADA;
- END;
- GOTO NO_MORE_ERRORS;
- END;
- { end alsys }
-
- {SPECIAL PROCESSING FOR MICROSOFT C5.X }
- IF (COMP_STR = 'MICROSOFT C5.X') THEN
- SCOL := 0 ; {USED AS A SWITCH IN ERROR DISPLAY }
- File_Str := Global_Str('last_compiled_window'); { in main file }
- IF (SEARCH_FWD('%@*@*@*@*@*',0)) THEN
- M_STR := GET_WORD('(');
- RIGHT;
- M_STR := GET_WORD(')');
- VRET := VAL(EL,M_STR);
- M_STR := GET_WORD(':');
- RIGHT;
- M_STR := GET_WORD('~'); {TO END OF LINE }
- GOTO DISPLAY_ERROR_ADA;
- END;
- GOTO NO_MORE_ERRORS;
- END;
- {END MICROSOFT C5.X }
-
- {SPECIAL PROCESSING FOR CLARION }
- if (comp_str = 'CLARION') THEN
- File_Str := Global_Str('last_compiled_window'); { in main file }
- {WE SEE IF WE HAVE FINISHED }
- IF AT_EOF = 1 THEN
- GOTO NO_MORE_ERRORS;
- END;
- { NEXT WE SEE IF THIS IS A NEW FILE }
- IF SEARCH_FWD('Compiled',1) then
- DOWN;
- VRET := SEARCH_FWD('IN',1);
- RIGHT;
- RIGHT;
- RIGHT;
- M_STR := GET_WORD('.'); { THIS IS THE FILE THAT PRODUCED ERRORS }
- L_STR := CAPS(GET_PATH(FILE_STR));
- File_Str := L_STR+ M_STR + '.CLA';
- DOWN;
- FIRST_WORD;
- END;
- { NOW WE ARE AT AN ERROR LINE }
- M_STR := GET_WORD('@');
- RIGHT;
- M_STR := GET_WORD('/');
- VRET := VAL(EL,M_STR);
- RIGHT;
- M_STR := GET_WORD(':');
- VRET := VAL(EC,M_STR);
- RIGHT;
- M_STR := GET_WORD('~'); {TO END OF LINE}
- DOWN;
- FIRST_WORD; {PREPARE FOR NEXT ERROR }
- GOTO DISPLAY_ERROR_ADA;
- END;
- {END CLARION}
-
-
- If (Comp_Str = 'TURBO ASSEMBLER') then
- If (Search_Fwd('@*{@*Error@*}||{Warning}@*', 0)) THEN
- m_str := Get_Word(' ');
- right;
- file_str := Get_Word('(');
- right;
- m_str := get_word(')');
- jx := val( el, m_str );
- right;
- right;
- m_str := get_word('');
- goto display_error;
- end;
-
- Goto No_More_Errors;
- end;
-
- If (Comp_Str = 'CLIPPER') or (Comp_Str = 'FOXBASE') then
- If (Search_Fwd('%{error in }*line [0-9]+:',0)) THEN
- M_Str := Get_Word( '0123456789' );
- M_Str := Remove_Space( Get_Word(':') );
- If (Val(El,M_Str) > 0) then
- Goto Error_Exit;
- END;
- jx := c_line;
- ec := 1;
- down;
- goto_col(1);
- if Caps(get_word(' ')) <> 'LINE' then
- down;
- IF (Search_Fwd('^',1)) THEN
- ec := C_Col;
- END;
- END;
- goto_line(jx);
- file_str := '';
- IF (Search_Bwd('%COMPILING ',0)) THEN
- Word_Right;
- File_Str := Remove_Space(Get_Word(''));
- END;
- goto_line(jx);
- eol;
- Goto Display_Error;
- END;
- GOTO NO_MORE_ERRORS;
- END;
-
- If (Comp_Str = 'STONYBROOK MODULA-2') then
- File_Str := Global_Str('last_compiled_window'); { in main file }
- word_right;
- goto_col(1);
- M_Str := get_word(' ');
- If (Val(El,M_Str) > 0) then
- goto try_stonybrook_21;
- END;
- right;
- M_Str := get_word(' ');
- If (Val(Ec,M_Str) > 0) then
- Goto NO_MORE_ERRORS;
- END;
- Goto DISPLAY_ERROR;
- try_stonybrook_21:
- goto_col(1);
- forward_till( '(' );
- right;
- M_Str := get_word(')');
- If (Val(El,M_Str) > 0) then
- Goto NO_MORE_ERRORS;
- END;
- forward_till('(');
- right;
- M_Str := get_word(')');
- If (Val(Ec,M_Str) > 0) then
- Goto NO_MORE_ERRORS;
- END;
- Goto DISPLAY_ERROR;
- END;
-
- If (Comp_Str = 'LOGITECH MODULA-2') then
- File_Str := Global_Str('last_compiled_window'); { in main file }
- Tc := C_Col;
- Tl := C_Line;
- Tof;
- If Search_Fwd('---- error',0) then
- Goto_Col(Tc);
- Goto_Line(Tl);
- M2_LOGI_AGAIN:
- If Search_Fwd('^',0) then
- Tc := C_Col;
- Tl := C_Line;
- Ec := Tc - 6;
- Goto_Col(2);
- M_Str := Get_Word(' ');
- If Xpos('*****',M_Str,1) <> 0 then
- Goto_Col(2);
- While (Cur_Char = '*') do;
- Up;
- END;
- Left;
- While (Cur_Char = ' ') do
- Right;
- END;
- M_Str := Get_Word(' ');
- Jx := Val(El,M_Str);
- If Jx <> 0 then
- Goto ERROR_EXIT;
- END;
- Goto_Line(Tl);
- Goto_Col(Tc);
- Right;
- Right;
- M_Str := Get_Word(', ');
- If Search_Fwd(M_Str,0) then
- M_Str := Get_Line;
- ELSE
- Goto ERROR_EXIT;
- END;
- Goto_Line(Tl);
- Eol;
- Goto DISPLAY_ERROR;
- ELSE
- Down;
- Goto_Col(1);
- Goto M2_LOGI_AGAIN;
- END;
- ELSE
- GOTO NO_MORE_ERRORS;
- END;
- ELSE
- Ignore_Case := False;
- If Search_Fwd('{----}||{===>}',0) then
- Ignore_Case := True;
- M_Str := '';
- Tof;
- Goto DISPLAY_ER3;
- ELSE
- Ignore_Case := True;
- Goto NO_ERRORS;
- END;
- END;
- END;
-
- If (Comp_Str = 'JPI MODULA-2') then
- Tc := C_Col;
- Tl := C_Line;
- Goto_Col(1);
- If Search_Fwd('No Errors',0) then
- Goto_Line(Tl);
- Goto_Col(Tc);
- Goto NO_ERRORS;
- ELSE
- Goto_Line(Tl);
- Goto_Col(Tc);
- M2_JPI_AGAIN:
- If Search_Fwd('(',0) then
- If C_Col <> 1 then
- Right;
- Goto M2_JPI_AGAIN;
- END;
- Right;
- File_Str := Get_Word(' ');
- While Cur_Char = ' ' do
- Right;
- END;
- M_Str := Get_Word(',');
- If Val(El,M_Str) <> 0 then
- Goto ERROR_EXIT;
- END;
- Right;
- M_Str := Get_Word(')');
- If Val(Ec,M_Str) <> 0 then
- Goto ERROR_EXIT;
- END;
- Goto DISPLAY_ERROR;
- ELSE
- Goto NO_MORE_ERRORS;
- END;
- END;
- END;
-
- {Special processing for MICROSOFT PASCAL 3.3}
- IF (COMP_STR = 'MS PASCAL 3.3') THEN
- IF Search_Fwd('@^',0) THEN
- ec := c_col - 16;
- IF ec < 1 then
- ec := 1;
- end;
- goto_col(7);
- word_right;
- m_str := remove_space( get_word(' '));
- IF Val(EL,M_Str) <> 0 THEN
- Goto Error_Exit;
- END;
- m_str := get_word('');
- Goto Display_Er2;
- END;
- GOTO NO_ERRORS;
- END;
-
- IF (COMP_STR = 'POWER C') THEN
- If Search_FWD( 'ERROR IN FILE:',0) THEN
- M_Str := Get_Word(':');
- right;
- File_Str := Get_Word('');
- up;
- up;
- goto_col(1);
- M_Str := Get_Word('||');
- M_Str := REMOVE_SPACE( M_Str );
- IF Val(EL,M_Str) <> 0 THEN
- GOTO error_exit;
- END;
- down;
- goto_col(1);
- IF Search_Fwd('^', 1) THEN
- ec := C_Col - 6;
- end;
- down;
- down;
- goto display_error;
- END;
- END;
-
- IF (COMP_STR = 'POWER C 1.2.0') THEN
- If Search_FWD( '%@*@*@*@*@*@*@*@*@*@*@*@*@*@*@*@*',0) THEN
- Up;
- File_Str := Get_Word('(');
- Right;
- M_Str := Get_Word(')');
- IF Val(EL,M_Str) <> 0 THEN
- GOTO error_exit;
- END;
- Down;
- Down;
- ec := 1;
- goto display_error;
- END;
- END;
-
- IF (COMP_STR = 'JANUS ADA') THEN
- If Search_FWD( '%In File ',0) THEN
- Goto_Col(9);
- File_Str := Get_Word(' ');
- Word_Right;
- Word_Right;
- Word_Right;
- M_Str := Get_Word('');
- IF Val(EL,M_Str) <> 0 THEN
- GOTO error_exit;
- END;
- Down;
- Down;
- Down;
- Down;
- Down;
- ec := 1;
- goto display_error;
- END;
- END;
-
-
- If (Comp_Str = 'ZORTECH C++') then
- if search_fwd('%"?+", line [0-9]', 0 ) then
- goto_col(1);
- right;
- file_str := Caps(get_word('"'));
- m_str := get_word('0123456789');
- m_str := remove_space( get_word(' ') );
- IF Val(EL,M_Str) <> 0 THEN
- GOTO error_exit;
- END;
- up;
- goto_col(1);
- if search_fwd('^',1) then
- ec := c_col;
- end;
- down;
- eol;
- goto display_error;
- end;
- end;
-
- If (COMP_STR = 'INTEL PLM-86') or
- (COMP_STR = 'INTEL ASM-86') or
- (COMP_STR = 'INTEL IC-86') THEN
-
- If Search_FWD('FATAL ',0) then
- RM('MEERROR^Beeps /C=2');
- Make_Message('FATAL COMPILER ERROR');
- goto Exit2;
- END;
-
- If Search_FWD('I/O ERROR',0) then
- RM('MEERROR^Beeps /C=2');
- Make_Message('COMPILER I/O ERROR');
- goto Exit2;
- END;
-
- IF SEARCH_FWD('{@*@*@* ERROR}||{@*@*@* WARNING}',0) THEN
- goto_col(1);
- IF (Comp_Str = 'INTEL PLM-86') then
- IF Search_Fwd('{(}',1) then
- Right;
- M_Str := Get_Word(',');
- if POS(')',M_Str) = 0 then
- File_str := M_Str; { error is in an include file }
- if Search_Fwd('{LINE }',1) = 0 then
- goto error_no_line;
- end;
- else
- if Search_Bwd('{LINE }',1) = 0 then
- goto error_no_line;
- end;
- File_Str := Global_Str('last_compiled_window'); { in main file }
- end;
- Word_Right;
- M_Str := Get_Word(')');
- IF Val(EL,M_Str) <> 0 THEN
- goto error_exit;
- END;
- ELSE
- goto error_no_line;
- END;
- END;
-
- IF (Comp_Str = 'INTEL ASM-86') then
- File_Str := Global_Str('Last_Compiled_Window');
- IF Search_Fwd('{IN }',1) then
- Word_Right;
- M_Str := Get_Word(',');
- IF Val(EL,M_Str) <> 0 THEN
- GOTO error_exit;
- END;
- ELSE
- GOTO error_no_line;
- END;
- END;
-
- IF (Comp_Str = 'INTEL IC-86') then
- IF Search_Fwd('{LINE }',1) then
- Word_Right;
- M_Str := Get_Word(' ');
- IF Val(EL,M_Str) <> 0 THEN
- goto error_exit;
- END;
- Word_Right;
- Word_Right;
- File_Str := Get_Word(' ');
- File_Str := Str_Del(File_Str, Length(File_Str), 1);
- ELSE
- goto error_no_line;
- END;
- END;
-
- { it drops down to here when a true error }
- GOTO DISPLAY_ERROR;
-
- END;
-
- Goto DISPLAY_LINE;
-
- END;
-
- IF (Comp_Str = 'REALIA COBOL') THEN
- IF (Search_Fwd('%????? E||W',0)) THEN
- IF (Cur_Char = ' ') THEN
- Word_Right;
- END;
- IF Val(EL,Get_Word(' ')) <> 0 THEN
- goto error_exit;
- END;
- Goto_Col(7);
- IF (Cur_Char = 'E') THEN
- M_Str := 'ERROR: ';
- ELSE
- M_Str := 'WARNING: ';
- END;
- Goto_Col(9);
- M_Str := M_Str + Remove_Space(Get_Word(''));
- Goto DISPLAY_ERROR;
- ELSE
- IF (C_Line = 1) THEN
- Goto NO_ERRORS;
- ELSE
- Goto NO_MORE_ERRORS;
- END;
- END;
- END;
-
-
- {Intermetrics support added 02-14-90 10:42am}
-
- IF (COMP_STR = 'INTERMETRICS C') THEN
- if (AT_EOF = 1) then
- goto no_more_errors;
- else
- GOTO_COL(2);
- search_fwd(':',1);
- right;
- File_Str := Caps(Get_Word(':'));
- right;
- M_Str := Caps(Get_Word(':'));
-
- IF Val(EL,M_Str) <> 0 THEN
- Goto Error_Exit;
- end;
-
- word_right;
- t_Str := Get_Word('');
- m_str := file_str + ' ' + '(' + str(el) + ')' + ' ' + t_str;
- down;
- goto_col(1); {for eof check to be reliable you must be at beg of line}
- Switch_Window(Temp_Window);
- goto_line(el);
- goto display_er3;
- END;
- END;
-
- { all other compilers }
- {Search for error or warning messages}
- DO_AGAIN:
- If Search_FWD('{ERROR[~S]}||{WARNING[~S]}||{NOT ENOUGH MEMORY}||{ABORTED}||{TOO BIG}',0) THEN
- tc := c_col;
- Goto_Col(1);
-
- IF Search_FWD('[0-9] Warning Errors',1) THEN
- EOL;
- GOTO Do_AGAIN;
- END;
-
- Goto_Col(1);
- IF Caps(GET_WORD(' :(')) = 'LINK' THEN
- Goto_Col(1);
- M_Str := Get_Word('');
- Goto DISPLAY_ER3;
- END;
- Goto_Col(1);
-
-
- IF (Comp_Str = 'ARCHIMEDES C') THEN
-
- IF (Cur_Char = '"') THEN { must be a C compiler error }
- RIGHT ;
- File_Str := CAPS (REMOVE_SPACE (GET_WORD ('"'))) ;
-
- RIGHT ;
- RIGHT ;
- M_Str := REMOVE_SPACE (GET_WORD (' ')) ;
-
- ELSE { must be an assembler error }
- Return_Int := SEARCH_FWD ('in ',1) ;
- RIGHT ;
- RIGHT ;
- M_Str := REMOVE_SPACE (GET_WORD (':/')) ;
- File_Str := GLOBAL_STR ('Last_Compiled_Window') ;
-
- IF (Cur_Char = '/') THEN
- RIGHT ;
- M_Str := REMOVE_SPACE (GET_WORD (' ')) ;
-
- File_Str := GET_WORD ('"') ;
- RIGHT ;
- File_Str := CAPS (REMOVE_SPACE (GET_WORD ('"'))) ;
- END ;
-
- END ;
-
- IF (VAL (El,M_Str) <> 0) THEN
- GOTO ERROR_EXIT ;
- END ;
-
- END ;
-
- IF (COMP_STR = 'LATTICE C 3.0') THEN
- File_Str := Caps(Remove_Space(Get_Word(' ')));
- Right;
- M_Str := Remove_Space(Get_Word(' '));
- IF Val(EL,M_Str) <> 0 THEN
- Goto Error_Exit;
- END;
- END;
-
- IF (COMP_STR = 'AZTEC C') THEN
- goto_col(tC);
- If Search_BWD(':',1) THEN
- left;
- If Search_BWD(':',1) THEN
- EC := C_Col;
- If Search_BWD('/',1) THEN
- File_Str := Copy(Get_Line,1,C_Col - 1) + '\' +
- Copy(Get_Line, C_Col + 1, ec - c_col - 1);
- ELSE
- File_Str := Copy(Get_Line,1,EC - 1);
- END;
- goto_col(EC);
- right;
- m_str := get_word(':');
- IF Val(EL,M_Str) <> 0 THEN
- Goto Error_Exit;
- END;
- Up;
- goto_col(1);
- if search_fwd('^',1) then
- ec := c_col;
- end;
- down;
- goto display_error;
- END;
- END;
- END;
-
- IF (COMP_STR = 'TURBO C') THEN
- File_Str := Get_Word(' ');
- Right;
- File_Str := Caps(Remove_Space(Get_Word(' ')));
- Right;
- M_Str := Remove_Space(Get_Word(':'));
- IF Val(EL,M_Str) <> 0 THEN
- Goto Error_Exit;
- END;
- END;
-
- IF (COMP_STR = 'RBASE_5') THEN
- Goto_Col(1);
- File_Str := Caps(Remove_Space(Get_Word(' ')));
- Right; Right;
- M_Str := Remove_Space(Get_Word(')'));
- Down;
- IF Val(EL,M_Str) <> 0 THEN
- Goto Error_Exit;
- END;
- END;
-
-
-
- IF (COMP_STR = 'MICROSOFT') or
- (COMP_STR = 'MULTI_EDIT') or
- (COMP_STR = 'TURBO PASCAL 5.0') or
- (Comp_Str = 'TURBO PASCAL 4.0') THEN
- File_Str := Caps(Remove_Space(Get_Word(' (,')));
-
- Right;
- M_Str := Remove_Space(Get_Word(',)'));
- IF (File_Str = 'ERROR') THEN
- IF (Caps(Copy(M_Str,1,7)) = 'OPENING') THEN
- Tof;
- M_Str := 'Error opening file.';
- Goto DISPLAY_ER3;
- END;
- END;
- IF Val(EL,M_Str) <> 0 THEN
- Goto Error_Exit;
- END;
- if cur_char = ',' THEN
- right;
- M_Str := Remove_Space(Get_Word(')'));
- IF Val(EC,M_Str) <> 0 THEN
- Goto Error_Exit;
- END;
- END;
- if (COMP_STR = 'TURBO PASCAL 5.0') or
- (COMP_STR = 'TURBO PASCAL 4.0') then
- down;
- first_word;
- ec := c_col;
- ofs_stat := 1;
- down;
- while (Cur_Char <> '^') and NOT(At_EOL) do
- right;
- end;
- if (Cur_Char = '^') then
- EC := C_Col - ec;
- END;
- UP;
- UP;
- END;
- END;
-
-
- { if a compiler drops through to here no errors so display top line }
- { this works for PLM-86, ASM-86, TURBO PASCAL 4.0, TURBO C and maybe others }
- {
- Goto DISPLAY_LINE;
- }
-
- DISPLAY_ERROR:
- If Comp_Str <> 'LOGITECH MODULA-2' then
- goto_Col(1);
- M_Str := Get_Word('');
- END;
-
- CALL FIND_FILE_WINDOW;
-
- DISPLAY_ER2:
- While C_Row < ((Win_Y2 - Win_Y1) / 2) do
- down;
- end;
-
- goto_line(el - (format_stat <> 0));
-
- If ofs_stat then
- first_word;
- ec := c_col + ec;
- else
- COMP_STR := GET_LINE;
- JX := 1;
- {we need to figure out the actual column number with tab expansion
- included}
- CRUNCH_TABS( COMP_STR, JX );
- EXPAND_TABS( COMP_STR, EC );
- end;
- goto_col(ec);
-
- DISPLAY_ER3:
- Make_Message(M_Str);
- RM('MEERROR^Beeps /C=1');
- GOTO Exit2;
- END;
-
-
- DISPLAY_LINE:
- EOF;
- Left;
- M_Str := Get_Line;
- Make_Message(M_Str);
- goto exit;
-
- {FOR DATAFLEX}
- DISPLAY_ERROR_FLEX:
- CALL FIND_FILE_WINDOW;
- MAKE_MESSAGE(M_STR);
- DCNT := GLOBAL_INT('FLEX');
- IF DCNT = 0 THEN
- TOF;
- SET_GLOBAL_INT('FLEX',1); {MUST KNOW IF FIRST ERROR OR LATER }
- END;
- IF VRET = 0 THEN
- JX := SEARCH_FWD(L_STR,0);
- END;
- DCNT := C_LINE;
- GOTO EXIT2;
- { end DATAFLEX}
-
-
- { for alsys}
- DISPLAY_ERROR_ADA:
- CALL FIND_FILE_WINDOW;
- IF VRET = 0 THEN
- GOTO_LINE(EL);
- IF SCOL = 1 THEN
- FIRST_WORD;
- reg_exp_stat := false;
- SCOL := SEARCH_FWD(SVWORD,1);
- reg_exp_stat := true;
- END;
- END;
- MAKE_MESSAGE(M_STR);
- GOTO EXIT2;
- { end alsys}
-
-
- NO_MORE_ERRORS:
- MAKE_MESSAGE('No more errors.');
- GOTO EXIT;
-
- NO_ERRORS:
- Make_Message('No Errors.');
- goto exit;
-
- ERROR_EXIT:
- Make_message('Problem parsing error file.');
- GOTO Exit2;
-
- ERROR_NO_LINE:
- Make_message('Error.');
- RM('MEERROR^Beeps /C=1');
- GOTO Exit2;
-
- EXIT:
- Switch_Window(Temp_Window);
-
- EXIT2:
- Refresh := true;
- redraw;
- GOTO FINAL_EXIT;
- { ========================================================================}
- FIND_FILE_WINDOW:
- jx := 0;
- While (jx <= window_count) and (Caps(Truncate_Path(File_Name)) <> Truncate_Path(File_Str)) do
- jx := jx + 1;
- Switch_Window(jx);
- END;
- If (jx >= Window_Count) and (Caps(Truncate_Path(File_Name)) <> Truncate_Path(File_Str)) then
- Switch_Window(Window_Count);
- Create_Window;
- Load_File(file_str);
- RM('WINDOW^SetWindowNames');
- RM('EXTSETUP');
- END;
- window_attr := 0;
- RET;
- FINAL_EXIT:
- END_MACRO;
-
-
- $MACRO TEMPLATE;
- {******************************************************************************
- MULTI_EDIT MACRO
-
- Name: TEMPLATE
-
- Description: Calls the appropriate template macro for the filename extension
- of the current file. The macro name is determined by the first three
- characters of the language type followed by '_IND'. For example, the
- pascal macro would be 'PAS_IND', the C macro would be 'C_IND'
-
- (C) Copyright 1989 by American Cybernetics, Inc.
- ******************************************************************************}
-
- Def_Str(TStr);
- Def_Int(jx);
-
- Push_Undo;
- TStr := Global_Str('.' + Get_Extension(File_Name));
- IF TStr <> '' THEN
- TStr := Parse_Str('LS=',TStr);
- IF Tstr <> '' THEN
- RM( Tstr + '^' + Copy(TStr,1,3)+'TEMP' );
- IF Error_Level <> 0 THEN
- GOTO No_Support;
- END;
- GOTO Exit;
- END;
- END;
- NO_Support:
- Make_Message('NOT Supported for this file extension.');
- EXIT:
- Pop_Undo;
- END_MACRO;
-
- $MACRO MATCH;
- {******************************************************************************
- MULTI_EDIT MACRO
-
- Name: MATCH
-
- Description: Calls the appropriate matching macro for the filename extension
- of the current file. The macro name is determined by the first three
- characters of the language type followed by 'MTCH'. For example, the
- pascal matching macro would be named 'PASMTCH', the C macro would be 'CMTCH'
-
- (C) Copyright 1989 by American Cybernetics, Inc.
- ******************************************************************************}
- Def_Str(TStr);
- Def_Int(jx);
- TStr := Global_Str('.' + Get_Extension(File_Name));
- IF TStr <> '' THEN
- TStr := Parse_Str('LS=',TStr);
- IF Tstr <> '' THEN
- RM( TStr + '^' + Copy(TStr,1,3)+'MTCH' );
- IF Error_Level <> 0 THEN
- GOTO No_Support;
- END;
- GOTO Exit;
- END;
- END;
- NO_Support:
- Make_Message('NOT Supported for this file extension.');
- EXIT:
- END_MACRO;