Пример #1
0
void Minitel::spiral(int x, int y, int siz, int c) {
  int curSiz = 1;
  // Center
  specialChar(x, y, c);
  x++;
  // Spiral    
  for (int i=0; i< siz; i++) {
    for (int j=0; j<curSiz; j++) {
      specialChar(x, y, c);
      y++;
    }
    curSiz++;
    for (int j=0; j<curSiz; j++) {
      specialChar(x, y, c);
      x--;
    }
    for (int j=0; j<curSiz; j++) {
      specialChar(x, y, c);
      y--;
    }
    curSiz++;   
    for (int j=0; j<curSiz; j++) {
      specialChar(x, y, c);
      x++;
    }    
  }
}
std::string XmlReader::extractIdentifier(size_t& pos)
{
  std::string ident;
  while(true)
  {
    if(pos == _xml.size())
      return ident;
    char ch = _xml[pos];
    if(specialChar(ch))
      ++pos;
    else
      break;
  }
  while(true)
  {
    char ch = _xml[pos];
    if(specialChar(ch))
      break;
    ident += ch;
    ++pos;
  }
  return ident;
}
Пример #3
0
void Minitel::specialChar(byte c, int x, int y) {
  moveCursorTo(x, y);
  specialChar(c);
}
Пример #4
0
/*
 *Name     : shapeUnicode
 *Function : Converts an Arabic Unicode buffer in 06xx Range into a shaped
 *           arabic Unicode buffer in FExx Range
 */
static int32_t
shapeUnicode(UChar *dest, int32_t sourceLength,
             int32_t destSize,uint32_t options,
             UErrorCode *pErrorCode,
             int tashkeelFlag) {

    int32_t          i, iend;
    int32_t          step;
    int32_t          lastPos,Nx, Nw;
    unsigned int     Shape;
    int32_t          flag;
    int32_t          lamalef_found = 0;
    UChar            prevLink = 0, lastLink = 0, currLink, nextLink = 0;
    UChar            wLamalef;

    /*
     * Converts the input buffer from FExx Range into 06xx Range
     * to make sure that all characters are in the 06xx range
     * even the lamalef is converted to the special region in
     * the 06xx range
     */
    for (i = 0; i < sourceLength; i++) {
        UChar inputChar = dest[i];
        if ( (inputChar >= 0xFE70) && (inputChar <= 0xFEFC)) {
            dest[i] = convertFEto06 [ (inputChar - 0xFE70) ] ;
        } else {
            dest[i] = inputChar ;
        }
    }

    /* sets the index to the end of the buffer, together with the step point to -1 */
    i = sourceLength - 1;
    iend = -1;
    step = -1;

    /*
     * This function resolves the link between the characters .
     * Arabic characters have four forms :
     * Isolated Form, Initial Form, Middle Form and Final Form
     */
    currLink = getLink(dest[i]);

    lastPos = i;
    Nx = -2, Nw = 0;

    while (i != iend) {
        /* If high byte of currLink > 0 then more than one shape */
        if ((currLink & 0xFF00) > 0 || isTashkeelChar(dest[i])) {
            Nw = i + step;
            while (Nx < 0) {         /* we need to know about next char */
                if(Nw == iend) {
                    nextLink = 0;
                    Nx = 3000;
                } else {
                    nextLink = getLink(dest[Nw]);
                    if((nextLink & IRRELEVANT) == 0) {
                        Nx = Nw;
                    } else {
                        Nw = Nw + step;
                    }
                }
            }

            if ( ((currLink & ALEFTYPE) > 0)  &&  ((lastLink & LAMTYPE) > 0) ) {
                lamalef_found = 1;
                wLamalef = changeLamAlef(dest[i]); /*get from 0x065C-0x065f */
                if ( wLamalef != 0) {
                    dest[i] = 0xFFFF;            /* The default case is to drop the Alef and replace */
                    dest[lastPos] =wLamalef;     /* it by 0xFFFF which is the last character in the  */
                    i=lastPos;                   /* unicode private use area, this is done to make   */
                }                                /* sure that removeLamAlefSpaces() handles only the */
                lastLink = prevLink;             /* spaces generated during lamalef generation.      */
                currLink = getLink(wLamalef);    /* 0xFFFF is added here and is replaced by spaces   */
            }                                    /* in removeLamAlefSpaces()                         */
            /*
             * get the proper shape according to link ability of neighbors
             * and of character; depends on the order of the shapes
             * (isolated, initial, middle, final) in the compatibility area
             */
             flag  = specialChar(dest[i]);

             Shape = shapeTable[nextLink & (LINKR + LINKL)]
                               [lastLink & (LINKR + LINKL)]
                               [currLink & (LINKR + LINKL)];

             if (flag == 1) {
                 Shape = (Shape == 1 || Shape == 3) ? 1 : 0;
             }
             else if(flag == 2) {
                 if( (lastLink & LINKL) && (nextLink & LINKR) && (tashkeelFlag == 1) &&
                      dest[i] != 0x064C && dest[i] != 0x064D )
                 {
                     Shape = 1;
                     if( (nextLink&ALEFTYPE) == ALEFTYPE && (lastLink&LAMTYPE) == LAMTYPE ) {
                         Shape = 0;
                     }
                 }
                 else {
                     Shape = 0;
                 }
             }

             if(flag == 2) {
                 dest[i] =  0xFE70 + IrrelevantPos[(dest[i] - 0x064B)] + Shape;
             }
             else
                 dest[i] = (UChar)(0xFE70 + (currLink >> 8) + Shape);
        }

        /* move one notch forward */
        if ((currLink & IRRELEVANT) == 0) {
              prevLink = lastLink;
              lastLink = currLink;
              lastPos = i;
        }

        i = i + step;
        if (i == Nx) {
            currLink = nextLink;
            Nx = -2;
        }
        else if(i != iend) {
            currLink = getLink(dest[i]);
        }
    }