void BundlePrettyPrint(Writer *writer, Bundle *bundle) { SubType *promise_type = NULL; WriterWriteF(writer, "bundle %s %s", bundle->type, bundle->name); ArgumentsPrettyPrint(writer, bundle->args); WriterWrite(writer, "\n{"); for (promise_type = bundle->subtypes; promise_type != NULL; promise_type = promise_type->next) { Promise *pp = NULL; WriterWriteF(writer, "\n%s:\n", promise_type->name); for (pp = promise_type->promiselist; pp != NULL; pp = pp->next) { Constraint *cp = NULL; char *current_class = NULL; if (current_class == NULL || strcmp(cp->classes, current_class) != 0) { current_class = cp->classes; if (strcmp(current_class, "any") != 0) { IndentPrint(writer, 1); WriterWriteF(writer, "%s::", current_class); } } IndentPrint(writer, 2); WriterWrite(writer, pp->promiser); /* FIX: add support * if (pp->promisee != NULL) { fprintf(out, " -> %s", pp->promisee); } */ for (cp = pp->conlist; cp != NULL; cp = cp->next) { WriterWriteChar(writer, '\n'); IndentPrint(writer, 1); AttributePrettyPrint(writer, cp, 3); } } if (promise_type->next != NULL) { WriterWriteChar(writer, '\n'); } } WriterWrite(writer, "\n}"); }
void BodyPrettyPrint(Writer *writer, Body *body) { Constraint *cp = NULL; char *current_class = NULL; WriterWriteF(writer, "body %s %s", body->type, body->name); ArgumentsPrettyPrint(writer, body->args); WriterWrite(writer, "\n{"); for (cp = body->conlist; cp != NULL; cp = cp->next) { if (current_class == NULL || strcmp(cp->classes, current_class) != 0) { current_class = cp->classes; if (strcmp(current_class, "any") == 0) { WriterWrite(writer, "\n"); } else { WriterWriteF(writer, "\n\n%s::", current_class); } } WriterWriteChar(writer, '\n'); IndentPrint(writer, 1); AttributePrettyPrint(writer, cp, 2); } WriterWrite(writer, "\n}"); }
PNode *Translate1(PNode *pn, PNode *pnp, Obj *max, PNode *agree_np, int srclang, int tgtlang, Discourse *dc) { PNode *r; if (pn == NULL) return(NULL); if (DbgOn(DBGSEMPAR, DBGDETAIL)) { IndentUp(); IndentPrint(Log); PNodePrint(Log, DiscourseGetInputChannel(dc), pn); } switch (pn->type) { case PNTYPE_LEXITEM: r = TranslateWord(pn, pnp, max, agree_np, srclang, tgtlang, dc); break; case PNTYPE_CONSTITUENT: r = TranslateConstituent(pn, pnp, max, agree_np, srclang, tgtlang, dc); break; case PNTYPE_POLITY: r = TranslateObjList(pn->u.polities, dc); break; case PNTYPE_MEDIA_OBJ: r = TranslateObjList(pn->u.media_obj, dc); break; case PNTYPE_PRODUCT: r = TranslateObjList(pn->u.product, dc); break; case PNTYPE_NUMBER: r = pn; /* todo */ break; /* todo: Add other types. */ default: r = pn; } if (DbgOn(DBGSEMPAR, DBGDETAIL)) { IndentPrint(Log); PNodePrint(Log, DiscourseGetInputChannel(dc), r); IndentDown(); } return(r); }