Ejemplo n.º 1
0
static void RunTest(TERM *term)
{
    int ii = 85;
    int jj = 0;

    Term_print(term, "\nzoot ");
    Term_print(term, "color");
    Term_setXY(term, 0,0);
    Term_print(term, "Hi\n");
    Term_print(term, "zoot");
    Term_setCoordPosition(term, 1,3);
    Term_print(term, "abcd");
    Term_setCurPosition(term, 5,5);
    
    Term_print(term, "Hello World!\r");
    Term_setY(term, Term_getY(term)+1);
    Term_str(term, "Decimal ");
    Term_dec(term, ii);
    Term_setY(term, Term_getY(term)+1);

    for(jj = 10; jj < 20; jj++) {
        Term_setColors(term, (jj-10));
        Term_setXY(term, jj, jj % Term_getRows(term));
        Term_str(term, "0x");
        Term_hex(term, ii++, 4);
    }
}
Ejemplo n.º 2
0
void Expression_print(Expression_t *expr) {
   if (expr->t != EXPR_TERM) printf("(");
   switch (expr->t) {
      case EXPR_CONCAT:
         Expression_print(expr->expr.binary.expr1);
         printf(" || ");
         Expression_print(expr->expr.binary.expr2);
         break;
      case EXPR_PLUS:
         Expression_print(expr->expr.binary.expr1);
         printf(" + ");
         Expression_print(expr->expr.binary.expr2);
         break;
      case EXPR_MINUS:
         Expression_print(expr->expr.binary.expr1);
         printf(" - ");
         Expression_print(expr->expr.binary.expr2);
         break;
      case EXPR_MULTIPLY:
         Expression_print(expr->expr.binary.expr1);
         printf(" * ");
         Expression_print(expr->expr.binary.expr2);
         break;
      case EXPR_DIVIDE:
         Expression_print(expr->expr.binary.expr1);
         printf(" / ");
         Expression_print(expr->expr.binary.expr2);
         break;
      case EXPR_NEG:
         printf("-");
         Expression_print(expr->expr.unary.expr);
         break;
      case EXPR_TERM:
         Term_print(expr->expr.term);
         break;
      default:
         printf("(Unknown expression type '%d')", expr->t);
   }
   if (expr->t != EXPR_TERM) printf(")");
   if (expr->alias) printf(" as %s", expr->alias);
}