src/chxj_xhtml_mobile_1_0.c
/**
 * Corresponding EMOJI to a current character-code is retrieved. 
 * The substitution character string is stored in the rslt pointer if agreeing.
 *
 * @param xhtml   [i]   The pointer to the XHTML structure is specified. 
 * @param txt     [i]   The character string to want to examine whether it is 
 *                      EMOJI is specified. 
 * @param rslt    [o]   The pointer to the pointer that stores the result is 
 *                      specified. 
 * @return When corresponding EMOJI exists, it returns it excluding 0. 
 */
Corresponding EMOJI to a current character-code is retrieved.
The substitution character string is stored in the rslt pointer if agreeing.

@param xhtml   [i]   The pointer to the XHTML structure is specified.
@param txt     [i]   The character string to want to examine whether it is
EMOJI is specified.
@param rslt    [o]   The pointer to the pointer that stores the result is
specified.
@return When corresponding EMOJI exists, it returns it excluding 0.
Corresponding EMOJI to a current character - code is retrieved . The substitution character string is stored in the rslt pointer if agreeing . @param xhtml [ i ] The pointer to the XHTML structure is specified . @param txt [ i ] The character string to want to examine whether it is EMOJI is specified . @param rslt [ o ] The pointer to the pointer that stores the result is specified . @return When corresponding EMOJI exists it returns it excluding 0 .
static int
s_xhtml_search_emoji(xhtml_t *xhtml, char *txt, char **rslt)
{
  emoji_t       *ee;
  request_rec   *r;
  device_table  *spec;
  int           len;
  spec = xhtml->spec;
  len = strlen(txt);
  r = xhtml->doc->r;
  if (spec == NULL) {
    DBG(r,"spec is NULL");
  }
  for (ee = xhtml->conf->emoji;
       ee;
       ee = ee->next) {
    unsigned char hex1byte;
    unsigned char hex2byte;
    if (!ee->imode) {
      DBG(r,"emoji->imode is NULL");
      continue;
    }
    if (ee->imode->string != NULL
    &&  strlen(ee->imode->string) > 0
    &&  strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
      if (spec == NULL || spec->emoji_type == NULL) {
        *rslt = apr_psprintf(r->pool,
                        "<img localsrc=%s>",
                        ee->ezweb->typeA);
        return strlen(ee->imode->string);
      }
      if (strcasecmp(xhtml->spec->emoji_type, "a") == 0) {
        *rslt = apr_psprintf(r->pool,
                        "<img localsrc=%s>",
                        ee->ezweb->typeA);
        return strlen(ee->imode->string);
      } 
      else
      if (strcasecmp(xhtml->spec->emoji_type, "b") == 0) {
        *rslt = apr_psprintf(r->pool,
                        "<img localsrc=%s>",
                        ee->ezweb->typeB);
        return strlen(ee->imode->string);
      }
      else
      if (strcasecmp(xhtml->spec->emoji_type, "c") == 0) {
        *rslt = apr_psprintf(r->pool,
                        "<img localsrc=%s>",
                        ee->ezweb->typeC);
        return strlen(ee->imode->string);
      }
      else
      if (strcasecmp(xhtml->spec->emoji_type, "d") == 0) {
        *rslt = apr_psprintf(r->pool,
                        "<img localsrc=%s>",
                        ee->ezweb->typeD);
        return strlen(ee->imode->string);
      }
      else {
        *rslt = apr_psprintf(r->pool,
                        "<img localsrc=%s>",
                        ee->ezweb->typeA);
        return strlen(ee->imode->string);
      }
      return 0;
    }
    hex1byte = ee->imode->hex1byte & 0xff;
    hex2byte = ee->imode->hex2byte & 0xff;
    if (len >= 2
    && ((unsigned char)txt[0] & 0xff) == ((unsigned char)hex1byte)
    && ((unsigned char)txt[1] & 0xff) == ((unsigned char)hex2byte)) {
      if (spec == NULL || spec->emoji_type == NULL) {
        *rslt = apr_psprintf(r->pool,
                        "<img localsrc=\"%s\">",
                        ee->ezweb->typeA);
        return 2;
      }
      if (strcasecmp(xhtml->spec->emoji_type, "a") == 0) {
        *rslt = apr_psprintf(r->pool,
                        "<img localsrc=\"%s\">",
                        ee->ezweb->typeA);
        return 2;
      } 
      else
      if (strcasecmp(xhtml->spec->emoji_type, "b") == 0) {
        *rslt = apr_psprintf(r->pool,
                        "<img localsrc=\"%s\">",
                        ee->ezweb->typeB);
        return 2;
      }
      else
      if (strcasecmp(xhtml->spec->emoji_type, "c") == 0) {
        *rslt = apr_psprintf(r->pool,
                        "<img localsrc=\"%s\">",
                        ee->ezweb->typeC);
        return 2;
      }
      else
      if (strcasecmp(xhtml->spec->emoji_type, "d") == 0) {
        *rslt = apr_psprintf(r->pool,
                        "<img localsrc=\"%s\">",
                        ee->ezweb->typeD);
        return 2;
      }
      else {
        *rslt = apr_psprintf(r->pool,
                        "<img localsrc=\"%s\">",
                        ee->ezweb->typeD);
        return 2;
      }
      return 0;
    }
  }
  return 0;
}
static int s_xhtml_search_emoji ( xhtml_t * xhtml , char * txt , char * * rslt ) { emoji_t * ee ; request_rec * r ; device_table * spec ; int len ; spec = xhtml -> spec ; len = strlen ( txt ) ; r = xhtml -> doc -> r ; if ( spec == NULL ) { DBG ( r , " " ) ; } for ( ee = xhtml -> conf -> emoji ; ee ; ee = ee -> next ) { unsigned char hex1byte ; unsigned char hex2byte ; if ( ! ee -> imode ) { DBG ( r , " " ) ; continue ; } if ( ee -> imode -> string != NULL && strlen ( ee -> imode -> string ) > 0 && strncasecmp ( ee -> imode -> string , txt , strlen ( ee -> imode -> string ) ) == 0 ) { if ( spec == NULL || spec -> emoji_type == NULL ) { * rslt = apr_psprintf ( r -> pool , " " , ee -> ezweb -> typeA ) ; return strlen ( ee -> imode -> string ) ; } if ( strcasecmp ( xhtml -> spec -> emoji_type , " " ) == 0 ) { * rslt = apr_psprintf ( r -> pool , " " , ee -> ezweb -> typeA ) ; return strlen ( ee -> imode -> string ) ; } else if ( strcasecmp ( xhtml -> spec -> emoji_type , " " ) == 0 ) { * rslt = apr_psprintf ( r -> pool , " " , ee -> ezweb -> typeB ) ; return strlen ( ee -> imode -> string ) ; } else if ( strcasecmp ( xhtml -> spec -> emoji_type , " " ) == 0 ) { * rslt = apr_psprintf ( r -> pool , " " , ee -> ezweb -> typeC ) ; return strlen ( ee -> imode -> string ) ; } else if ( strcasecmp ( xhtml -> spec -> emoji_type , " " ) == 0 ) { * rslt = apr_psprintf ( r -> pool , " " , ee -> ezweb -> typeD ) ; return strlen ( ee -> imode -> string ) ; } else { * rslt = apr_psprintf ( r -> pool , " " , ee -> ezweb -> typeA ) ; return strlen ( ee -> imode -> string ) ; } return 0 ; } hex1byte = ee -> imode -> hex1byte & 0xff ; hex2byte = ee -> imode -> hex2byte & 0xff ; if ( len >= 2 && ( ( unsigned char ) txt [ 0 ] & 0xff ) == ( ( unsigned char ) hex1byte ) && ( ( unsigned char ) txt [ 1 ] & 0xff ) == ( ( unsigned char ) hex2byte ) ) { if ( spec == NULL || spec -> emoji_type == NULL ) { * rslt = apr_psprintf ( r -> pool , " \" \" " , ee -> ezweb -> typeA ) ; return 2 ; } if ( strcasecmp ( xhtml -> spec -> emoji_type , " " ) == 0 ) { * rslt = apr_psprintf ( r -> pool , " \" \" " , ee -> ezweb -> typeA ) ; return 2 ; } else if ( strcasecmp ( xhtml -> spec -> emoji_type , " " ) == 0 ) { * rslt = apr_psprintf ( r -> pool , " \" \" " , ee -> ezweb -> typeB ) ; return 2 ; } else if ( strcasecmp ( xhtml -> spec -> emoji_type , " " ) == 0 ) { * rslt = apr_psprintf ( r -> pool , " \" \" " , ee -> ezweb -> typeC ) ; return 2 ; } else if ( strcasecmp ( xhtml -> spec -> emoji_type , " " ) == 0 ) { * rslt = apr_psprintf ( r -> pool , " \" \" " , ee -> ezweb -> typeD ) ; return 2 ; } else { * rslt = apr_psprintf ( r -> pool , " \" \" " , ee -> ezweb -> typeD ) ; return 2 ; } return 0 ; } } return 0 ; }
Corresponding EMOJI to a current character-code is retrieved.
Corresponding EMOJI to a current character - code is retrieved .