xref: /csrg-svn/usr.bin/error/input.c (revision 61987)
121635Sdist /*
2*61987Sbostic  * Copyright (c) 1980, 1993
3*61987Sbostic  *	The Regents of the University of California.  All rights reserved.
434664Sbostic  *
542683Sbostic  * %sccs.include.redist.c%
621635Sdist  */
721635Sdist 
821635Sdist #ifndef lint
9*61987Sbostic static char sccsid[] = "@(#)input.c	8.1 (Berkeley) 06/06/93";
1034664Sbostic #endif /* not lint */
1121635Sdist 
121456Sroot #include <stdio.h>
131456Sroot #include <ctype.h>
1446694Sbostic #include <stdlib.h>
1546694Sbostic #include <string.h>
161456Sroot #include "error.h"
171456Sroot 
181456Sroot int	wordc;		/* how long the current error message is */
191456Sroot char	**wordv;	/* the actual error message */
201456Sroot 
211456Sroot int	nerrors;
221456Sroot int	language;
231456Sroot 
241456Sroot Errorclass	onelong();
251456Sroot Errorclass	cpp();
262798Swnj Errorclass	pccccom();	/* Portable C Compiler C Compiler */
272798Swnj Errorclass	richieccom();	/* Richie Compiler for 11 */
281456Sroot Errorclass	lint0();
291456Sroot Errorclass	lint1();
301456Sroot Errorclass	lint2();
311456Sroot Errorclass	lint3();
321456Sroot Errorclass	make();
331456Sroot Errorclass	f77();
341456Sroot Errorclass	pi();
351456Sroot Errorclass	ri();
3613106Srrh Errorclass	troff();
3717499Srrh Errorclass	mod2();
381456Sroot /*
391456Sroot  *	Eat all of the lines in the input file, attempting to categorize
401456Sroot  *	them by their various flavors
411456Sroot  */
421456Sroot static	char	inbuffer[BUFSIZ];
431456Sroot 
eaterrors(r_errorc,r_errorv)441456Sroot eaterrors(r_errorc, r_errorv)
451456Sroot 	int	*r_errorc;
465592Srrh 	Eptr	**r_errorv;
471456Sroot {
481456Sroot 	extern	boolean	piflag;
491456Sroot 	Errorclass	errorclass = C_SYNC;
501456Sroot 
511456Sroot     for (;;){
521456Sroot 	if (fgets(inbuffer, BUFSIZ, errorfile) == NULL)
531456Sroot 		break;
541456Sroot 	wordvbuild(inbuffer, &wordc, &wordv);
551456Sroot 	/*
561456Sroot 	 *	for convience, convert wordv to be 1 based, instead
571456Sroot 	 *	of 0 based.
581456Sroot 	 */
591456Sroot 	wordv -= 1;
6016460Sedward 	if ( wordc > 0 &&
6116460Sedward 	   ((( errorclass = onelong() ) != C_UNKNOWN)
621456Sroot 	   || (( errorclass = cpp() ) != C_UNKNOWN)
632798Swnj 	   || (( errorclass = pccccom() ) != C_UNKNOWN)
642798Swnj 	   || (( errorclass = richieccom() ) != C_UNKNOWN)
651456Sroot 	   || (( errorclass = lint0() ) != C_UNKNOWN)
661456Sroot 	   || (( errorclass = lint1() ) != C_UNKNOWN)
671456Sroot 	   || (( errorclass = lint2() ) != C_UNKNOWN)
681456Sroot 	   || (( errorclass = lint3() ) != C_UNKNOWN)
691456Sroot 	   || (( errorclass = make() ) != C_UNKNOWN)
701456Sroot 	   || (( errorclass = f77() ) != C_UNKNOWN)
711456Sroot 	   || ((errorclass = pi() ) != C_UNKNOWN)
721456Sroot 	   || (( errorclass = ri() )!= C_UNKNOWN)
7317499Srrh 	   || (( errorclass = mod2() )!= C_UNKNOWN)
7416460Sedward 	   || (( errorclass = troff() )!= C_UNKNOWN))
751456Sroot 	) ;
761456Sroot 	else
771456Sroot 		errorclass = catchall();
781456Sroot 	if (wordc)
791456Sroot 		erroradd(wordc, wordv+1, errorclass, C_UNKNOWN);
801456Sroot     }
811456Sroot #ifdef FULLDEBUG
821456Sroot     printf("%d errorentrys\n", nerrors);
831456Sroot #endif
841456Sroot     arrayify(r_errorc, r_errorv, er_head);
851456Sroot }
861456Sroot 
871456Sroot /*
881456Sroot  *	create a new error entry, given a zero based array and count
891456Sroot  */
erroradd(errorlength,errorv,errorclass,errorsubclass)901456Sroot erroradd(errorlength, errorv, errorclass, errorsubclass)
911456Sroot 	int		errorlength;
921456Sroot 	char		**errorv;
931456Sroot 	Errorclass	errorclass;
941456Sroot 	Errorclass	errorsubclass;
951456Sroot {
965592Srrh 	reg	Eptr	newerror;
975592Srrh 	reg	char	*cp;
981456Sroot 
991456Sroot 	if (errorclass == C_TRUE){
1001456Sroot 		/* check canonicalization of the second argument*/
1011456Sroot 		for(cp = errorv[1]; *cp && isdigit(*cp); cp++)
1021456Sroot 			continue;
1031456Sroot 		errorclass = (*cp == '\0') ? C_TRUE : C_NONSPEC;
1041456Sroot #ifdef FULLDEBUG
1051456Sroot 		if (errorclass != C_TRUE)
1061456Sroot 			printf("The 2nd word, \"%s\" is not a number.\n",
1071456Sroot 				errorv[1]);
1081456Sroot #endif
1091456Sroot 	}
1101456Sroot 	if (errorlength > 0){
1115592Srrh 		newerror = (Eptr)Calloc(1, sizeof(Edesc));
1121456Sroot 		newerror->error_language = language; /* language is global */
1131456Sroot 		newerror->error_text = errorv;
1141456Sroot 		newerror->error_lgtext = errorlength;
1151456Sroot 		if (errorclass == C_TRUE)
1161456Sroot 			newerror->error_line = atoi(errorv[1]);
1171456Sroot 		newerror->error_e_class = errorclass;
1181456Sroot 		newerror->error_s_class = errorsubclass;
1191456Sroot 		switch(newerror->error_e_class = discardit(newerror)){
1201456Sroot 			case C_SYNC:		nsyncerrors++; break;
1211456Sroot 			case C_DISCARD: 	ndiscard++; break;
1221456Sroot 			case C_NULLED:		nnulled++; break;
1231456Sroot 			case C_NONSPEC:		nnonspec++; break;
1241456Sroot 			case C_THISFILE: 	nthisfile++; break;
1251456Sroot 			case C_TRUE:		ntrue++; break;
1261456Sroot 			case C_UNKNOWN:		nunknown++; break;
1271456Sroot 			case C_IGNORE:		nignore++; break;
1281456Sroot 		}
1291456Sroot 		newerror->error_next = er_head;
1301456Sroot 		er_head = newerror;
1311456Sroot 		newerror->error_no = nerrors++;
1321456Sroot 	}	/* length > 0 */
1331456Sroot }
1341456Sroot 
onelong()1351456Sroot Errorclass onelong()
1361456Sroot {
1371456Sroot 	char	**nwordv;
1381456Sroot 	if ( (wordc == 1) && (language != INLD) ){
1391456Sroot 		/*
1401456Sroot 		 *	We have either:
1411456Sroot 		 *	a)	file name from cc
1421456Sroot 		 *	b)	Assembler telling world that it is complaining
1431456Sroot 		 *	c)	Noise from make ("Stop.")
1441456Sroot 		 *	c)	Random noise
1451456Sroot 		 */
1461456Sroot 		wordc = 0;
14716460Sedward 		if (strcmp(wordv[1], "Stop.") == 0){
1481456Sroot 			language = INMAKE; return(C_SYNC);
1491456Sroot 		}
1501456Sroot 		if (strcmp(wordv[1], "Assembler:") == 0){
1511456Sroot 			/* assembler always alerts us to what happened*/
1521456Sroot 			language = INAS; return(C_SYNC);
1531456Sroot 		} else
1541456Sroot 		if (strcmp(wordv[1], "Undefined:") == 0){
1551456Sroot 			/* loader complains about unknown symbols*/
1561456Sroot 			language = INLD; return(C_SYNC);
1571456Sroot 		}
1581456Sroot 		if (lastchar(wordv[1]) == ':'){
1591456Sroot 			/* cc tells us what file we are in */
1601456Sroot 			currentfilename = wordv[1];
1615592Srrh 			(void)substitute(currentfilename, ':', '\0');
1621456Sroot 			language = INCC; return(C_SYNC);
1631456Sroot 		}
1641456Sroot 	} else
1651456Sroot 	if ( (wordc == 1) && (language == INLD) ){
1661456Sroot 		nwordv = (char **)Calloc(4, sizeof(char *));
1671456Sroot 		nwordv[0] = "ld:";
1681456Sroot 		nwordv[1] = wordv[1];
1691456Sroot 		nwordv[2] = "is";
1701456Sroot 		nwordv[3] = "undefined.";
1711456Sroot 		wordc = 4;
1721456Sroot 		wordv = nwordv - 1;
1731456Sroot 		return(C_NONSPEC);
1741456Sroot 	} else
1751456Sroot 	if (wordc == 1){
1761456Sroot 		return(C_SYNC);
1771456Sroot 	}
1781456Sroot 	return(C_UNKNOWN);
1791456Sroot }	/* end of one long */
1801456Sroot 
cpp()1811456Sroot Errorclass	cpp()
1821456Sroot {
1831456Sroot 	/*
1841456Sroot 	 *	Now attempt a cpp error message match
1851456Sroot 	 *	Examples:
1861456Sroot 	 *		./morse.h: 23: undefined control
1871456Sroot 	 *		morsesend.c: 229: MAGNIBBL: argument mismatch
1881456Sroot 	 *		morsesend.c: 237: MAGNIBBL: argument mismatch
1891456Sroot 	 *		test1.c: 6: undefined control
1901456Sroot 	 */
1911456Sroot 	if (   (language != INLD)		/* loader errors have almost same fmt*/
1921456Sroot 	    && (lastchar(wordv[1]) == ':')
1931456Sroot 	    && (isdigit(firstchar(wordv[2])))
1941456Sroot 	    && (lastchar(wordv[2]) == ':') ){
1951456Sroot 		language = INCPP;
1961456Sroot 		clob_last(wordv[1], '\0');
1971456Sroot 		clob_last(wordv[2], '\0');
1981456Sroot 		return(C_TRUE);
1991456Sroot 	}
2001456Sroot 	return(C_UNKNOWN);
2011456Sroot }	/*end of cpp*/
2021456Sroot 
pccccom()2032798Swnj Errorclass pccccom()
2041456Sroot {
2051456Sroot 	/*
2061456Sroot 	 *	Now attempt a ccom error message match:
2071456Sroot 	 *	Examples:
2081456Sroot 	 *	  "morsesend.c", line 237: operands of & have incompatible types
2091456Sroot 	 *	  "test.c", line 7: warning: old-fashioned initialization: use =
2101456Sroot 	 *	  "subdir.d/foo2.h", line 1: illegal initialization
2111456Sroot 	 */
2121456Sroot 	if (   (firstchar(wordv[1]) == '"')
2131456Sroot 	    && (lastchar(wordv[1]) == ',')
2141456Sroot 	    && (next_lastchar(wordv[1]) == '"')
2151456Sroot 	    && (strcmp(wordv[2],"line") == 0)
2161456Sroot 	    && (isdigit(firstchar(wordv[3])))
2171456Sroot 	    && (lastchar(wordv[3]) == ':') ){
2181456Sroot 		clob_last(wordv[1], '\0');	/* drop last , */
2191456Sroot 		clob_last(wordv[1], '\0');	/* drop last " */
2201456Sroot 		wordv[1]++;			/* drop first " */
2211456Sroot 		clob_last(wordv[3], '\0');	/* drop : on line number */
2221456Sroot 		wordv[2] = wordv[1];	/* overwrite "line" */
2231456Sroot 		wordv++;		/*compensate*/
22416460Sedward 		wordc--;
2256610Srrh 		currentfilename = wordv[1];
2266610Srrh 		language = INCC;
2276610Srrh 		return(C_TRUE);
2281456Sroot 	}
2291456Sroot 	return(C_UNKNOWN);
2301456Sroot }	/* end of ccom */
2312798Swnj /*
2322798Swnj  *	Do the error message from the Richie C Compiler for the PDP11,
2332798Swnj  *	which has this source:
2342798Swnj  *
2352798Swnj  *	if (filename[0])
2362798Swnj  *		fprintf(stderr, "%s:", filename);
2372798Swnj  *	fprintf(stderr, "%d: ", line);
2382798Swnj  *
2392798Swnj  */
richieccom()2402798Swnj Errorclass richieccom()
2412798Swnj {
2425592Srrh 	reg	char	*cp;
2435592Srrh 	reg	char	**nwordv;
2445592Srrh 		char	*file;
2455592Srrh 
2462798Swnj 	if (lastchar(wordv[1]) == ':'){
2472798Swnj 		cp = wordv[1] + strlen(wordv[1]) - 1;
2482798Swnj 		while (isdigit(*--cp))
2492798Swnj 			continue;
2502798Swnj 		if (*cp == ':'){
2512798Swnj 			clob_last(wordv[1], '\0');	/* last : */
2522798Swnj 			*cp = '\0';			/* first : */
2532798Swnj 			file = wordv[1];
2542798Swnj 			nwordv = wordvsplice(1, wordc, wordv+1);
2552798Swnj 			nwordv[0] = file;
2562798Swnj 			nwordv[1] = cp + 1;
2572798Swnj 			wordc += 1;
2582798Swnj 			wordv = nwordv - 1;
2592798Swnj 			language = INCC;
2602798Swnj 			currentfilename = wordv[1];
2612798Swnj 			return(C_TRUE);
2622798Swnj 		}
2632798Swnj 	}
2642798Swnj 	return(C_UNKNOWN);
2652798Swnj }
2661456Sroot 
lint0()2671456Sroot Errorclass lint0()
2681456Sroot {
2695592Srrh 	reg	char	**nwordv;
2705592Srrh 		char	*line, *file;
2711456Sroot 	/*
2721456Sroot 	 *	Attempt a match for the new lint style normal compiler
2731456Sroot 	 *	error messages, of the form
2741456Sroot 	 *
2751456Sroot 	 *	printf("%s(%d): %s\n", filename, linenumber, message);
2761456Sroot 	 */
2771456Sroot 	if (wordc >= 2){
2781456Sroot 		if (   (lastchar(wordv[1]) == ':')
2791456Sroot 		    && (next_lastchar(wordv[1]) == ')')
2801456Sroot 		) {
2811456Sroot 			clob_last(wordv[1], '\0'); /* colon */
2821456Sroot 			if (persperdexplode(wordv[1], &line, &file)){
2831456Sroot 				nwordv = wordvsplice(1, wordc, wordv+1);
2841456Sroot 				nwordv[0] = file;	/* file name */
2851456Sroot 				nwordv[1] = line;	/* line number */
2861456Sroot 				wordc += 1;
2871456Sroot 				wordv = nwordv - 1;
2881456Sroot 				language = INLINT;
2891456Sroot 				return(C_TRUE);
2901456Sroot 			}
2911456Sroot 			wordv[1][strlen(wordv[1])] = ':';
2921456Sroot 		}
2931456Sroot 	}
2941456Sroot 	return (C_UNKNOWN);
2951456Sroot }
2961456Sroot 
lint1()2971456Sroot Errorclass lint1()
2981456Sroot {
2991456Sroot 	char	*line1, *line2;
3001456Sroot 	char	*file1, *file2;
3011456Sroot 	char	**nwordv1, **nwordv2;
3021456Sroot 
3031456Sroot 	/*
3041456Sroot 	 *	Now, attempt a match for the various errors that lint
3051456Sroot 	 *	can complain about.
3061456Sroot 	 *
3071456Sroot 	 *	Look first for type 1 lint errors
3081456Sroot 	 */
30910829Ssam 	if (wordc > 1 && strcmp(wordv[wordc-1], "::") == 0){
3101456Sroot 	 /*
3111456Sroot   	  * %.7s, arg. %d used inconsistently %s(%d) :: %s(%d)
3121456Sroot   	  * %.7s value used inconsistently %s(%d) :: %s(%d)
3131456Sroot   	  * %.7s multiply declared %s(%d) :: %s(%d)
3141456Sroot   	  * %.7s value declared inconsistently %s(%d) :: %s(%d)
3151456Sroot   	  * %.7s function value type must be declared before use %s(%d) :: %s(%d)
3161456Sroot 	  */
3171456Sroot 		language = INLINT;
31810829Ssam 		if (wordc > 2
31910829Ssam 		     && (persperdexplode(wordv[wordc], &line2, &file2))
3201456Sroot 		     && (persperdexplode(wordv[wordc-2], &line1, &file1)) ){
3211456Sroot 			nwordv1 = wordvsplice(2, wordc, wordv+1);
3221456Sroot 			nwordv2 = wordvsplice(2, wordc, wordv+1);
3231456Sroot 			nwordv1[0] = file1; nwordv1[1] = line1;
3241456Sroot 			erroradd(wordc+2, nwordv1, C_TRUE, C_DUPL); /* takes 0 based*/
3251456Sroot 			nwordv2[0] = file2; nwordv2[1] = line2;
3261456Sroot 			wordc = wordc + 2;
3271456Sroot 			wordv = nwordv2 - 1;	/* 1 based */
3281456Sroot 			return(C_TRUE);
3291456Sroot 		}
3301456Sroot 	}
3311456Sroot 	return(C_UNKNOWN);
3321456Sroot } /* end of lint 1*/
3331456Sroot 
lint2()3341456Sroot Errorclass lint2()
3351456Sroot {
3361456Sroot 	char	*file;
3371456Sroot 	char	*line;
3381456Sroot 	char	**nwordv;
3391456Sroot 	/*
3401456Sroot 	 *	Look for type 2 lint errors
3411456Sroot 	 *
3421456Sroot 	 *	%.7s used( %s(%d) ), but not defined
3431456Sroot 	 *	%.7s defined( %s(%d) ), but never used
3441456Sroot 	 *	%.7s declared( %s(%d) ), but never used or defined
3451456Sroot 	 *
3461456Sroot 	 *	bufp defined( "./metric.h"(10) ), but never used
3471456Sroot 	 */
3481456Sroot 	if (   (lastchar(wordv[2]) == '(' /* ')' */ )
3491456Sroot 	    && (strcmp(wordv[4], "),") == 0) ){
3501456Sroot 		language = INLINT;
3511456Sroot 		if (persperdexplode(wordv[3], &line, &file)){
3521456Sroot 			nwordv = wordvsplice(2, wordc, wordv+1);
3531456Sroot 			nwordv[0] = file; nwordv[1] = line;
3541456Sroot 			wordc = wordc + 2;
3551456Sroot 			wordv = nwordv - 1;	/* 1 based */
3561456Sroot 			return(C_TRUE);
3571456Sroot 		}
3581456Sroot 	}
3591456Sroot 	return(C_UNKNOWN);
3601456Sroot } /* end of lint 2*/
3611456Sroot 
3621456Sroot char	*Lint31[4] = {"returns", "value", "which", "is"};
3631456Sroot char	*Lint32[6] = {"value", "is", "used,", "but", "none", "returned"};
lint3()3641456Sroot Errorclass lint3()
3651456Sroot {
3661456Sroot 	if (   (wordvcmp(wordv+2, 4, Lint31) == 0)
3671456Sroot 	    || (wordvcmp(wordv+2, 6, Lint32) == 0) ){
3681456Sroot 		language = INLINT;
3691456Sroot 		return(C_NONSPEC);
3701456Sroot 	}
3711456Sroot 	return(C_UNKNOWN);
3721456Sroot }
3731456Sroot 
3741456Sroot /*
3751456Sroot  *	Special word vectors for use by F77 recognition
3761456Sroot  */
3771456Sroot char	*F77_fatal[3] = {"Compiler", "error", "line"};
3781456Sroot char	*F77_error[3] = {"Error", "on", "line"};
3791456Sroot char	*F77_warning[3] = {"Warning", "on", "line"};
38017211Sralph char    *F77_no_ass[3] = {"Error.","No","assembly."};
f77()3811456Sroot f77()
3821456Sroot {
3831456Sroot 	char	**nwordv;
3841456Sroot 	/*
3851456Sroot 	 *	look for f77 errors:
3861456Sroot 	 *	Error messages from /usr/src/cmd/f77/error.c, with
3871456Sroot 	 *	these printf formats:
3881456Sroot 	 *
3891456Sroot 	 *		Compiler error line %d of %s: %s
3901456Sroot 	 *		Error on line %d of %s: %s
3911456Sroot 	 *		Warning on line %d of %s: %s
39217211Sralph 	 *		Error.  No assembly.
3931456Sroot 	 */
39417211Sralph 	if (wordc == 3 && wordvcmp(wordv+1, 3, F77_no_ass) == 0) {
39517211Sralph 		wordc = 0;
39617211Sralph 		return(C_SYNC);
39717211Sralph 	}
3981456Sroot 	if (wordc < 6)
3991456Sroot 		return(C_UNKNOWN);
4001456Sroot 	if (	(lastchar(wordv[6]) == ':')
4011456Sroot 	    &&(
4021456Sroot 	       (wordvcmp(wordv+1, 3, F77_fatal) == 0)
4031456Sroot 	    || (wordvcmp(wordv+1, 3, F77_error) == 0)
4041456Sroot 	    || (wordvcmp(wordv+1, 3, F77_warning) == 0) )
4051456Sroot 	){
4061456Sroot 		language = INF77;
4071456Sroot 		nwordv = wordvsplice(2, wordc, wordv+1);
4081456Sroot 		nwordv[0] = wordv[6];
4091456Sroot 		clob_last(nwordv[0],'\0');
4101456Sroot 		nwordv[1] = wordv[4];
4111456Sroot 		wordc += 2;
4121456Sroot 		wordv = nwordv - 1;	/* 1 based */
4131456Sroot 		return(C_TRUE);
4141456Sroot 	}
4151456Sroot 	return(C_UNKNOWN);
4161456Sroot } /* end of f77 */
4171456Sroot 
4181456Sroot char	*Make_Croak[3] = {"***", "Error", "code"};
4191456Sroot char	*Make_NotRemade[5] = {"not", "remade", "because", "of", "errors"};
make()4201456Sroot Errorclass make()
4211456Sroot {
4221456Sroot 	if (wordvcmp(wordv+1, 3, Make_Croak) == 0){
4231456Sroot 		language = INMAKE;
4241456Sroot 		return(C_SYNC);
4251456Sroot 	}
4261456Sroot 	if  (wordvcmp(wordv+2, 5, Make_NotRemade) == 0){
4271456Sroot 		language = INMAKE;
4281456Sroot 		return(C_SYNC);
4291456Sroot 	}
4301456Sroot 	return(C_UNKNOWN);
4311456Sroot }
ri()4321456Sroot Errorclass ri()
4331456Sroot {
4341456Sroot /*
4351456Sroot  *	Match an error message produced by ri; here is the
4361456Sroot  *	procedure yanked from the distributed version of ri
4371456Sroot  *	April 24, 1980.
4381456Sroot  *
4391456Sroot  *	serror(str, x1, x2, x3)
4401456Sroot  *		char str[];
4411456Sroot  *		char *x1, *x2, *x3;
4421456Sroot  *	{
4431456Sroot  *		extern int yylineno;
4441456Sroot  *
4451456Sroot  *		putc('"', stdout);
4461456Sroot  *		fputs(srcfile, stdout);
4471456Sroot  *		putc('"', stdout);
4481456Sroot  *		fprintf(stdout, " %d: ", yylineno);
4491456Sroot  *		fprintf(stdout, str, x1, x2, x3);
4501456Sroot  *		fprintf(stdout, "\n");
4511456Sroot  *		synerrs++;
4521456Sroot  *	}
4531456Sroot  */
4541456Sroot 	if (  (firstchar(wordv[1]) == '"')
4551456Sroot 	    &&(lastchar(wordv[1]) == '"')
4561456Sroot 	    &&(lastchar(wordv[2]) == ':')
4571456Sroot 	    &&(isdigit(firstchar(wordv[2]))) ){
4581456Sroot 		clob_last(wordv[1], '\0');	/* drop the last " */
4591456Sroot 		wordv[1]++;	/* skip over the first " */
4601456Sroot 		clob_last(wordv[2], '\0');
4611456Sroot 		language = INRI;
4621456Sroot 		return(C_TRUE);
4631456Sroot 	}
4641456Sroot 	return(C_UNKNOWN);
4651456Sroot }
4661456Sroot 
catchall()4671456Sroot Errorclass catchall()
4681456Sroot {
4691456Sroot 	/*
4701456Sroot 	 *	Catches random things.
4711456Sroot 	 */
4721456Sroot 	language = INUNKNOWN;
4731456Sroot 	return(C_NONSPEC);
4741456Sroot } /* end of catch all*/
47513106Srrh 
troff()47613106Srrh Errorclass troff()
47713106Srrh {
47813106Srrh 	/*
47913106Srrh 	 *	troff source error message, from eqn, bib, tbl...
48013106Srrh 	 *	Just like pcc ccom, except uses `'
48113106Srrh 	 */
48213106Srrh 	if (   (firstchar(wordv[1]) == '`')
48313106Srrh 	    && (lastchar(wordv[1]) == ',')
48413106Srrh 	    && (next_lastchar(wordv[1]) == '\'')
48513106Srrh 	    && (strcmp(wordv[2],"line") == 0)
48613106Srrh 	    && (isdigit(firstchar(wordv[3])))
48713106Srrh 	    && (lastchar(wordv[3]) == ':') ){
48813106Srrh 		clob_last(wordv[1], '\0');	/* drop last , */
48913106Srrh 		clob_last(wordv[1], '\0');	/* drop last " */
49013106Srrh 		wordv[1]++;			/* drop first " */
49113106Srrh 		clob_last(wordv[3], '\0');	/* drop : on line number */
49213106Srrh 		wordv[2] = wordv[1];	/* overwrite "line" */
49313106Srrh 		wordv++;		/*compensate*/
49413106Srrh 		currentfilename = wordv[1];
49513106Srrh 		language = INTROFF;
49613106Srrh 		return(C_TRUE);
49713106Srrh 	}
49813106Srrh 	return(C_UNKNOWN);
49913106Srrh }
mod2()50017499Srrh Errorclass mod2()
50117499Srrh {
50217531Srrh 	/*
50317531Srrh 	 *	for decwrl modula2 compiler (powell)
50417531Srrh 	 */
50517531Srrh 	if (   (  (strcmp(wordv[1], "!!!") == 0)	/* early version */
50617531Srrh 	        ||(strcmp(wordv[1], "File") == 0))	/* later version */
50717499Srrh 	    && (lastchar(wordv[2]) == ',')	/* file name */
50817499Srrh 	    && (strcmp(wordv[3], "line") == 0)
50917499Srrh 	    && (isdigit(firstchar(wordv[4])))	/* line number */
51017499Srrh 	    && (lastchar(wordv[4]) == ':')	/* line number */
51117499Srrh 	){
51217499Srrh 		clob_last(wordv[2], '\0');	/* drop last , on file name */
51317499Srrh 		clob_last(wordv[4], '\0');	/* drop last : on line number */
51417499Srrh 		wordv[3] = wordv[2];		/* file name on top of "line" */
51517499Srrh 		wordv += 2;
51617499Srrh 		wordc -= 2;
51717499Srrh 		currentfilename = wordv[1];
51817499Srrh 		language = INMOD2;
51917499Srrh 		return(C_TRUE);
52017499Srrh 	}
52117499Srrh 	return(C_UNKNOWN);
52217499Srrh }
523