modules/portlib/src/main/native/port/shared/hynls.c File Reference


Detailed Description

Native language support.

#include "hycomp.h"
#include "hyport.h"
#include "portpriv.h"
#include "hythread.h"
#include "hynlshelpers.h"
#include "portnls.h"
#include <stdlib.h>
#include <string.h>

Functions

void VMCALL hynls_set_locale (struct HyPortLibrary *portLibrary, const char *lang, const char *region, const char *variant)
 Set the language, region, and variant of the locale.
const char *VMCALL hynls_get_language (struct HyPortLibrary *portLibrary)
 Return the string representing the currently set language.
const char *VMCALL hynls_get_region (struct HyPortLibrary *portLibrary)
 Return the string representing the currently set region.
const char *VMCALL hynls_get_variant (struct HyPortLibrary *portLibrary)
 Return the string representing the currently set variant.
void VMCALL hynls_printf (struct HyPortLibrary *portLibrary, UDATA flags, U_32 module_name, U_32 message_num,...)
 Print a formatted NLS message.
void VMCALL hynls_vprintf (struct HyPortLibrary *portLibrary, UDATA flags, U_32 module_name, U_32 message_num, va_list args)
 Print a formatted NLS message.
const char *VMCALL hynls_lookup_message (struct HyPortLibrary *portLibrary, UDATA flags, U_32 module_name, U_32 message_num, const char *default_string)
 Return the NLS string for the module name and message number.
void VMCALL hynls_set_catalog (struct HyPortLibrary *portLibrary, const char **paths, const int nPaths, const char *baseName, const char *extension)
 Setup the path to the NLS catalog.
I_32 VMCALL hynls_startup (struct HyPortLibrary *portLibrary)
 PortLibrary startup.
void VMCALL hynls_shutdown (struct HyPortLibrary *portLibrary)
 PortLibrary shutdown.


Function Documentation

const char* VMCALL hynls_get_language ( struct HyPortLibrary portLibrary  ) 

Return the string representing the currently set language.

Parameters:
[in] portLibrary The port library
Returns:
language string

const char* VMCALL hynls_get_region ( struct HyPortLibrary portLibrary  ) 

Return the string representing the currently set region.

Parameters:
[in] portLibrary The port library
Returns:
region string

const char* VMCALL hynls_get_variant ( struct HyPortLibrary portLibrary  ) 

Return the string representing the currently set variant.

Parameters:
[in] portLibrary The port library
Returns:
variant string

const char* VMCALL hynls_lookup_message ( struct HyPortLibrary portLibrary,
UDATA  flags,
U_32  module_name,
U_32  message_num,
const char *  default_string 
)

Return the NLS string for the module name and message number.

If no string is found, or a failure occurs, return the default_string.

Parameters:
[in] portLibrary The port library
[in] flags - to indicate what type of message (e.g., ERROR) and whether a newline is required
[in] module_name - the module identifier of the NLS message
[in] message_num - the NLS message number within the module
[in] default_string - a default message, in case no NLS message is found
Returns:
NLS String

void VMCALL hynls_printf ( struct HyPortLibrary portLibrary,
UDATA  flags,
U_32  module_name,
U_32  message_num,
  ... 
)

Print a formatted NLS message.

Parameters:
[in] portLibrary The port library
[in] flags - to indicate what type of message (e.g., ERROR) and whether a newline is required
[in] module_name - the module identifier of the NLS message
[in] message_num - the NLS message number within the module
[in] ... - arguments used in the NLS message format

void VMCALL hynls_set_catalog ( struct HyPortLibrary portLibrary,
const char **  paths,
const int  nPaths,
const char *  baseName,
const char *  extension 
)

Setup the path to the NLS catalog.

Parameters:
[in] portLibrary The port library
[in] paths - an array of directory paths where the NLS catalog may be found
[in] nPaths - the number of entries in the paths array
[in] baseName - the lead name of the catalog file name (i.e., the "java" in java_en_US.properties)
[in] extension - the extension of the catalog file name (i.e., the "properties in java_en_US.properties)

void VMCALL hynls_set_locale ( struct HyPortLibrary portLibrary,
const char *  lang,
const char *  region,
const char *  variant 
)

Set the language, region, and variant of the locale.

Parameters:
[in] portLibrary The port library
[in] lang - the language of the locale (e.g., "en"), 2 characters or less
[in] region - the region of the locale (e.g., "US"), 2 characters or less
[in] variant - the variant of the locale (e.g., "boont"), 31 characters or less

void VMCALL hynls_shutdown ( struct HyPortLibrary portLibrary  ) 

PortLibrary shutdown.

This function is called during shutdown of the portLibrary. Any resources that were created by hynls_startup should be destroyed here.

Parameters:
[in] portLibrary The port library

I_32 VMCALL hynls_startup ( struct HyPortLibrary portLibrary  ) 

PortLibrary startup.

This function is called during startup of the portLibrary. Any resources that are required for the NLS library operations may be created here. All resources created here should be destroyed in hynls_shutdown.

Parameters:
[in] portLibrary The port library
Returns:
0 on success, negative error code on failure. Error code values returned are
  • HYPORT_ERROR_STARTUP_NLS

void VMCALL hynls_vprintf ( struct HyPortLibrary portLibrary,
UDATA  flags,
U_32  module_name,
U_32  message_num,
va_list  args 
)

Print a formatted NLS message.

Parameters:
[in] portLibrary The port library
[in] flags - to indicate what type of message (e.g., ERROR) and whether a newline is required
[in] module_name - the module identifier of the NLS message
[in] message_num - the NLS message number within the module
[in] args - arguments used in the NLS message format


Genereated on Tue Dec 9 14:12:59 2008 by Doxygen.

(c) Copyright 2005, 2008 The Apache Software Foundation or its licensors, as applicable.