Exemplo n.º 1
0
static int
readCharacters_ScreenScreen (const ScreenBox *box, ScreenCharacter *buffer) {
  ScreenDescription description;                 /* screen statistics */
  describe_ScreenScreen(&description);
  if (validateScreenBox(box, description.cols, description.rows)) {
    ScreenCharacter *character = buffer;
    unsigned char *text = shmAddress + 4 + (box->top * description.cols) + box->left;
    unsigned char *attributes = text + (description.cols * description.rows);
    size_t increment = description.cols - box->width;
    int row;
    for (row=0; row<box->height; row++) {
      int column;
      for (column=0; column<box->width; column++) {
        wint_t wc = convertCharToWchar(*text++);
        if (wc == WEOF) wc = L'?';
        character->text = wc;
        character->attributes = *attributes++;
        character++;
      }
      text += increment;
      attributes += increment;
    }
    return 1;
  }
  return 0;
}
Exemplo n.º 2
0
static int
readCharacters_AtSpiScreen (const ScreenBox *box, ScreenCharacter *buffer) {
  long x,y;
  clearScreenCharacters(buffer,box->height*box->width);
  pthread_mutex_lock(&updateMutex);
  if (!curTerm) {
    setScreenMessage(box, buffer, nonatspi);
    goto out;
  }
  if (!curNumRows) {
    goto out;
  }
  if (!validateScreenBox(box, curNumCols, curNumRows)) {
    goto out;
  }
  for (y=0; y<box->height; y++) {
    if (curRowLengths[box->top+y]) {
      for (x=0; x<box->width; x++) {
        if (box->left+x<curRowLengths[box->top+y] - (curRows[box->top+y][curRowLengths[box->top+y]-1]=='\n')) {
          buffer[y*box->width+x].text = curRows[box->top+y][box->left+x];
        }
      }
    }
  }
out:
  pthread_mutex_unlock(&updateMutex);
  return 1;
}
Exemplo n.º 3
0
static int
readCharacters_HelpScreen (const ScreenBox *box, ScreenCharacter *buffer) {
  const HelpPageEntry *page = getPage();

  if (page) {
    if (validateScreenBox(box, page->lineLength, page->lineCount)) {
      ScreenCharacter *character = buffer;
      int row;

      for (row=0; row<box->height; row+=1) {
        const HelpLineEntry *line = &page->lineTable[box->top + row];
        int column;

        for (column=0; column<box->width; column+=1) {
          int index = box->left + column;

          if (index < line->length) {
            character->text = line->characters[index];
          } else {
            character->text = WC_C(' ');
          }

          character->attributes = SCR_COLOUR_DEFAULT;
          character += 1;
        }
      }

      return 1;
    }
  }

  return 0;
}
Exemplo n.º 4
0
static int
readCharacters_NoScreen (const ScreenBox *box, ScreenCharacter *buffer) {
  ScreenDescription description;
  describe_NoScreen(&description);
  if (!validateScreenBox(box, description.cols, description.rows)) return 0;
  setScreenMessage(box, buffer, screenMessage);
  return 1;
}
Exemplo n.º 5
0
static int
readCharacters_FrozenScreen (const ScreenBox *box, ScreenCharacter *buffer) {
  if (validateScreenBox(box, screenDescription.cols, screenDescription.rows)) {
    int row;
    for (row=0; row<box->height; row++) {
      memcpy(&buffer[row * box->width],
             &screenCharacters[((box->top + row) * screenDescription.cols) + box->left],
             box->width * sizeof(*screenCharacters));
    }
    return 1;
  }
  return 0;
}
Exemplo n.º 6
0
static int
readCharacters_PcBiosScreen (const ScreenBox *box, ScreenCharacter *buffer) {
  unsigned offset = ScreenPrimary;
  ScreenDescription description;
  int row, col;
  describe_PcBiosScreen(&description);
  if (!validateScreenBox(box, description.cols, description.rows)) return 0;
  _farsetsel(_go32_conventional_mem_selector());
  for (row=box->top; row<box->top+box->height; ++row)
    for (col=box->left; col<box->left+box->width; ++col) {
      buffer->text = _farnspeekb(offset + row*description.cols*2 + col*2);
      buffer->attributes = _farnspeekb(offset + row*description.cols*2 + col*2 + 1);
      buffer++;
    }
  return 1;
}