pike.git / src / modules / Gettext / gettext.c

version» Context lines:

pike.git/src/modules/Gettext/gettext.c:1:   /*   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information.   */    - #include "global.h" + #include "module.h"   #include "config.h" -  + #include "module_support.h"      #ifdef HAVE_GETTEXT      #ifdef HAVE_LIBINTL_H   #include <libintl.h>   #endif - #ifdef HAVE_LOCALE_H +    #include <locale.h> - #endif +     - #include "stralloc.h" +    #include "pike_error.h"   #include "pike_macros.h"   #include "constants.h"   #include "interpret.h" - #include "svalue.h" - #include "mapping.h" - #include "module_support.h" +          #define sp Pike_sp      /*! @module Locale    */      /*! @module Gettext    *!    *! This module enables access to localization functions from within Pike.
pike.git/src/modules/Gettext/gettext.c:57:    *! Defaults to the current domain.    *!    *! @param category    *! Category from which the translation should be taken.    *! Defaults to @[Locale.Gettext.LC_MESSAGES].    *!    *! Return a translated version of @[msg] within the context    *! of the specified @[domain] and current locale. If there is no    *! translation available, @[msg] is returned.    *! -  *! @note -  *! Prior to Pike 7.3 this function only accepted one argument, -  *! and the other functionality was provided by @[dgettext()] -  *! and @[dcgettext()]. -  *! +     *! @seealso    *! @[bindtextdomain], @[textdomain], @[setlocale], @[localeconv]    */   void f_gettext(INT32 args)   {    const char *domain = NULL, *msg;    int cat = 0;    -  get_all_args("Locale.Gettext.gettext", args, "%c.%C%D", &msg, &domain, &cat); +  get_all_args(NULL, args, "%c.%C%D", &msg, &domain, &cat);       if (domain) {    if (args > 2 && SUBTYPEOF(Pike_sp[2-args]) == NUMBER_NUMBER)    push_text(dcgettext(domain, msg, cat));    else    push_text(dgettext(domain, msg));    }    else    push_text(gettext(msg));   
pike.git/src/modules/Gettext/gettext.c:99:    *!    *! @note    *! Obsoleted by @[gettext()] in Pike 7.3.    *!    *! @seealso    *! @[bindtextdomain], @[textdomain], @[gettext], @[setlocale], @[localeconv]   */   void f_dgettext(INT32 args)   {    const char *domain, *msg; -  get_all_args("Locale.Gettext.dgettext", args, "%c%c", &domain, &msg); +  get_all_args(NULL, args, "%c%c", &domain, &msg);       push_text(dgettext(domain, msg));       stack_pop_n_elems_keep_top(args);   }      /*! @decl string dcgettext(string domain, string msg, int category)    *!    *! Return a translated version of @[msg] within the context of the    *! specified @[domain] and current locale for the specified
pike.git/src/modules/Gettext/gettext.c:126:    *! Obsoleted by @[gettext()] in Pike 7.3.    *!    *! @seealso    *! @[bindtextdomain], @[textdomain], @[gettext], @[setlocale], @[localeconv]    */   void f_dcgettext(INT32 args)   {    const char *domain, *msg;    int category;    -  get_all_args("Locale.Gettext.dcgettext", args, "%c%c%d", -  &domain, &msg, &category); +  get_all_args(NULL, args, "%c%c%d", &domain, &msg, &category);       push_text(dcgettext(domain, msg, category));       stack_pop_n_elems_keep_top(args);   }      /*! @decl string textdomain(void|string domain)    *!    *! The textdomain() function sets or queries the name of the    *! current domain of the active @[LC_MESSAGES] locale category. The
pike.git/src/modules/Gettext/gettext.c:164:    *! domainname is void, the name of the default domain is    *! returned.    *!    *! @seealso    *! @[bindtextdomain], @[gettext], @[setlocale], @[localeconv]    */   void f_textdomain(INT32 args)   {    const char *domain = NULL;    char *returnstring; -  get_all_args ("Locale.Gettext.textdomain", args, ".%C", &domain); +  get_all_args (NULL, args, ".%C", &domain);    returnstring = textdomain(domain);    pop_n_elems(args);    push_text(returnstring);   }      /*! @decl string bindtextdomain(string|void domainname, string|void dirname)    *!    *! Binds the path predicate for a message @[domainname] domainname to    *! the directory name specified by @[dirname].    *!
pike.git/src/modules/Gettext/gettext.c:205:    *! path is returned. If @[domainname] is unspecified or is an empty string,    *! @[bindtextdomain()] takes no action and returns a 0.    *!    *! @seealso    *! @[textdomain], @[gettext], @[setlocale], @[localeconv]    */   void f_bindtextdomain(INT32 args)   {    char *returnstring;    const char *domain = NULL, *dirname = NULL; -  get_all_args ("Locale.Gettext.bindtextdomain", args, -  ".%C%C", &domain, &dirname); +  get_all_args (NULL, args, ".%C%C", &domain, &dirname);       if (!domain || !*domain)    returnstring = NULL;    else {   #ifdef BINDTEXTDOMAIN_HANDLES_NULL    returnstring = bindtextdomain (domain, dirname);   #else    if (dirname)    returnstring = bindtextdomain (domain, dirname);    else
pike.git/src/modules/Gettext/gettext.c:255:    *! Returns 1 if the locale setting successed, 0 for failure    *!    *! @seealso    *! @[bindtextdomain], @[textdomain], @[gettext], @[dgettext], @[dcgettext], @[localeconv]    */   void f_setlocale(INT32 args)   {    char *returnstring;    const char *locale;    int category; -  get_all_args("Locale.Gettext.setlocale", args, "%d%c", &category, &locale); +  get_all_args(NULL, args, "%d%c", &category, &locale);       returnstring = setlocale(category, locale);    pop_n_elems(args);    if(returnstring == NULL)    push_int(0);    else    push_int(1);   }      /*! @decl mapping localeconv()
pike.git/src/modules/Gettext/gettext.c:376:    *! @[bindtextdomain], @[textdomain], @[gettext], @[dgettext], @[dcgettext], @[setlocale]    */   void f_localeconv(INT32 args)   {    struct lconv *locale; /* Information about the current locale */    struct svalue *save_sp = Pike_sp;       locale = localeconv();      #define MAPSTR(key) do { \ -  push_constant_text(TOSTR(key)); \ +  push_text(TOSTR(key)); \    push_text(locale->key); \    } while(0)   #define MAPINT(key) do { \ -  push_constant_text(TOSTR(key)); \ +  push_text(TOSTR(key)); \    push_int(locale->key); \    } while(0)       MAPSTR(decimal_point);    MAPSTR(thousands_sep);    MAPSTR(int_curr_symbol);    MAPSTR(currency_symbol);    MAPSTR(mon_decimal_point);    MAPSTR(mon_thousands_sep);    MAPSTR(positive_sign);
pike.git/src/modules/Gettext/gettext.c:498:    add_integer_constant("LC_NUMERIC", LC_NUMERIC, 0);    add_integer_constant("LC_TIME", LC_TIME, 0);   }      PIKE_MODULE_EXIT   {      }   #else    - #include "module.h" - #include "module_support.h" +    #include "program.h"      PIKE_MODULE_INIT { -  if(!TEST_COMPAT(7,6)) +     HIDE_MODULE();   }      PIKE_MODULE_EXIT {}      #endif