Back to index

glibc  2.9
Classes | Functions
wcsmbsload.h File Reference
#include <locale.h>
#include <wchar.h>
#include <locale/localeinfo.h>
#include <iconv/gconv_int.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  gconv_fcts

Functions

void __wcsmbs_load_conv (struct locale_data *new_category) internal_function
void __wcsmbs_clone_conv (struct gconv_fcts *copy) internal_function
int __wcsmbs_named_conv (struct gconv_fcts *copy, const char *name) internal_function
void _nl_cleanup_ctype (struct locale_data *) internal_function attribute_hidden
struct __gconv_step__wcsmbs_getfct (const char *to, const char *from, size_t *nstepsp) attribute_hidden
static struct gconv_fctsget_gconv_fcts (struct locale_data *data)

Class Documentation

struct gconv_fcts

Definition at line 29 of file wcsmbsload.h.

Collaboration diagram for gconv_fcts:
Class Members
struct __gconv_step * tomb
size_t tomb_nsteps
struct __gconv_step * towc
size_t towc_nsteps

Function Documentation

void __wcsmbs_clone_conv ( struct gconv_fcts copy)

Definition at line 221 of file wcsmbsload.c.

{
  const struct gconv_fcts *orig;

  orig = get_gconv_fcts (_NL_CURRENT_DATA (LC_CTYPE));

  /* Copy the data.  */
  *copy = *orig;

  /* Now increment the usage counters.
     Note: This assumes copy->towc_nsteps == 1 and copy->tomb_nsteps == 1.  */
  if (copy->towc->__shlib_handle != NULL)
    ++copy->towc->__counter;
  if (copy->tomb->__shlib_handle != NULL)
    ++copy->tomb->__counter;
}

Here is the call graph for this function:

Here is the caller graph for this function:

struct __gconv_step* __wcsmbs_getfct ( const char *  to,
const char *  from,
size_t nstepsp 
) [read]

Definition at line 83 of file wcsmbsload.c.

{
  size_t nsteps;
  struct __gconv_step *result;
#if 0
  size_t nstateful;
  size_t cnt;
#endif

  if (__gconv_find_transform (to, from, &result, &nsteps, 0) != __GCONV_OK)
    /* Loading the conversion step is not possible.  */
    return NULL;

  /* Maybe it is someday necessary to allow more than one step.
     Currently this is not the case since the conversions handled here
     are from and to INTERNAL and there always is a converted for
     that.  It the directly following code is enabled the libio
     functions will have to allocate appropriate __gconv_step_data
     elements instead of only one.  */
#if 0
  /* Count the number of stateful conversions.  Since we will only
     have one 'mbstate_t' object available we can only deal with one
     stateful conversion.  */
  nstateful = 0;
  for (cnt = 0; cnt < nsteps; ++cnt)
    if (result[cnt].__stateful)
      ++nstateful;
  if (nstateful > 1)
#else
  if (nsteps > 1)
#endif
    {
      /* We cannot handle this case.  */
      __gconv_close_transform (result, nsteps);
      result = NULL;
    }
  else
    *nstepsp = nsteps;

  return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void __wcsmbs_load_conv ( struct locale_data new_category)

Here is the caller graph for this function:

int __wcsmbs_named_conv ( struct gconv_fcts copy,
const char *  name 
)

Definition at line 242 of file wcsmbsload.c.

{
  copy->towc = __wcsmbs_getfct ("INTERNAL", name, &copy->towc_nsteps);
  if (copy->towc != NULL)
    {
      copy->tomb = __wcsmbs_getfct (name, "INTERNAL", &copy->tomb_nsteps);
      if (copy->tomb == NULL)
       __gconv_close_transform (copy->towc, copy->towc_nsteps);
    }

  return copy->towc == NULL || copy->tomb == NULL ? 1 : 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void _nl_cleanup_ctype ( struct locale_data )

Definition at line 256 of file wcsmbsload.c.

{
  const struct gconv_fcts *const data = locale->private.ctype;
  if (data != NULL)
    {
      locale->private.ctype = NULL;
      locale->private.cleanup = NULL;

      /* Free the old conversions.  */
      __gconv_close_transform (data->tomb, data->tomb_nsteps);
      __gconv_close_transform (data->towc, data->towc_nsteps);
      free ((char *) data);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static struct gconv_fcts* get_gconv_fcts ( struct locale_data data) [static, read]

Definition at line 70 of file wcsmbsload.h.

{
  if (__builtin_expect (data->private.ctype == NULL, 0))
    {
      if (__builtin_expect (data == &_nl_C_LC_CTYPE, 0))
       return &__wcsmbs_gconv_fcts_c;
      __wcsmbs_load_conv (data);
    }
  return data->private.ctype;
}

Here is the call graph for this function:

Here is the caller graph for this function: