OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [newlib/] [newlib/] [libc/] [stdlib/] [mbtowc_r.c] - Diff between revs 39 and 56

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 39 Rev 56
Line 1... Line 1...
#include <stdlib.h>
#include <stdlib.h>
#include <locale.h>
#include <locale.h>
#include "mbctype.h"
#include "mbctype.h"
 
 
 
#ifdef MB_CAPABLE
typedef enum { ESCAPE, DOLLAR, BRACKET, AT, B, J,
typedef enum { ESCAPE, DOLLAR, BRACKET, AT, B, J,
               NUL, JIS_CHAR, OTHER, JIS_C_NUM } JIS_CHAR_TYPE;
               NUL, JIS_CHAR, OTHER, JIS_C_NUM } JIS_CHAR_TYPE;
typedef enum { ASCII, A_ESC, A_ESC_DL, JIS, JIS_1, JIS_2, J_ESC, J_ESC_BR,
typedef enum { ASCII, A_ESC, A_ESC_DL, JIS, JIS_1, JIS_2, J_ESC, J_ESC_BR,
               J2_ESC, J2_ESC_BR, DONE, INV, JIS_S_NUM } JIS_STATE;
               J2_ESC, J2_ESC_BR, DONE, INV, JIS_S_NUM } JIS_STATE;
typedef enum { COPY_A, COPY_J, COPY_J2, MAKE_A, MAKE_J, NOOP, EMPTY, ERROR } JIS_ACTION;
typedef enum { COPY_A, COPY_J, COPY_J2, MAKE_A, MAKE_J, NOOP, EMPTY, ERROR } JIS_ACTION;
Line 40... Line 41...
/* J_ESC */   { ERROR,   ERROR,    NOOP,     ERROR,   ERROR,   ERROR,   ERROR,   ERROR,   ERROR },
/* J_ESC */   { ERROR,   ERROR,    NOOP,     ERROR,   ERROR,   ERROR,   ERROR,   ERROR,   ERROR },
/* J_ESC_BR */{ ERROR,   ERROR,    ERROR,    ERROR,   NOOP,    NOOP,    ERROR,   ERROR,   ERROR },
/* J_ESC_BR */{ ERROR,   ERROR,    ERROR,    ERROR,   NOOP,    NOOP,    ERROR,   ERROR,   ERROR },
/* J2_ESC */  { ERROR,   ERROR,    NOOP,     ERROR,   ERROR,   ERROR,   ERROR,   ERROR,   ERROR },
/* J2_ESC */  { ERROR,   ERROR,    NOOP,     ERROR,   ERROR,   ERROR,   ERROR,   ERROR,   ERROR },
/* J2_ESC_BR*/{ ERROR,   ERROR,    ERROR,    ERROR,   COPY_J,  COPY_J,  ERROR,   ERROR,   ERROR },
/* J2_ESC_BR*/{ ERROR,   ERROR,    ERROR,    ERROR,   COPY_J,  COPY_J,  ERROR,   ERROR,   ERROR },
};
};
 
#endif /* MB_CAPABLE */
 
 
int
int
_DEFUN (_mbtowc_r, (r, pwc, s, n, state),
_DEFUN (_mbtowc_r, (r, pwc, s, n, state),
        struct _reent *r   _AND
        struct _reent *r   _AND
        wchar_t       *pwc _AND
        wchar_t       *pwc _AND
Line 59... Line 60...
    pwc = &dummy;
    pwc = &dummy;
 
 
  if (s != NULL && n == 0)
  if (s != NULL && n == 0)
    return -1;
    return -1;
 
 
 
#ifdef MB_CAPABLE
  if (r->_current_locale == NULL ||
  if (r->_current_locale == NULL ||
      (strlen (r->_current_locale) <= 1))
      (strlen (r->_current_locale) <= 1))
    { /* fall-through */ }
    { /* fall-through */ }
  else if (!strcmp (r->_current_locale, "C-SJIS"))
  else if (!strcmp (r->_current_locale, "C-SJIS"))
    {
    {
Line 186... Line 188...
 
 
        }
        }
 
 
      return -1;  /* n < bytes needed */
      return -1;  /* n < bytes needed */
    }
    }
 
#endif /* MB_CAPABLE */               
 
 
  /* otherwise this must be the "C" locale or unknown locale */
  /* otherwise this must be the "C" locale or unknown locale */
  if (s == NULL)
  if (s == NULL)
    return 0;  /* not state-dependent */
    return 0;  /* not state-dependent */
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.