generated html version of pronounceable_cee.cHOME

#include "stdio.h"
#include "stdlib.h"
#define ei else if

int afterword = 0;
int capital = 0;

int symtabcmp(char **a,char**b){
	return strcmp(a[0],b[0]);
}

char* wordspacetable[][1] = {
	{"char"},{"short"},{"int"},{"long"},{"signed"},{"unsigned"},{"float"},{"double"},{"bool"},
	{"const"},{"auto"},{"static"},{"extern"},{"volatile"},{"register"},{"typedef"},
	{"struct"},{"union"},{"enum"},
	{"include"},{"define"},{"undef"},
	{"else"},{"goto"},{"case"},{"return"},
};

char* symboltable[][2] = {
	{"space"," "},
	{"newline","\n"},
	{"tab","\t"},
	{"exclamation","!"},{"bang","!"},{"not","!"},
	{"at","@"},
	{"hash","#"},{"pound","#"},{"sharp","#"},
	{"dollar","$"},
	{"percent","%"},{"modulo","%"},
	{"caret","^"},{"xor","^"},
	{"and","&"},{"ampersand","&"},
	{"star","*"},{"times","*"},{"asterisk","*"},
	{"paren","("},
	{"unparen",")"},
	{"minus","-"},
	{"plus","+"},
	{"underscore","_"},
	{"equals","="},{"equal","="},
	{"zero","0"},
	{"one","1"},
	{"two","2"},
	{"three","3"},
	{"four","4"},
	{"five","5"},
	{"six","6"},
	{"seven","7"},
	{"eight","8"},
	{"nine","9"},
	{"ten","10"},
	{"eleven","11"},
	{"twelve","12"},
	{"thirteen","13"},
	{"fourteen","14"},
	{"fifteen","15"},
	{"sixteen","16"},
	{"seventeen","17"},
	{"eighteen","18"},
	{"nineteen","19"},
	{"twenty","20"},
	{"backtick","`"},
	{"acute","`"},
	{"tilde","~"},
	{"bracket","["},
	{"unbracket","]"},
	{"curly","{"},
	{"uncurly","}"},
	{"backslash","\\"},
	{"or","|"},{"bar","|"},
	{"colon",":"},
	{"semicolon",";"},
	{"apostrophe","'"},
	{"quote","\""},{"unquote","\""},
	{"angle","<"},{"less","<"},
	{"unangle",">"},{"greater",">"},
	{"comma",","},
	{"period","."},{"dot","."},
	{"question","?"},
	{"slash","/"},{"divide","/"}
};

void doword(char *word){
	if(!*word)return;
	if(afterword == 1){
		printf("%s",word);
		afterword = 0;
		return;
	}
	if(capital == 1){
		int i,l=strlen(word);
		for(i=0;i<l;i++)word[i]=toupper(word[i]);
		printf("%s",word);
		capital = 0;
		return;
	}
	char **match;
	if(!strcmp(word,"word")){
		afterword = 1;
	}ei(!strcmp(word,"capital")){
		capital = 1;
	/* symbols */
	}ei(match = bsearch(&word,symboltable,sizeof symboltable / sizeof symboltable[0],sizeof symboltable[0],symtabcmp)){
		printf("%s",match[1]);
	}ei(match = bsearch(&word,wordspacetable,sizeof wordspacetable / sizeof wordspacetable[0],sizeof wordspacetable[0],symtabcmp)){
		printf("%s ",match[0]);
	}else printf("%s",word);
}



int main () {
	int line = 1;
	char word[200];
	int wordi = 0;
	int c;
	int haswarnedcaps = 0;
	int haswarnedsym = 0;
	qsort(symboltable,sizeof symboltable / sizeof symboltable[0],sizeof symboltable[0],symtabcmp);
	qsort(wordspacetable,sizeof wordspacetable / sizeof wordspacetable[0],sizeof wordspacetable[0],symtabcmp);
	/*for (c=0;c < sizeof symboltable / sizeof symboltable[0];c++){
		printf("%s\n",symboltable[c][0]);
	} return 0;*/
	while(EOF != (c = getchar())){
		if(c >= 'a' && c <= 'z'){
			word[wordi++]=c;
		}else if(c >= 'A' && c <= 'Z'){
			if(!haswarnedcaps){
				fprintf(stderr,"line %d has a capital letter will be treated the same as lowercase warning only issued once\n",line);
				haswarnedcaps = 1;
			}
			word[wordi++]=c+'a'-'A';
		}else if(c == ' ' || c == '\t' || c == '\n' || c == '\r'){
			word[wordi]=0;
			doword(word);
			wordi=0;
			if(c=='\n')line++;
		}else{
			if(!haswarnedsym){
				fprintf(stderr,"line %d has a symbol, will be ignored, warning only issued once",line);
				haswarnedsym = 1;
			}
		}
	}
}