/***   textual_error.c   ***/

#include <stdio.h>
#include <stdlib.h>
#ifndef __TURBOC__	/** standard prototypes **/
	int printf(const char*,...);
	int fprintf(const FILE*,const char*,...);
	int fscanf(const FILE*,const char*,...);
	void exit(int);
#endif

void err_text(char*);

FILE *df;

char *aux[] =
	{ "Wrong ",		/* 01 */
	  "Error \26 a",	/* 02 */
	  "\02 ",		/* 03 */
	  "Miss\26g ",		/* 04 */
	  "\04\06 \26 a",	/* 05 */
	  "unit",		/* 06 */
	  "\20 text",		/* 07 */
	  " \12er",		/* 10 */
	  " \12ation",		/* 11 */
	  "declar",		/* 12 */
	  " area is full",	/* 13 */
	  " clause",		/* 14 */
	  "mode",		/* 15 */
	  "argument",		/* 16 */
	  "\01\16 for a transput \20", /* 17 */
	  "rout\26e",		/* 20 */
	  "operator",		/* 21 */
	  "identi",		/* 22 */
	  "Inappropriate ",	/* 23 */
	  "t hand side of ",	/* 24 */
	  "name",		/* 25 */
	  "in",			/* 26 */
	  "put object",		/* 27 */
	  "loop",		/* 30 */
	  " after",		/* 31 */
	  "\22fie",		/* 32 */
	  "assign",		/* 33 */
	  " coerc",		/* 34 */
	  " wrong ",		/* 35 */
	  " 'do'"		/* 36 */};

char *text[]= {
/* 11 01*/	"\13L\26kage\13",
/* 12 02*/	"\14Work\26g\13",
/* 13 03*/	"\15Too difficult recursive \14",
/* 22 04*/	"\26\02n enclosed\14",
/* 23 05*/	"\27\03collateral\14",
/* 24 06*/	"\30\03choice\14",
/* 25 07*/	"\31\03conformity\14",
/* 26 08*/	"\32\03\30 before\36",
/* 27 09*/	"\33\03\30\31\36",
/* 31 10*/	"\37\01\25\10",
/* 32 11*/	"\40\01struct\10",
/* 33 12*/	"\41\01union\10",
/* 34 13*/	"\42\01row\10",
/* 35 14*/	"\43\01or circular \15\11",
/* 36 15*/	"\44\01plan",
/* 41 16*/	"\51\04\07 \26 a\11",
/* 42 17*/	"\52\05n \22ty\11",
/* 43 18*/	"\53\05 variable\11",
/* 44 19*/	"\54\01priority\11",
/* 45 20*/	"\55\01\21\11",
/* 46 21*/	"\56\01\15\11",
/* 47 22*/	"\57Jump out of a\10",
/* 48 23*/	"\60\04\32r\31 a\10",
/* 51 24*/	"\63'nil' can be\34ed \26to a \25 only",
/* 52 25*/	"\64You cannot dereference a \25",
/* 53 26*/	"\65Un\32d \21",
/* 54 27*/	"\66Meek \26teger is expected",
/* 55 28*/	"\67Impossible\34ion",
/* 61 29*/	"\75Un\12ed \32r; or unrecognizable \06",
/* 62 30*/	"\76\01\33ation",
/* 63 31*/	"\77\01\22ty relation",
/* 64 32*/	"\100\01slic\26g or trimm\26g",
/* 65 33*/	"\101\01display",
/* 66 34*/	"\102\01selection",
/* 67 35*/	"\103\01procedure call",
/* 68 36*/	"\104\01\07",
/* 69 37*/	"\105\04\16;\35generator; or\35'goto'",
/* 71 38*/	"\107\01parameter for a math function",
/* 72 39*/	"\110\01righ\24+=:",
/* 73 40*/	"\111\01lef\24an \33ment \21",
/* 74 41*/	"\112\01\16s to 'upb' or 'lwb'",
/* 75 42*/	"\113\01\16 for 'bits pack'",
/* 76 43*/      "\114Float\26g po\26t error",
/* 81 44*/	"\121\17",
/* 82 45*/	"\122\17",
/* 83 46*/	"\123\23\26\27",
/* 84 47*/	"\124Error dur\26g read\26g",
/* 85 48*/	"\125\23out\27"
};

#define message_number 48

void err_text(p) char *p;
{char c;
	while(c= *(p++)){
	    if(c<32){err_text(aux[c-1]);}else{printf("%c",c);};
	};
};

void main(argc,argv) int argc; char *argv[];
{int Errnum,i;
	if(argc<2){fprintf(stderr,"usage: args: %%dump\n"); exit(1);};
	df=fopen(argv[1],"r");
	if(df==NULL || fscanf(df,"%d",&Errnum)!=1)exit(0);
	Errnum=Errnum/10;
	for(i=0;i<message_number;i++){
	    if(Errnum==(0177& *text[i])){
		printf("\t"); err_text(&(text[i][1]));
		printf("\n"); exit(0);
	    };
	};
	exit(0);
};

