ECString auxify(ECString wM, ECString trmM) { char temp[128]; ECString w = toUpper(wM.c_str(),temp); ECString trm = toUpper(trmM.c_str(),temp); cerr << "AUX!!!" << endl; assert(0); if( isVerb( trm ) ) { //cout << "saw verb " << trm << " " << wM << endl; if( isAux( w ) || hasAuxSuf( w ) ) { //cout << "was aux " << w << endl; return "AUX"; } else if( isAuxg( w ) ) { //cout << "was auxg " << w << endl; return "AUXG"; } } if(trm == "BES" || trm == "HVS") //??? strange tags in switchboard { assert(w == "'S" || w == "-S"); return "AUX"; } return trmM; }
void writeClass(FILE * outc, FILE * outh, Object * tree, int indent) { ListObject *oIter; oIter = tree->definedSymbols; //fprintf(outh, "%s %s " COMPILER_SEP "%s %s;\n", "typedef", "struct", tree->name, // tree->name); fprintf(outh, "%s " COMPILER_SEP "%s {\n", "struct", tree->name); while (oIter != 0) { if (oIter->value->category == Variable) { writeDeclareClassVariable (oIter, outh, tree); } else { oIter = oIter->next; break; } oIter = oIter->next; } fprintf(outh, "};\n"); while (oIter != 0) { if (isVerb(oIter->value)) { writeFunction(outh, tree, indent, false); } else { writeTreeHelper(outc, outh, tree, indent); } } }
void writeTreeHelper(FILE * outc, FILE * outh, Object * tree, int indent) { ListObject *oIter; ListString *sIter; if (tree == 0) { warningMsg("tree was null in writeTree. (ObjectTree.c)\n"); return; } if (outc == 0 || outh == 0) { warningMsg("output file was null in writeTree. (ObjectTree.c)\n"); return; } oIter = tree->definedSymbols; sIter = tree->paramTypes; //construct and print function header if (isVerb(tree) && !getFlag(tree, FLAG_EXTERNAL)) { compilerDebugPrintf("Writing function %s\n",tree->fullname); writeFunction(outh, tree, indent, false); } else if (tree->category == Type && !getFlag(tree, FLAG_EXTERNAL)) { writeClass(outc, outh, tree, indent); } else if (tree->category == Dummy) { //Dummy } else { writeOther(outc, outh, tree, indent); } }
/* In a Constructor, Search the owning class for V, T, C Search the parent scope for T, F */ Object *searchConstructor(Object * scope, char *name, int bUseFullName) { //printf("\tSearch: Constructor\n"); Object *result = 0; ListObject *iter = scope->definedSymbols; while (iter != 0) { if (!strcmp(name, bUseFullName ? iter->value->fullname : iter->value->name)) { result = iter->value; break; } iter = iter->next; } if (!result && scope->parentClass) { result = findByNameInScope(scope->parentClass, name, bUseFullName); if (result && result->category != Variable && result->category != Type && !isVerb(result)) { //printf("\t searched %s's superclass(%s) and rejected %s\n", scope->fullname, scope->parentClass->fullname, result->fullname); result = 0; } else if (result && result->category == Variable) { char newFullName[BUFFLEN]; snprintf(newFullName, BUFFLEN, "/* %s %d */ ((%s * )(" IDENT_SELF_SELF "->obj))->%s", __FILE__, __LINE__, scope->returnType, result->fullname); //TODO: memory leak. (allocating space that will never be freed) Object *temp = CreateObject(result->name, newFullName, result->parentScope, result->category, result->returnType); result = temp; //printf("\t searched %s's superclass(%s) and found %s\n", scope->fullname, scope->parentClass->fullname, result ? result->fullname : "(null)"); } } if (!result && scope->parentScope != 0) { result = findByNameInScope(scope->parentScope, name, bUseFullName); if (result && result->category != Type && result->category != Function) { //printf("\t searched %s's parent(%s) and rejected %s\n", scope->fullname, scope->parentScope->fullname, result->fullname); result = 0; } else { //printf("\t searched %s's parent(%s) and found %s\n", scope->fullname, scope->parentScope->fullname, result ? result->fullname : "(null)"); } } //printf("\tsearched %s, returning %s\n", scope->fullname, result ? result->fullname : "(null)"); return result; }
void writeForwardDeclarations (FILE * outh, Object * tree) { ListObject *fiter; int indent = 0; fiter = tree->definedSymbols; //Do the forward declarations while (fiter) { if (isVerb(fiter->value)) { if (!getFlag(fiter->value, FLAG_EXTERNAL)) { compilerDebugPrintf("Forward decling %s\n", fiter->value->fullname); writeFunction(outh, fiter->value, indent, true); } } fiter = fiter->next; } }
bool EntryEdict::matchesWordType( const DictQuery &query ) const { if( ! query.isEmpty() ) { if( query.getMatchWordType() == DictQuery::Verb && isVerb() ) { return true; } if( query.getMatchWordType() == DictQuery::Noun && isNoun() ) { return true; } if( query.getMatchWordType() == DictQuery::Adjective && isAdjective() ) { return true; } if( query.getMatchWordType() == DictQuery::Adverb && isAdverb() ) { return true; } if( query.getMatchWordType() == DictQuery::Expression && isExpression() ) { return true; } if( query.getMatchWordType() == DictQuery::Prefix && isPrefix() ) { return true; } if( query.getMatchWordType() == DictQuery::Suffix && isSuffix() ) { return true; } if( query.getMatchWordType() == DictQuery::Any ) { return true; } } return false; }