xref: /csrg-svn/usr.bin/error/input.c (revision 34664)
121635Sdist /*
221635Sdist  * Copyright (c) 1980 Regents of the University of California.
3*34664Sbostic  * All rights reserved.
4*34664Sbostic  *
5*34664Sbostic  * Redistribution and use in source and binary forms are permitted
6*34664Sbostic  * provided that this notice is preserved and that due credit is given
7*34664Sbostic  * to the University of California at Berkeley. The name of the University
8*34664Sbostic  * may not be used to endorse or promote products derived from this
9*34664Sbostic  * software without specific prior written permission. This software
10*34664Sbostic  * is provided ``as is'' without express or implied warranty.
1121635Sdist  */
1221635Sdist 
1321635Sdist #ifndef lint
14*34664Sbostic static char sccsid[] = "@(#)input.c	5.2 (Berkeley) 06/06/88";
15*34664Sbostic #endif /* not lint */
1621635Sdist 
171456Sroot #include <stdio.h>
181456Sroot #include <ctype.h>
191456Sroot #include "error.h"
201456Sroot 
211456Sroot int	wordc;		/* how long the current error message is */
221456Sroot char	**wordv;	/* the actual error message */
231456Sroot 
241456Sroot int	nerrors;
251456Sroot int	language;
261456Sroot 
271456Sroot Errorclass	onelong();
281456Sroot Errorclass	cpp();
292798Swnj Errorclass	pccccom();	/* Portable C Compiler C Compiler */
302798Swnj Errorclass	richieccom();	/* Richie Compiler for 11 */
311456Sroot Errorclass	lint0();
321456Sroot Errorclass	lint1();
331456Sroot Errorclass	lint2();
341456Sroot Errorclass	lint3();
351456Sroot Errorclass	make();
361456Sroot Errorclass	f77();
371456Sroot Errorclass	pi();
381456Sroot Errorclass	ri();
3913106Srrh Errorclass	troff();
4017499Srrh Errorclass	mod2();
411456Sroot /*
421456Sroot  *	Eat all of the lines in the input file, attempting to categorize
431456Sroot  *	them by their various flavors
441456Sroot  */
451456Sroot static	char	inbuffer[BUFSIZ];
461456Sroot 
471456Sroot eaterrors(r_errorc, r_errorv)
481456Sroot 	int	*r_errorc;
495592Srrh 	Eptr	**r_errorv;
501456Sroot {
511456Sroot 	extern	boolean	piflag;
521456Sroot 	Errorclass	errorclass = C_SYNC;
531456Sroot 
541456Sroot     for (;;){
551456Sroot 	if (fgets(inbuffer, BUFSIZ, errorfile) == NULL)
561456Sroot 		break;
571456Sroot 	wordvbuild(inbuffer, &wordc, &wordv);
581456Sroot 	/*
591456Sroot 	 *	for convience, convert wordv to be 1 based, instead
601456Sroot 	 *	of 0 based.
611456Sroot 	 */
621456Sroot 	wordv -= 1;
6316460Sedward 	if ( wordc > 0 &&
6416460Sedward 	   ((( errorclass = onelong() ) != C_UNKNOWN)
651456Sroot 	   || (( errorclass = cpp() ) != C_UNKNOWN)
662798Swnj 	   || (( errorclass = pccccom() ) != C_UNKNOWN)
672798Swnj 	   || (( errorclass = richieccom() ) != C_UNKNOWN)
681456Sroot 	   || (( errorclass = lint0() ) != C_UNKNOWN)
691456Sroot 	   || (( errorclass = lint1() ) != C_UNKNOWN)
701456Sroot 	   || (( errorclass = lint2() ) != C_UNKNOWN)
711456Sroot 	   || (( errorclass = lint3() ) != C_UNKNOWN)
721456Sroot 	   || (( errorclass = make() ) != C_UNKNOWN)
731456Sroot 	   || (( errorclass = f77() ) != C_UNKNOWN)
741456Sroot 	   || ((errorclass = pi() ) != C_UNKNOWN)
751456Sroot 	   || (( errorclass = ri() )!= C_UNKNOWN)
7617499Srrh 	   || (( errorclass = mod2() )!= C_UNKNOWN)
7716460Sedward 	   || (( errorclass = troff() )!= C_UNKNOWN))
781456Sroot 	) ;
791456Sroot 	else
801456Sroot 		errorclass = catchall();
811456Sroot 	if (wordc)
821456Sroot 		erroradd(wordc, wordv+1, errorclass, C_UNKNOWN);
831456Sroot     }
841456Sroot #ifdef FULLDEBUG
851456Sroot     printf("%d errorentrys\n", nerrors);
861456Sroot #endif
871456Sroot     arrayify(r_errorc, r_errorv, er_head);
881456Sroot }
891456Sroot 
901456Sroot /*
911456Sroot  *	create a new error entry, given a zero based array and count
921456Sroot  */
931456Sroot erroradd(errorlength, errorv, errorclass, errorsubclass)
941456Sroot 	int		errorlength;
951456Sroot 	char		**errorv;
961456Sroot 	Errorclass	errorclass;
971456Sroot 	Errorclass	errorsubclass;
981456Sroot {
995592Srrh 	reg	Eptr	newerror;
1005592Srrh 	reg	char	*cp;
1011456Sroot 
1021456Sroot 	if (errorclass == C_TRUE){
1031456Sroot 		/* check canonicalization of the second argument*/
1041456Sroot 		for(cp = errorv[1]; *cp && isdigit(*cp); cp++)
1051456Sroot 			continue;
1061456Sroot 		errorclass = (*cp == '\0') ? C_TRUE : C_NONSPEC;
1071456Sroot #ifdef FULLDEBUG
1081456Sroot 		if (errorclass != C_TRUE)
1091456Sroot 			printf("The 2nd word, \"%s\" is not a number.\n",
1101456Sroot 				errorv[1]);
1111456Sroot #endif
1121456Sroot 	}
1131456Sroot 	if (errorlength > 0){
1145592Srrh 		newerror = (Eptr)Calloc(1, sizeof(Edesc));
1151456Sroot 		newerror->error_language = language; /* language is global */
1161456Sroot 		newerror->error_text = errorv;
1171456Sroot 		newerror->error_lgtext = errorlength;
1181456Sroot 		if (errorclass == C_TRUE)
1191456Sroot 			newerror->error_line = atoi(errorv[1]);
1201456Sroot 		newerror->error_e_class = errorclass;
1211456Sroot 		newerror->error_s_class = errorsubclass;
1221456Sroot 		switch(newerror->error_e_class = discardit(newerror)){
1231456Sroot 			case C_SYNC:		nsyncerrors++; break;
1241456Sroot 			case C_DISCARD: 	ndiscard++; break;
1251456Sroot 			case C_NULLED:		nnulled++; break;
1261456Sroot 			case C_NONSPEC:		nnonspec++; break;
1271456Sroot 			case C_THISFILE: 	nthisfile++; break;
1281456Sroot 			case C_TRUE:		ntrue++; break;
1291456Sroot 			case C_UNKNOWN:		nunknown++; break;
1301456Sroot 			case C_IGNORE:		nignore++; break;
1311456Sroot 		}
1321456Sroot 		newerror->error_next = er_head;
1331456Sroot 		er_head = newerror;
1341456Sroot 		newerror->error_no = nerrors++;
1351456Sroot 	}	/* length > 0 */
1361456Sroot }
1371456Sroot 
1381456Sroot Errorclass onelong()
1391456Sroot {
1401456Sroot 	char	**nwordv;
1411456Sroot 	if ( (wordc == 1) && (language != INLD) ){
1421456Sroot 		/*
1431456Sroot 		 *	We have either:
1441456Sroot 		 *	a)	file name from cc
1451456Sroot 		 *	b)	Assembler telling world that it is complaining
1461456Sroot 		 *	c)	Noise from make ("Stop.")
1471456Sroot 		 *	c)	Random noise
1481456Sroot 		 */
1491456Sroot 		wordc = 0;
15016460Sedward 		if (strcmp(wordv[1], "Stop.") == 0){
1511456Sroot 			language = INMAKE; return(C_SYNC);
1521456Sroot 		}
1531456Sroot 		if (strcmp(wordv[1], "Assembler:") == 0){
1541456Sroot 			/* assembler always alerts us to what happened*/
1551456Sroot 			language = INAS; return(C_SYNC);
1561456Sroot 		} else
1571456Sroot 		if (strcmp(wordv[1], "Undefined:") == 0){
1581456Sroot 			/* loader complains about unknown symbols*/
1591456Sroot 			language = INLD; return(C_SYNC);
1601456Sroot 		}
1611456Sroot 		if (lastchar(wordv[1]) == ':'){
1621456Sroot 			/* cc tells us what file we are in */
1631456Sroot 			currentfilename = wordv[1];
1645592Srrh 			(void)substitute(currentfilename, ':', '\0');
1651456Sroot 			language = INCC; return(C_SYNC);
1661456Sroot 		}
1671456Sroot 	} else
1681456Sroot 	if ( (wordc == 1) && (language == INLD) ){
1691456Sroot 		nwordv = (char **)Calloc(4, sizeof(char *));
1701456Sroot 		nwordv[0] = "ld:";
1711456Sroot 		nwordv[1] = wordv[1];
1721456Sroot 		nwordv[2] = "is";
1731456Sroot 		nwordv[3] = "undefined.";
1741456Sroot 		wordc = 4;
1751456Sroot 		wordv = nwordv - 1;
1761456Sroot 		return(C_NONSPEC);
1771456Sroot 	} else
1781456Sroot 	if (wordc == 1){
1791456Sroot 		return(C_SYNC);
1801456Sroot 	}
1811456Sroot 	return(C_UNKNOWN);
1821456Sroot }	/* end of one long */
1831456Sroot 
1841456Sroot Errorclass	cpp()
1851456Sroot {
1861456Sroot 	/*
1871456Sroot 	 *	Now attempt a cpp error message match
1881456Sroot 	 *	Examples:
1891456Sroot 	 *		./morse.h: 23: undefined control
1901456Sroot 	 *		morsesend.c: 229: MAGNIBBL: argument mismatch
1911456Sroot 	 *		morsesend.c: 237: MAGNIBBL: argument mismatch
1921456Sroot 	 *		test1.c: 6: undefined control
1931456Sroot 	 */
1941456Sroot 	if (   (language != INLD)		/* loader errors have almost same fmt*/
1951456Sroot 	    && (lastchar(wordv[1]) == ':')
1961456Sroot 	    && (isdigit(firstchar(wordv[2])))
1971456Sroot 	    && (lastchar(wordv[2]) == ':') ){
1981456Sroot 		language = INCPP;
1991456Sroot 		clob_last(wordv[1], '\0');
2001456Sroot 		clob_last(wordv[2], '\0');
2011456Sroot 		return(C_TRUE);
2021456Sroot 	}
2031456Sroot 	return(C_UNKNOWN);
2041456Sroot }	/*end of cpp*/
2051456Sroot 
2062798Swnj Errorclass pccccom()
2071456Sroot {
2081456Sroot 	/*
2091456Sroot 	 *	Now attempt a ccom error message match:
2101456Sroot 	 *	Examples:
2111456Sroot 	 *	  "morsesend.c", line 237: operands of & have incompatible types
2121456Sroot 	 *	  "test.c", line 7: warning: old-fashioned initialization: use =
2131456Sroot 	 *	  "subdir.d/foo2.h", line 1: illegal initialization
2141456Sroot 	 */
2151456Sroot 	if (   (firstchar(wordv[1]) == '"')
2161456Sroot 	    && (lastchar(wordv[1]) == ',')
2171456Sroot 	    && (next_lastchar(wordv[1]) == '"')
2181456Sroot 	    && (strcmp(wordv[2],"line") == 0)
2191456Sroot 	    && (isdigit(firstchar(wordv[3])))
2201456Sroot 	    && (lastchar(wordv[3]) == ':') ){
2211456Sroot 		clob_last(wordv[1], '\0');	/* drop last , */
2221456Sroot 		clob_last(wordv[1], '\0');	/* drop last " */
2231456Sroot 		wordv[1]++;			/* drop first " */
2241456Sroot 		clob_last(wordv[3], '\0');	/* drop : on line number */
2251456Sroot 		wordv[2] = wordv[1];	/* overwrite "line" */
2261456Sroot 		wordv++;		/*compensate*/
22716460Sedward 		wordc--;
2286610Srrh 		currentfilename = wordv[1];
2296610Srrh 		language = INCC;
2306610Srrh 		return(C_TRUE);
2311456Sroot 	}
2321456Sroot 	return(C_UNKNOWN);
2331456Sroot }	/* end of ccom */
2342798Swnj /*
2352798Swnj  *	Do the error message from the Richie C Compiler for the PDP11,
2362798Swnj  *	which has this source:
2372798Swnj  *
2382798Swnj  *	if (filename[0])
2392798Swnj  *		fprintf(stderr, "%s:", filename);
2402798Swnj  *	fprintf(stderr, "%d: ", line);
2412798Swnj  *
2422798Swnj  */
2432798Swnj Errorclass richieccom()
2442798Swnj {
2455592Srrh 	reg	char	*cp;
2465592Srrh 	reg	char	**nwordv;
2475592Srrh 		char	*file;
2485592Srrh 
2492798Swnj 	if (lastchar(wordv[1]) == ':'){
2502798Swnj 		cp = wordv[1] + strlen(wordv[1]) - 1;
2512798Swnj 		while (isdigit(*--cp))
2522798Swnj 			continue;
2532798Swnj 		if (*cp == ':'){
2542798Swnj 			clob_last(wordv[1], '\0');	/* last : */
2552798Swnj 			*cp = '\0';			/* first : */
2562798Swnj 			file = wordv[1];
2572798Swnj 			nwordv = wordvsplice(1, wordc, wordv+1);
2582798Swnj 			nwordv[0] = file;
2592798Swnj 			nwordv[1] = cp + 1;
2602798Swnj 			wordc += 1;
2612798Swnj 			wordv = nwordv - 1;
2622798Swnj 			language = INCC;
2632798Swnj 			currentfilename = wordv[1];
2642798Swnj 			return(C_TRUE);
2652798Swnj 		}
2662798Swnj 	}
2672798Swnj 	return(C_UNKNOWN);
2682798Swnj }
2691456Sroot 
2701456Sroot Errorclass lint0()
2711456Sroot {
2725592Srrh 	reg	char	**nwordv;
2735592Srrh 		char	*line, *file;
2741456Sroot 	/*
2751456Sroot 	 *	Attempt a match for the new lint style normal compiler
2761456Sroot 	 *	error messages, of the form
2771456Sroot 	 *
2781456Sroot 	 *	printf("%s(%d): %s\n", filename, linenumber, message);
2791456Sroot 	 */
2801456Sroot 	if (wordc >= 2){
2811456Sroot 		if (   (lastchar(wordv[1]) == ':')
2821456Sroot 		    && (next_lastchar(wordv[1]) == ')')
2831456Sroot 		) {
2841456Sroot 			clob_last(wordv[1], '\0'); /* colon */
2851456Sroot 			if (persperdexplode(wordv[1], &line, &file)){
2861456Sroot 				nwordv = wordvsplice(1, wordc, wordv+1);
2871456Sroot 				nwordv[0] = file;	/* file name */
2881456Sroot 				nwordv[1] = line;	/* line number */
2891456Sroot 				wordc += 1;
2901456Sroot 				wordv = nwordv - 1;
2911456Sroot 				language = INLINT;
2921456Sroot 				return(C_TRUE);
2931456Sroot 			}
2941456Sroot 			wordv[1][strlen(wordv[1])] = ':';
2951456Sroot 		}
2961456Sroot 	}
2971456Sroot 	return (C_UNKNOWN);
2981456Sroot }
2991456Sroot 
3001456Sroot Errorclass lint1()
3011456Sroot {
3021456Sroot 	char	*line1, *line2;
3031456Sroot 	char	*file1, *file2;
3041456Sroot 	char	**nwordv1, **nwordv2;
3051456Sroot 
3061456Sroot 	/*
3071456Sroot 	 *	Now, attempt a match for the various errors that lint
3081456Sroot 	 *	can complain about.
3091456Sroot 	 *
3101456Sroot 	 *	Look first for type 1 lint errors
3111456Sroot 	 */
31210829Ssam 	if (wordc > 1 && strcmp(wordv[wordc-1], "::") == 0){
3131456Sroot 	 /*
3141456Sroot   	  * %.7s, arg. %d used inconsistently %s(%d) :: %s(%d)
3151456Sroot   	  * %.7s value used inconsistently %s(%d) :: %s(%d)
3161456Sroot   	  * %.7s multiply declared %s(%d) :: %s(%d)
3171456Sroot   	  * %.7s value declared inconsistently %s(%d) :: %s(%d)
3181456Sroot   	  * %.7s function value type must be declared before use %s(%d) :: %s(%d)
3191456Sroot 	  */
3201456Sroot 		language = INLINT;
32110829Ssam 		if (wordc > 2
32210829Ssam 		     && (persperdexplode(wordv[wordc], &line2, &file2))
3231456Sroot 		     && (persperdexplode(wordv[wordc-2], &line1, &file1)) ){
3241456Sroot 			nwordv1 = wordvsplice(2, wordc, wordv+1);
3251456Sroot 			nwordv2 = wordvsplice(2, wordc, wordv+1);
3261456Sroot 			nwordv1[0] = file1; nwordv1[1] = line1;
3271456Sroot 			erroradd(wordc+2, nwordv1, C_TRUE, C_DUPL); /* takes 0 based*/
3281456Sroot 			nwordv2[0] = file2; nwordv2[1] = line2;
3291456Sroot 			wordc = wordc + 2;
3301456Sroot 			wordv = nwordv2 - 1;	/* 1 based */
3311456Sroot 			return(C_TRUE);
3321456Sroot 		}
3331456Sroot 	}
3341456Sroot 	return(C_UNKNOWN);
3351456Sroot } /* end of lint 1*/
3361456Sroot 
3371456Sroot Errorclass lint2()
3381456Sroot {
3391456Sroot 	char	*file;
3401456Sroot 	char	*line;
3411456Sroot 	char	**nwordv;
3421456Sroot 	/*
3431456Sroot 	 *	Look for type 2 lint errors
3441456Sroot 	 *
3451456Sroot 	 *	%.7s used( %s(%d) ), but not defined
3461456Sroot 	 *	%.7s defined( %s(%d) ), but never used
3471456Sroot 	 *	%.7s declared( %s(%d) ), but never used or defined
3481456Sroot 	 *
3491456Sroot 	 *	bufp defined( "./metric.h"(10) ), but never used
3501456Sroot 	 */
3511456Sroot 	if (   (lastchar(wordv[2]) == '(' /* ')' */ )
3521456Sroot 	    && (strcmp(wordv[4], "),") == 0) ){
3531456Sroot 		language = INLINT;
3541456Sroot 		if (persperdexplode(wordv[3], &line, &file)){
3551456Sroot 			nwordv = wordvsplice(2, wordc, wordv+1);
3561456Sroot 			nwordv[0] = file; nwordv[1] = line;
3571456Sroot 			wordc = wordc + 2;
3581456Sroot 			wordv = nwordv - 1;	/* 1 based */
3591456Sroot 			return(C_TRUE);
3601456Sroot 		}
3611456Sroot 	}
3621456Sroot 	return(C_UNKNOWN);
3631456Sroot } /* end of lint 2*/
3641456Sroot 
3651456Sroot char	*Lint31[4] = {"returns", "value", "which", "is"};
3661456Sroot char	*Lint32[6] = {"value", "is", "used,", "but", "none", "returned"};
3671456Sroot Errorclass lint3()
3681456Sroot {
3691456Sroot 	if (   (wordvcmp(wordv+2, 4, Lint31) == 0)
3701456Sroot 	    || (wordvcmp(wordv+2, 6, Lint32) == 0) ){
3711456Sroot 		language = INLINT;
3721456Sroot 		return(C_NONSPEC);
3731456Sroot 	}
3741456Sroot 	return(C_UNKNOWN);
3751456Sroot }
3761456Sroot 
3771456Sroot /*
3781456Sroot  *	Special word vectors for use by F77 recognition
3791456Sroot  */
3801456Sroot char	*F77_fatal[3] = {"Compiler", "error", "line"};
3811456Sroot char	*F77_error[3] = {"Error", "on", "line"};
3821456Sroot char	*F77_warning[3] = {"Warning", "on", "line"};
38317211Sralph char    *F77_no_ass[3] = {"Error.","No","assembly."};
3841456Sroot f77()
3851456Sroot {
3861456Sroot 	char	**nwordv;
3871456Sroot 	/*
3881456Sroot 	 *	look for f77 errors:
3891456Sroot 	 *	Error messages from /usr/src/cmd/f77/error.c, with
3901456Sroot 	 *	these printf formats:
3911456Sroot 	 *
3921456Sroot 	 *		Compiler error line %d of %s: %s
3931456Sroot 	 *		Error on line %d of %s: %s
3941456Sroot 	 *		Warning on line %d of %s: %s
39517211Sralph 	 *		Error.  No assembly.
3961456Sroot 	 */
39717211Sralph 	if (wordc == 3 && wordvcmp(wordv+1, 3, F77_no_ass) == 0) {
39817211Sralph 		wordc = 0;
39917211Sralph 		return(C_SYNC);
40017211Sralph 	}
4011456Sroot 	if (wordc < 6)
4021456Sroot 		return(C_UNKNOWN);
4031456Sroot 	if (	(lastchar(wordv[6]) == ':')
4041456Sroot 	    &&(
4051456Sroot 	       (wordvcmp(wordv+1, 3, F77_fatal) == 0)
4061456Sroot 	    || (wordvcmp(wordv+1, 3, F77_error) == 0)
4071456Sroot 	    || (wordvcmp(wordv+1, 3, F77_warning) == 0) )
4081456Sroot 	){
4091456Sroot 		language = INF77;
4101456Sroot 		nwordv = wordvsplice(2, wordc, wordv+1);
4111456Sroot 		nwordv[0] = wordv[6];
4121456Sroot 		clob_last(nwordv[0],'\0');
4131456Sroot 		nwordv[1] = wordv[4];
4141456Sroot 		wordc += 2;
4151456Sroot 		wordv = nwordv - 1;	/* 1 based */
4161456Sroot 		return(C_TRUE);
4171456Sroot 	}
4181456Sroot 	return(C_UNKNOWN);
4191456Sroot } /* end of f77 */
4201456Sroot 
4211456Sroot char	*Make_Croak[3] = {"***", "Error", "code"};
4221456Sroot char	*Make_NotRemade[5] = {"not", "remade", "because", "of", "errors"};
4231456Sroot Errorclass make()
4241456Sroot {
4251456Sroot 	if (wordvcmp(wordv+1, 3, Make_Croak) == 0){
4261456Sroot 		language = INMAKE;
4271456Sroot 		return(C_SYNC);
4281456Sroot 	}
4291456Sroot 	if  (wordvcmp(wordv+2, 5, Make_NotRemade) == 0){
4301456Sroot 		language = INMAKE;
4311456Sroot 		return(C_SYNC);
4321456Sroot 	}
4331456Sroot 	return(C_UNKNOWN);
4341456Sroot }
4351456Sroot Errorclass ri()
4361456Sroot {
4371456Sroot /*
4381456Sroot  *	Match an error message produced by ri; here is the
4391456Sroot  *	procedure yanked from the distributed version of ri
4401456Sroot  *	April 24, 1980.
4411456Sroot  *
4421456Sroot  *	serror(str, x1, x2, x3)
4431456Sroot  *		char str[];
4441456Sroot  *		char *x1, *x2, *x3;
4451456Sroot  *	{
4461456Sroot  *		extern int yylineno;
4471456Sroot  *
4481456Sroot  *		putc('"', stdout);
4491456Sroot  *		fputs(srcfile, stdout);
4501456Sroot  *		putc('"', stdout);
4511456Sroot  *		fprintf(stdout, " %d: ", yylineno);
4521456Sroot  *		fprintf(stdout, str, x1, x2, x3);
4531456Sroot  *		fprintf(stdout, "\n");
4541456Sroot  *		synerrs++;
4551456Sroot  *	}
4561456Sroot  */
4571456Sroot 	if (  (firstchar(wordv[1]) == '"')
4581456Sroot 	    &&(lastchar(wordv[1]) == '"')
4591456Sroot 	    &&(lastchar(wordv[2]) == ':')
4601456Sroot 	    &&(isdigit(firstchar(wordv[2]))) ){
4611456Sroot 		clob_last(wordv[1], '\0');	/* drop the last " */
4621456Sroot 		wordv[1]++;	/* skip over the first " */
4631456Sroot 		clob_last(wordv[2], '\0');
4641456Sroot 		language = INRI;
4651456Sroot 		return(C_TRUE);
4661456Sroot 	}
4671456Sroot 	return(C_UNKNOWN);
4681456Sroot }
4691456Sroot 
4701456Sroot Errorclass catchall()
4711456Sroot {
4721456Sroot 	/*
4731456Sroot 	 *	Catches random things.
4741456Sroot 	 */
4751456Sroot 	language = INUNKNOWN;
4761456Sroot 	return(C_NONSPEC);
4771456Sroot } /* end of catch all*/
47813106Srrh 
47913106Srrh Errorclass troff()
48013106Srrh {
48113106Srrh 	/*
48213106Srrh 	 *	troff source error message, from eqn, bib, tbl...
48313106Srrh 	 *	Just like pcc ccom, except uses `'
48413106Srrh 	 */
48513106Srrh 	if (   (firstchar(wordv[1]) == '`')
48613106Srrh 	    && (lastchar(wordv[1]) == ',')
48713106Srrh 	    && (next_lastchar(wordv[1]) == '\'')
48813106Srrh 	    && (strcmp(wordv[2],"line") == 0)
48913106Srrh 	    && (isdigit(firstchar(wordv[3])))
49013106Srrh 	    && (lastchar(wordv[3]) == ':') ){
49113106Srrh 		clob_last(wordv[1], '\0');	/* drop last , */
49213106Srrh 		clob_last(wordv[1], '\0');	/* drop last " */
49313106Srrh 		wordv[1]++;			/* drop first " */
49413106Srrh 		clob_last(wordv[3], '\0');	/* drop : on line number */
49513106Srrh 		wordv[2] = wordv[1];	/* overwrite "line" */
49613106Srrh 		wordv++;		/*compensate*/
49713106Srrh 		currentfilename = wordv[1];
49813106Srrh 		language = INTROFF;
49913106Srrh 		return(C_TRUE);
50013106Srrh 	}
50113106Srrh 	return(C_UNKNOWN);
50213106Srrh }
50317499Srrh Errorclass mod2()
50417499Srrh {
50517531Srrh 	/*
50617531Srrh 	 *	for decwrl modula2 compiler (powell)
50717531Srrh 	 */
50817531Srrh 	if (   (  (strcmp(wordv[1], "!!!") == 0)	/* early version */
50917531Srrh 	        ||(strcmp(wordv[1], "File") == 0))	/* later version */
51017499Srrh 	    && (lastchar(wordv[2]) == ',')	/* file name */
51117499Srrh 	    && (strcmp(wordv[3], "line") == 0)
51217499Srrh 	    && (isdigit(firstchar(wordv[4])))	/* line number */
51317499Srrh 	    && (lastchar(wordv[4]) == ':')	/* line number */
51417499Srrh 	){
51517499Srrh 		clob_last(wordv[2], '\0');	/* drop last , on file name */
51617499Srrh 		clob_last(wordv[4], '\0');	/* drop last : on line number */
51717499Srrh 		wordv[3] = wordv[2];		/* file name on top of "line" */
51817499Srrh 		wordv += 2;
51917499Srrh 		wordc -= 2;
52017499Srrh 		currentfilename = wordv[1];
52117499Srrh 		language = INMOD2;
52217499Srrh 		return(C_TRUE);
52317499Srrh 	}
52417499Srrh 	return(C_UNKNOWN);
52517499Srrh }
526