[PHP-DEV] CVS update: php3/functions From: martin (php-dev <email protected>)
Date: 10/06/98

Date: Tuesday October 6, 1998 @ 5:47
Author: martin

Update of /repository/php3/functions
In directory asf:/u2/tmp/cvs-serv21187/functions

Modified Files:
        gdttf.c
Log Message:
EBCDIC changes to make FreeType fonts work
Index: php3/functions/gdttf.c
diff -c php3/functions/gdttf.c:1.14 php3/functions/gdttf.c:1.15
*** php3/functions/gdttf.c:1.14 Sun Sep 13 00:58:03 1998
--- php3/functions/gdttf.c Tue Oct 6 05:47:08 1998
***************
*** 231,236 ****
--- 231,242 ----
   *---------------------------------------------------------------------------
   */
   
+ #ifndef CHARSET_EBCDIC
+ #define ASC(ch) (ch)
+ #else /*CHARSET_EBCDIC*/
+ #define ASC(ch) os_toascii[(unsigned char) (ch)]
+ #endif /*CHARSET_EBCDIC*/
+
  #define Tcl_UniChar int
  #define TCL_UTF_MAX 3
  static int
***************
*** 266,272 ****
       * Unroll 1 to 3 byte UTF-8 sequences, use loop to handle longer ones.
       */
  
! byte = *((unsigned char *) str);
      if (byte < 0xC0) {
          /*
           * Handles properly formed UTF-8 characters between 0x01 and 0x7F.
--- 272,278 ----
       * Unroll 1 to 3 byte UTF-8 sequences, use loop to handle longer ones.
       */
  
! byte = ASC(*((unsigned char *) str));
      if (byte < 0xC0) {
          /*
           * Handles properly formed UTF-8 characters between 0x01 and 0x7F.
***************
*** 277,288 ****
          *chPtr = (Tcl_UniChar) byte;
          return 1;
      } else if (byte < 0xE0) {
! if ((str[1] & 0xC0) == 0x80) {
              /*
               * Two-byte-character lead-byte followed by a trail-byte.
               */
               
! *chPtr = (Tcl_UniChar) (((byte & 0x1F) << 6) | (str[1] & 0x3F));
              return 2;
          }
          /*
--- 283,294 ----
          *chPtr = (Tcl_UniChar) byte;
          return 1;
      } else if (byte < 0xE0) {
! if ((ASC(str[1]) & 0xC0) == 0x80) {
              /*
               * Two-byte-character lead-byte followed by a trail-byte.
               */
               
! *chPtr = (Tcl_UniChar) (((byte & 0x1F) << 6) | (ASC(str[1]) & 0x3F));
              return 2;
          }
          /*
***************
*** 293,305 ****
          *chPtr = (Tcl_UniChar) byte;
          return 1;
      } else if (byte < 0xF0) {
! if (((str[1] & 0xC0) == 0x80) && ((str[2] & 0xC0) == 0x80)) {
              /*
               * Three-byte-character lead byte followed by two trail bytes.
               */
  
              *chPtr = (Tcl_UniChar) (((byte & 0x0F) << 12)
! | ((str[1] & 0x3F) << 6) | (str[2] & 0x3F));
              return 3;
          }
          /*
--- 299,311 ----
          *chPtr = (Tcl_UniChar) byte;
          return 1;
      } else if (byte < 0xF0) {
! if (((ASC(str[1]) & 0xC0) == 0x80) && ((ASC(str[2]) & 0xC0) == 0x80)) {
              /*
               * Three-byte-character lead byte followed by two trail bytes.
               */
  
              *chPtr = (Tcl_UniChar) (((byte & 0x0F) << 12)
! | ((ASC(str[1]) & 0x3F) << 6) | (ASC(str[2]) & 0x3F));
              return 3;
          }
          /*
***************
*** 320,331 ****
              ch = byte & (0x3F >> trail);
              do {
                  str++;
! if ((*str & 0xC0) != 0x80) {
                      *chPtr = byte;
                      return 1;
                  }
                  ch <<= 6;
! ch |= (*str & 0x3F);
                  trail--;
              } while (trail > 0);
              *chPtr = ch;
--- 326,337 ----
              ch = byte & (0x3F >> trail);
              do {
                  str++;
! if ((ASC(*str) & 0xC0) != 0x80) {
                      *chPtr = byte;
                      return 1;
                  }
                  ch <<= 6;
! ch |= (ASC(*str) & 0x3F);
                  trail--;
              } while (trail > 0);
              *chPtr = ch;

--
PHP Development Mailing List   http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe <email protected>
For help: php-dev-help <email protected>