/************************************************************************ * synerr -write out syntax and warning errors * * * * useage call synerr(errno) * * where errno =the error number to print * * note: * * 1. Synerr also prints out the line number and * * file name where the error was detected. It should be noted * * that where the error was detected may not be where the error * * originally occured. * * 2. Convention has it that syntax errors are positive * * and general warnings are negative. * ************************************************************************/ subroutine synerr(int) include ratfor.def include getlin.cmm include lineno.cmm character outbuf(80) #store up output call scopy(' RATFOR: ',1,outbuf,1) call ita(lineno(lun),outbuf(iindex(outbuf,EOS))) #add line number call concat(outbuf,' in file ') call concat(outbuf,inname(1,lun)) call concat(outbuf,": ") switch(int) { #now the type of the error case F_CASE_BIG: call concat(outbuf,'FATAL Too many case statements') break case F_CASE_NAME: call concat(outbuf,'FATAL Switch expression lost') break case F_CASE_NEST: call concat(outbuf,'FATAL Case statements nested too deeply') break case F_ERR_RATINI: call concat(outbuf,'FATAL Failure installing key words') break case F_FOR_NEST: call concat(outbuf,'FATAL Fors nested too deeply') break case F_FOR_REIN: call concat(outbuf,'FATAL For reinitialization lost') break case F_FOR_TST: call concat(outbuf,'FATAL For test lost') break case F_LAB_LOST: call concat(outbuf,'FATAL Label lost') break case S_2_MANY_DEF: call concat(outbuf,'ERROR Too many definitions') break case S_CASE_DUP: call concat(outbuf,'ERROR Duplicate case value found') break case S_CASE_VAL: call concat(outbuf,'ERROR Illegal case value') break case S_CASE_SEMI: call concat(outbuf,'ERROR Missing semicolon in case statement') break case S_EOF: call concat(outbuf,'ERROR Unexpected end of file') break case S_IDENT_EXP: call concat(outbuf,'Identifier expected') break case S_ILL_BREAK: call concat(outbuf,'ERROR Illegal break') break case S_ILL_CHAR: call concat(outbuf,'ERROR Illegal character') break case S_ILL_DEF: call concat(outbuf,'ERROR Illegal definition') break case S_ILL_ELSE: call concat(outbuf,'ERROR Illegal else') break case S_ILL_LABEL: call concat(outbuf,'ERROR Illegal label') break case S_ILL_NEXT: call concat(outbuf,'ERROR Illegal next') break case S_ILL_OCTAL: call concat(outbuf,'ERROR Illegal octal number, ignored') break case S_ILL_RBRACE: call concat(outbuf,'ERROR Illegal right brace') break case S_RPAREN_EXP: call concat(outbuf,'Right parenthesis expected') break case S_ILL_STR: call concat(outbuf,'ERROR Illegal string') break case S_ILL_STRING: call concat(outbuf,'ERROR Illegal string statement') break case S_ILL_UNTIL: call concat(outbuf,'ERROR Illegal until') break case S_INBUF_OVFL: call concat(outbuf,'ERROR Input buffer overflow') break case S_INPUT_FILE: call concat(outbuf,'ERROR reading input file') break case S_MIS_LPAREN: call concat(outbuf,'ERROR Missing left parenthesis') break case S_MIS_PAREN: call concat(outbuf,'ERROR Missing parenthesis') break case S_NO_CHAR: call concat(outbuf,'ERROR "character" not defined') break case S_OVRFL_TBL: call concat(outbuf,'ERROR Definition table full') break case S_STACK_OVR: call concat(outbuf,'ERROR Parse stack overflow') break case S_UNBAL_BRACES: call concat(outbuf,'ERROR Unbalanced parenthesis') break case S_UNBAL_PARENS: call concat(outbuf,'ERROR Unbalanced parenthesis') break case W_SUS_STATE: call concat(outbuf,'WARNING Suspect statement found, probably illegal') break case W_INC_OVR: call concat(outbuf,'WARNING Includes nested too deep') break case W_INVAL_DEF: call concat(outbuf,'WARNING Invalid re-definition') break case W_OPEN_FILE: call concat(outbuf,'WARNING Error in opening file') break case W_6_CH_VAR: call concat(outbuf,'WARNING Long variable name lost') break case DEFAULT: call concat(outbuf,'Unknown error, error number is ') call ita(int,outbuf(iindex(outbuf,EOS))) } write(ERRLUN,100)(outbuf(i),i=1,length(outbuf)) 100 format(80a1) if (int > FATAL_ERR_LIM) call seterr(ERROR_RET) else if (int > 0) call seterr(SEV_ERR_RET) else call seterr(WARN_RET) return end