Пример #1
0
static void plisp_spih_prin(unsigned id, any x) {
    if (!isNil(x)) {
        if (isNum(x))
            outNum_spi(id, unBox(x));
        else if (isSym(x)) {
            int i, c;
            word w;
            u8 byte;

            for (x = name(x), c = getByte1(&i, &w, &x); c; c = getByte(&i, &w, &x)) {
                if (c != '^') {
                    byte = c;
                    platform_spi_send_recv(id, byte);
                }
                else if (!(c = getByte(&i, &w, &x))) {
                    byte = '^';
                    platform_spi_send_recv(id, byte);
                }
                else if (c == '?') {
                    byte = 127;
                    platform_spi_send_recv(id, byte);
                }
                else {
                    c &= 0x1F;
                    byte = (u8)c;
                    platform_spi_send_recv(id, byte);
                }
            }
        }
        else {
            while (plisp_spih_prin(id, car(x)), !isNil(x = cdr(x))) {
                if (!isCell(x)) {
                    plisp_spih_prin(id, x);
                    break;
                }
            }
        }
    }
}
Пример #2
0
static void ptermh_prin(any x) {
  if (!isNil(x)) {
    if (isNum(x))
      outNum_term(unBox(x));
    else if (isSym(x)) {
      int i, c;
      word w;
      u8 byte;
      
      for (x = name(x), c = getByte1(&i, &w, &x); c; c = getByte(&i, &w, &x)) {
        if (c != '^') {
          byte = c;
	  term_putch(byte);
	}
        else if (!(c = getByte(&i, &w, &x))) {
	  byte = '^';
          term_putch(byte);
        }
        else if (c == '?') {
          byte = 127;
	  term_putch(byte);
        }
        else {
          c &= 0x1F;
          byte = (u8)c;
	  term_putch(byte);
	}
      }
    }
    else {
      while (ptermh_prin(car(x)), !isNil(x = cdr(x))) {
	if (!isCell(x)) {
	  ptermh_prin(x);
          break;
	}
      }
    }
  }
}