rminnichmake getpid fast882507916 years agoHistory
1661 lines · 44.8 KB · C
RawDownload
#include <u.h>#include <libc.h>#include <stdio.h> #define R rand()&32767#define T 0.125#define CHOOSE(x) (x[(R)%(sizeof x / sizeof x[0])])#define EQ(a,b) (strcmp(a,b)==0)#define LAST(x) (x[strlen(x)-1])#define VOWEL(x) (x=='a'||x=='e'||x=='i'||x=='o'||x=='u')#define N 8 typedef struct xyz {	char           *type;	union {		struct xyz     *x[N];		char           *s[N];	}               list;}              *X, XX;typedef struct {	char           *number, *ending, *tense, *an, *unspec, *passive;}              *E, EE; char           *tense(), *number();char            buff[1000];int             io;int             flag;int		eqn=0, tbl=0, pic=0;double          makeup = -1.; X np(E);X aux(E);X passive(E);X passprep(void);X vp(E);X art(E);X modal(E);X perf(E);X prog(E);X verb(E);X noun(E);X nounal(E);char *prefix(void);char *root(void);int prob(double);char *tense(void);char *number(void);X getxx(void);X verbal(E);X adverb(void);X adjective(void);X adjph(E);X prep(void);X comp(E);X advp(E);X vprep(void);E getenvq(void);X comma(E);X conjadv(void);X lconjadv(void);X conjsub(void);X lconjsub(void);X conj(void);X nomz(void);X equation();X turgid(E);void pr(X);void out(char *);void caps(void);void abo(void);char *splitup(char *); X nomq(E env) {	X               v = getxx();	v->type = "-nomq";	if (EQ(env->number, "sing")) {		if (EQ(tense(), "past"))			v->list.s[0] = "there was";		else			v->list.s[0] = "there is";	} else {		if (EQ(tense(), "past"))			v->list.s[0] = "there were";		else			v->list.s[0] = "there are";	}	if (prob(0.2))		v->list.s[1] = " not";	return v;} X rel(void) {	static char    *c[] = {"that", "which"};	X               v = getxx();	v->type = "-rel";	v->list.s[0] = CHOOSE(c);	return v;} X sent(E env) {	X               sentv = getxx();	sentv->type = "sent";	if (prob(0.09)) {		env->unspec = "";		sentv->list.x[1] = np(env);		sentv->list.x[3] = aux(env);		sentv->list.x[4] = vp(env);		sentv->list.x[0] = nomq(env);		sentv->list.x[2] = rel();		return sentv;	}	sentv->list.x[0] = np(env);	sentv->list.x[1] = aux(env);	sentv->list.x[2] = vp(env);	return sentv;} X nomy(void) {	X               v = getxx();	v->type = "-nomq";	v->list.s[0] = "the fact that";	return v;} X np(env)	E               env;{	X               npv = getxx();	EE              nenv;	static EE       empty;	npv->type = "np";	if (prob(0.025)) {		nenv = empty;		npv->list.x[0] = nomy();		npv->list.x[1] = sent(&nenv);		if (env->number == 0)			env->number = "sing";		return npv;	}	npv->list.x[1] = nounal(env);	npv->list.x[0] = art(env);	return npv;} X aux(E env) {	X               auxv = getxx();	int             i = 0;	auxv->type = "aux";	if (env->tense == 0)		env->tense = env->ending = tense();	if (prob(0.25))		auxv->list.x[i++] = modal(env);	if (prob(0.25))		auxv->list.x[i++] = perf(env);	if (prob(0.25))		auxv->list.x[i++] = prog(env);	USED(i);	return auxv;} X passive(env)	E               env;{	X               v = getxx();	v->type = "-passive";	if (env->tense == 0)		env->tense = env->ending = tense();	if (env->number == 0)		env->number = number();	if (EQ(env->ending, "modal"))		v->list.s[0] = "be";	else if (EQ(env->ending, "-en"))		v->list.s[0] = "been";	else if (EQ(env->ending, "-ing"))		v->list.s[0] = "being";	else {		if (EQ(env->tense, "past"))			v->list.s[0] = EQ(env->number, "sing") ? "was" : "were";		else			v->list.s[0] = EQ(env->number, "sing") ? "is" : "are";	}	env->passive = env->ending = "pass";	return v;} X passprep(void) {	X               v = getxx();	v->type = "-passprep";	v->list.s[0] = "by";	return v;} X vp(env)	E               env;{	X               vpv = getxx();	int             i = 0;	vpv->type = "vp";	if (prob(0.5))		vpv->list.x[i++] = passive(env);	vpv->list.x[i++] = verbal(env);	vpv->list.x[i++] = comp(env);	if (prob(0.10))		vpv->list.x[i++] = advp(env);	USED(i);	return vpv;} X art(env)	E               env;{	static char    *aspecsg[] = {"the", "the", "the", "the", "the", "this", "this", "that"};	static char    *aspecpl[] = {"the", "the", "the", "the", "the", "these", "those"};	static char    *aunssg[] = {"a", "a", "a", "a", "a", "a", "a", "much", "each", "any"};	static char    *aunspl[] = {"some", "a few", "a couple", "several", "many", "all",		"no",		"an undue number of",	"a number of"};	X               artv = getxx();	artv->type = "-art";	if (env->number == 0)		env->number = number();	if (env->unspec == 0 && prob(0.33)) {		if (EQ(env->number, "sing"))			artv->list.s[0] = CHOOSE(aspecsg);		else			artv->list.s[0] = CHOOSE(aspecpl);	} else if (prob(0.50) || env->an && EQ(env->number, "sing")) {		if (EQ(env->number, "sing"))			artv->list.s[0] = env->an ? "a" : CHOOSE(aunssg);		else			artv->list.s[0] = CHOOSE(aunspl);		if (env->an && EQ(artv->list.s[0], "all"))			artv->list.s[0] = "";	} else		artv->list.s[0] = "";	env->unspec = 0;	if (env->an && EQ(env->an, "an") && EQ(artv->list.s[0], "a"))		artv->list.s[0] = "an";	env->an = 0;	return artv;} X modal(env)	E               env;{	static char    *pres[] = {"can", "may", "must", "shall", "will"};	static char    *past[] = {"could", "might", "should", "would"};	X               modalv = getxx();	modalv->type = "-modal";	if (env->tense == 0)		env->tense = env->ending = tense();	if (EQ(env->ending, "pres"))		modalv->list.s[0] = CHOOSE(pres);	else		modalv->list.s[0] = CHOOSE(past);	env->ending = "modal";	return modalv;} X perf(env)	E               env;{	X               perfv = getxx();	perfv->type = "-perf";	if (env->tense == 0)		env->tense = env->ending = tense();	if (env->number == 0)		env->number = number();	if (EQ(env->ending, "past")) {		perfv->list.s[0] = "had";	} else if (EQ(env->ending, "pres")) {		if (EQ(env->number, "sing"))			perfv->list.s[0] = "had";		else			perfv->list.s[0] = "have";	} else		perfv->list.s[0] = "have";	env->ending = "-en";	return perfv;} X prog(env)	E               env;{	X               progv = getxx();	progv->type = "-prog";	if (env->tense == 0)		env->tense = env->ending = tense();	if (env->number == 0)		env->number = number();	if (EQ(env->ending, "pres")) {		if (EQ(env->number, "sing"))			progv->list.s[0] = "is";		else			progv->list.s[0] = "are";	} else if (EQ(env->ending, "past")) {		if (EQ(env->number, "sing"))			progv->list.s[0] = "was";		else			progv->list.s[0] = "were";	} else if (EQ(env->ending, "-en")) {		progv->list.s[0] = "been";	} else if (EQ(env->ending, "modal")) {		progv->list.s[0] = "be";	}	env->ending = "-ing";	return progv;} X verb(env)	E               env;{	/* they pres, he pres, they past, they perf, they prog, they pass */	static char    *ends[][6] = {{"ate", "ates", "ated", "ated", "ating", "ated"},	{"en", "ens", "ened", "ened", "ening", "ened"},	{"esce", "esces", "esced", "esced", "escing", "esced"},	{"fy", "fies", "fied", "fied", "fying", "fied"},	{"ize", "izes", "ized", "ized", "izing", "ized"}};	X               verbv = getxx();	int             i;	verbv->type = "-verb";	if (env->tense == 0)		env->tense = env->ending = tense();	if (env->number == 0)		env->number = number();	if (0 && prob(0.1) && EQ(env->tense, env->ending)) {		if (EQ(env->number, "sing")) {			if (EQ(env->tense, "pres"))				verbv->list.s[0] = "is";			else				verbv->list.s[0] = "was";		} else {			if (EQ(env->tense, "pres"))				verbv->list.s[0] = "are";			else				verbv->list.s[0] = "were";		}	} else {		verbv->list.s[0] = prefix();		verbv->list.s[1] = root();		if (EQ(env->ending, "pres") && EQ(env->number, "sing"))			i = 1;		else if (EQ(env->ending, "pres") || EQ(env->ending, "modal"))			i = 0;		else if (EQ(env->ending, "past"))			i = 2;		else if (EQ(env->ending, "-en"))			i = 3;		else if (EQ(env->ending, "-ing"))			i = 4;		else if (EQ(env->ending, "pass"))			i = 5;		else			i = 0;		verbv->list.s[2] = ends[R % (sizeof ends / sizeof *ends)][i];	}	env->ending = 0;	return verbv;} static char    *nounlist[] = {"final completion",	"final ending", "final outcome",	"adaptation", "appearance", "argument", "circumstance",	"confession", "confidence", "delimitation", "dilution",	"dissertation", "distribution", "duplication",	"entertainment", "equipment", "evolution",	"existence", "expression", "generation", "impression",	"integration", "interaction", "investment", "judgment",	"population", "provision", "solution", "statement",	"tradition", "transmission",	"final result", "added increment", "assistance",	"beneficial assistance", "mutual cooperation",	"projection", "future projection",	"capability", "conjecture", "consensus of opinion",	"general consensus", "absence", "deficiency",	"inadequacy", "insufficience", "insufficiency",	"growing importance", "renewed emphasis",	"renewed interest", "changing behavior",	"critical thinking", "careful thinking",	"comprehensive survey", "high standard",	"basic foundation", "system testing",	"serious discussion", "serious concern",	"organizational framework", "prototype model",	"uniform nomenclature", "greater cooperation",	"uniform consistency", "early expectation",	"standardization", "great similarity",	"shortage", "presence", "sufficiency",	"consequent result", "construct", "disutility",	"early beginning", "emotional feeling", "endeavor",	"authorization", "order of magnitude", "preference",	"impact", "joint cooperation", "joint partnership",	"main essential", "methodology", "modification",	"necessary requisite", "past history", "situation",	"effectuation", "clarification", "new doubt",	"policy", "encouragement", "preparation",	"criterion", "material", "interest", "acceptance",	"rejection", "publication", "circulation",	"protection", "insurance",	"assignment", "identification",	"submission", "request",	"guidance", "correspondence", "inclusion",	"attachment", "assumption",	"recommendation", "prescription", "approval",	"discretion", "responsibility", "relevance",	"issuance", "termination", "total effect",	"deleterious effect", "consolidation",	"aggregation", "definiteness", "commencement",	"actual experience", "experience",	"combination", "accord", "filing",	"idea", "abstraction", "method", "procedure",	"complaint", "maintenance", "finance", "travel",	"purchase", "repair", "routine",	"development", "cancellation",	"partitioning", "development effort",	"project", "automation", "multilevel architecture",	"multilevel heirarchy", "data stream",	"objective",	"individual assignment", "mode of operation",	"clear community", "attendant interest",	"task division", "well defined interfacing",	"team report", "meeting time", "effective use",	"friction",	"major objective", "ownership",	"overall project time constraint",	"functional division", "requirements analysis",	"code development", "charter",	"requirements definition", "vertical division",	"broad range", "strong feeling",	"considerable latitude", "overall project constraint",	"sufficient resource", "assigned task", "expectation",	"critical aspect", "clear understanding",	"computing load", "clean interfacing", "natural basis",	"team activity", "team responsibility",	"main function", "predominant portion",	"work plan", "major breakpoint", "work module",	"achievable accuracy", "supplementary work",	"field version", "internal establishment",	"internal communication", "development progress",	"internal meeting", "experience level",	"high level autonomy", "adherence",	"feasibility demonstration", "persistent problem",	"internal objective", "idea sharing",	"improved performance", "unfamiliar methodology",	"new methodology", "development experience",	"module specification", "good progress",	"optimal number", "natural division",	"good relationship", "cross attendance",	"attendance", "necessary communication",	"evolving organization", "basic principle",	"complete revision", "general information",	"primary objective", "load-carrying capacity",	"necessary revision", "major change",	"clarified interpretation", "subsequent attempt",	"basic objective", "full utilization",	"practical consideration",	"proportionate quantity", "substantial change",	"database design", "unified framework",	"customer service", "strong interest",	"unified description", "necessary background information",	"provisioning", "physical coverage", "general observation",	"new technology", "validity determination",	"relation", "regulation", "verification",	"impediment", "portal", "practice", "premise",	"basis", "movement", "question",	"issue", "input", "output", "observation",	"input", "output", "input", "output",	"mechanization", "function", "evaluation",	"result", "further consideration", "category",	"performance indicator", "early warning",	"analysis purpose", "measurement", "replacement",	"utilitarian purpose",	"quota", "proposed enhancement", "enhancement",	"interfacing", "team organization", "module",	"guideline", "continuing study",	"required assistance", "major advance",	"proposal", "hierarchy",	"current view", "refinement", "activity",	"external description", "tight schedule pressure",	"internal conflict", "internal issue",	"reasonable compromise", "next phase",	"goal", "time constraint", "constraint",	"outcome", "important outcome",	"considerable experience", "intelligent choice",	"deliverable documentation", "discussion",	"timely delivery", "design issue", "large quantity",

Lines 1–500 of 1661.

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t