Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added binding, no package

  • Loading branch information...
commit a9d08b588db7a6e95121a74463a67a31dc263f4e 1 parent 50211bd
@krzysz00 authored
Showing with 397 additions and 0 deletions.
  1. +1 −0  README
  2. +137 −0 gettext-cffi.isp
  3. +137 −0 gettext-cffi.lisp
  4. +122 −0 gettext.i
View
1  README
@@ -0,0 +1 @@
+cl-gettext is a Common Lisp binding to GNU gettext.
View
137 gettext-cffi.isp
@@ -0,0 +1,137 @@
+;;; This file was automatically generated by SWIG (http://www.swig.org).
+;;; Version 1.3.40
+;;;
+;;; Do not make changes to this file unless you know what you are doing--modify
+;;; the SWIG interface file instead.
+
+
+;;;SWIG wrapper code starts here
+
+(cl:defmacro defanonenum (&body enums)
+ "Converts anonymous enums to defconstants."
+ `(cl:progn ,@(cl:loop for value in enums
+ for index = 0 then (cl:1+ index)
+ when (cl:listp value) do (cl:setf index (cl:second value)
+ value (cl:first value))
+ collect `(cl:defconstant ,value ,index))))
+
+(cl:eval-when (:compile-toplevel :load-toplevel)
+ (cl:unless (cl:fboundp 'swig-lispify)
+ (cl:defun swig-lispify (name flag cl:&optional (package cl:*package*))
+ (cl:labels ((helper (lst last rest cl:&aux (c (cl:car lst)))
+ (cl:cond
+ ((cl:null lst)
+ rest)
+ ((cl:upper-case-p c)
+ (helper (cl:cdr lst) 'upper
+ (cl:case last
+ ((lower digit) (cl:list* c #\- rest))
+ (cl:t (cl:cons c rest)))))
+ ((cl:lower-case-p c)
+ (helper (cl:cdr lst) 'lower (cl:cons (cl:char-upcase c) rest)))
+ ((cl:digit-char-p c)
+ (helper (cl:cdr lst) 'digit
+ (cl:case last
+ ((upper lower) (cl:list* c #\- rest))
+ (cl:t (cl:cons c rest)))))
+ ((cl:char-equal c #\_)
+ (helper (cl:cdr lst) '_ (cl:cons #\- rest)))
+ (cl:t
+ (cl:error "Invalid character: ~A" c)))))
+ (cl:let ((fix (cl:case flag
+ ((constant enumvalue) "+")
+ (variable "*")
+ (cl:t ""))))
+ (cl:intern
+ (cl:concatenate
+ 'cl:string
+ fix
+ (cl:nreverse (helper (cl:concatenate 'cl:list name) cl:nil cl:nil))
+ fix)
+ package))))))
+
+;;;SWIG wrapper code ends here
+
+
+(cffi:defcfun ("gettext" gettext) :string
+ (__msgid :string))
+
+(cffi:defcfun ("dgettext" dgettext) :string
+ (__domainname :string)
+ (__msgid :string))
+
+(cffi:defcfun ("dcgettext" dcgettext) :string
+ (__domainname :string)
+ (__msgid :string)
+ (__category :int))
+
+(cffi:defcfun ("ngettext" ngettext) :string
+ (__msgid1 :string)
+ (__msgid2 :string)
+ (__n :unsigned-long))
+
+(cffi:defcfun ("dngettext" dngettext) :string
+ (__domainname :string)
+ (__msgid1 :string)
+ (__msgid2 :string)
+ (__n :unsigned-long))
+
+(cffi:defcfun ("textdomain" textdomain) :string
+ (__domainname :string))
+
+(cffi:defcfun ("bindtextdomain" bindtextdomain) :string
+ (__domainname :string)
+ (__dirname :string))
+
+(cffi:defcfun ("bind_textdomain_codeset" bind_textdomain_codeset) :string
+ (__domainname :string)
+ (__codeset :string))
+
+(defanonenum
+ (__LC_CTYPE #.0)
+ (__LC_NUMERIC #.1)
+ (__LC_TIME #.2)
+ (__LC_COLLATE #.3)
+ (__LC_MONETARY #.4)
+ (__LC_MESSAGES #.5)
+ (__LC_ALL #.6)
+ (__LC_PAPER #.7)
+ (__LC_NAME #.8)
+ (__LC_ADDRESS #.9)
+ (__LC_TELEPHONE #.10)
+ (__LC_MEASUREMENT #.11)
+ (__LC_IDENTIFICATION #.12))
+
+(cffi:defcstruct lconv
+ (decimal_point :string)
+ (thousands_sep :string)
+ (grouping :string)
+ (int_curr_symbol :string)
+ (currency_symbol :string)
+ (mon_decimal_point :string)
+ (mon_thousands_sep :string)
+ (mon_grouping :string)
+ (positive_sign :string)
+ (negative_sign :string)
+ (int_frac_digits :char)
+ (frac_digits :char)
+ (p_cs_precedes :char)
+ (p_sep_by_space :char)
+ (n_cs_precedes :char)
+ (n_sep_by_space :char)
+ (p_sign_posn :char)
+ (n_sign_posn :char)
+ (__int_p_cs_precedes :char)
+ (__int_p_sep_by_space :char)
+ (__int_n_cs_precedes :char)
+ (__int_n_sep_by_space :char)
+ (__int_p_sign_posn :char)
+ (__int_n_sign_posn :char))
+
+(cffi:defcfun ("setlocale" setlocale) :string
+ (__category :int)
+ (__locale :string))
+
+(cffi:defcfun ("localeconv" localeconv) :pointer)
+
+
View
137 gettext-cffi.lisp
@@ -0,0 +1,137 @@
+;;; This file was automatically generated by SWIG (http://www.swig.org).
+;;; Version 1.3.40
+;;;
+;;; Do not make changes to this file unless you know what you are doing--modify
+;;; the SWIG interface file instead.
+
+
+;;;SWIG wrapper code starts here
+
+(cl:defmacro defanonenum (&body enums)
+ "Converts anonymous enums to defconstants."
+ `(cl:progn ,@(cl:loop for value in enums
+ for index = 0 then (cl:1+ index)
+ when (cl:listp value) do (cl:setf index (cl:second value)
+ value (cl:first value))
+ collect `(cl:defconstant ,value ,index))))
+
+(cl:eval-when (:compile-toplevel :load-toplevel)
+ (cl:unless (cl:fboundp 'swig-lispify)
+ (cl:defun swig-lispify (name flag cl:&optional (package cl:*package*))
+ (cl:labels ((helper (lst last rest cl:&aux (c (cl:car lst)))
+ (cl:cond
+ ((cl:null lst)
+ rest)
+ ((cl:upper-case-p c)
+ (helper (cl:cdr lst) 'upper
+ (cl:case last
+ ((lower digit) (cl:list* c #\- rest))
+ (cl:t (cl:cons c rest)))))
+ ((cl:lower-case-p c)
+ (helper (cl:cdr lst) 'lower (cl:cons (cl:char-upcase c) rest)))
+ ((cl:digit-char-p c)
+ (helper (cl:cdr lst) 'digit
+ (cl:case last
+ ((upper lower) (cl:list* c #\- rest))
+ (cl:t (cl:cons c rest)))))
+ ((cl:char-equal c #\_)
+ (helper (cl:cdr lst) '_ (cl:cons #\- rest)))
+ (cl:t
+ (cl:error "Invalid character: ~A" c)))))
+ (cl:let ((fix (cl:case flag
+ ((constant enumvalue) "+")
+ (variable "*")
+ (cl:t ""))))
+ (cl:intern
+ (cl:concatenate
+ 'cl:string
+ fix
+ (cl:nreverse (helper (cl:concatenate 'cl:list name) cl:nil cl:nil))
+ fix)
+ package))))))
+
+;;;SWIG wrapper code ends here
+
+
+(cffi:defcfun ("gettext" gettext) :string
+ (__msgid :string))
+
+(cffi:defcfun ("dgettext" dgettext) :string
+ (__domainname :string)
+ (__msgid :string))
+
+(cffi:defcfun ("dcgettext" dcgettext) :string
+ (__domainname :string)
+ (__msgid :string)
+ (__category :int))
+
+(cffi:defcfun ("ngettext" ngettext) :string
+ (__msgid1 :string)
+ (__msgid2 :string)
+ (__n :unsigned-long))
+
+(cffi:defcfun ("dngettext" dngettext) :string
+ (__domainname :string)
+ (__msgid1 :string)
+ (__msgid2 :string)
+ (__n :unsigned-long))
+
+(cffi:defcfun ("textdomain" textdomain) :string
+ (__domainname :string))
+
+(cffi:defcfun ("bindtextdomain" bindtextdomain) :string
+ (__domainname :string)
+ (__dirname :string))
+
+(cffi:defcfun ("bind_textdomain_codeset" bind_textdomain_codeset) :string
+ (__domainname :string)
+ (__codeset :string))
+
+(defanonenum
+ (__LC_CTYPE #.0)
+ (__LC_NUMERIC #.1)
+ (__LC_TIME #.2)
+ (__LC_COLLATE #.3)
+ (__LC_MONETARY #.4)
+ (__LC_MESSAGES #.5)
+ (__LC_ALL #.6)
+ (__LC_PAPER #.7)
+ (__LC_NAME #.8)
+ (__LC_ADDRESS #.9)
+ (__LC_TELEPHONE #.10)
+ (__LC_MEASUREMENT #.11)
+ (__LC_IDENTIFICATION #.12))
+
+(cffi:defcstruct lconv
+ (decimal_point :string)
+ (thousands_sep :string)
+ (grouping :string)
+ (int_curr_symbol :string)
+ (currency_symbol :string)
+ (mon_decimal_point :string)
+ (mon_thousands_sep :string)
+ (mon_grouping :string)
+ (positive_sign :string)
+ (negative_sign :string)
+ (int_frac_digits :char)
+ (frac_digits :char)
+ (p_cs_precedes :char)
+ (p_sep_by_space :char)
+ (n_cs_precedes :char)
+ (n_sep_by_space :char)
+ (p_sign_posn :char)
+ (n_sign_posn :char)
+ (__int_p_cs_precedes :char)
+ (__int_p_sep_by_space :char)
+ (__int_n_cs_precedes :char)
+ (__int_n_sep_by_space :char)
+ (__int_p_sign_posn :char)
+ (__int_n_sign_posn :char))
+
+(cffi:defcfun ("setlocale" setlocale) :string
+ (__category :int)
+ (__locale :string))
+
+(cffi:defcfun ("localeconv" localeconv) :pointer)
+
+
View
122 gettext.i
@@ -0,0 +1,122 @@
+%module gettext
+%{
+#include<libintl.h>
+#include<locale.h>
+%}
+
+extern char *gettext (const char *__msgid);
+extern char *dgettext (const char *__domainname, const char *__msgid);
+extern char *dcgettext (const char *__domainname,
+ const char *__msgid, int __category);
+extern char *ngettext (const char *__msgid1, const char *__msgid2,
+ unsigned long int __n);
+extern char *dngettext (const char *__domainname, const char *__msgid1,
+ const char *__msgid2, unsigned long int __n);
+extern char *textdomain (const char *__domainname);
+extern char *bindtextdomain (const char *__domainname,
+ const char *__dirname);
+extern char *bind_textdomain_codeset (const char *__domainname,
+ const char *__codeset);
+enum
+{
+ __LC_CTYPE = 0,
+ __LC_NUMERIC = 1,
+ __LC_TIME = 2,
+ __LC_COLLATE = 3,
+ __LC_MONETARY = 4,
+ __LC_MESSAGES = 5,
+ __LC_ALL = 6,
+ __LC_PAPER = 7,
+ __LC_NAME = 8,
+ __LC_ADDRESS = 9,
+ __LC_TELEPHONE = 10,
+ __LC_MEASUREMENT = 11,
+ __LC_IDENTIFICATION = 12
+};
+#define LC_CTYPE __LC_CTYPE
+#define LC_NUMERIC __LC_NUMERIC
+#define LC_TIME __LC_TIME
+#define LC_COLLATE __LC_COLLATE
+#define LC_MONETARY __LC_MONETARY
+#define LC_MESSAGES __LC_MESSAGES
+#define LC_ALL __LC_ALL
+#define LC_PAPER __LC_PAPER
+#define LC_NAME __LC_NAME
+#define LC_ADDRESS __LC_ADDRESS
+#define LC_TELEPHONE __LC_TELEPHONE
+#define LC_MEASUREMENT __LC_MEASUREMENT
+#define LC_IDENTIFICATION __LC_IDENTIFICATION
+
+struct lconv
+{
+ /* Numeric (non-monetary) information. */
+
+ char *decimal_point; /* Decimal point character. */
+ char *thousands_sep; /* Thousands separator. */
+ /* Each element is the number of digits in each group;
+ elements with higher indices are farther left.
+ An element with value CHAR_MAX means that no further grouping is done.
+ An element with value 0 means that the previous element is used
+ for all groups farther left. */
+ char *grouping;
+
+ /* Monetary information. */
+
+ /* First three chars are a currency symbol from ISO 4217.
+ Fourth char is the separator. Fifth char is '\0'. */
+ char *int_curr_symbol;
+ char *currency_symbol; /* Local currency symbol. */
+ char *mon_decimal_point; /* Decimal point character. */
+ char *mon_thousands_sep; /* Thousands separator. */
+ char *mon_grouping; /* Like `grouping' element (above). */
+ char *positive_sign; /* Sign for positive values. */
+ char *negative_sign; /* Sign for negative values. */
+ char int_frac_digits; /* Int'l fractional digits. */
+ char frac_digits; /* Local fractional digits. */
+ /* 1 if currency_symbol precedes a positive value, 0 if succeeds. */
+ char p_cs_precedes;
+ /* 1 iff a space separates currency_symbol from a positive value. */
+ char p_sep_by_space;
+ /* 1 if currency_symbol precedes a negative value, 0 if succeeds. */
+ char n_cs_precedes;
+ /* 1 iff a space separates currency_symbol from a negative value. */
+ char n_sep_by_space;
+ /* Positive and negative sign positions:
+ 0 Parentheses surround the quantity and currency_symbol.
+ 1 The sign string precedes the quantity and currency_symbol.
+ 2 The sign string follows the quantity and currency_symbol.
+ 3 The sign string immediately precedes the currency_symbol.
+ 4 The sign string immediately follows the currency_symbol. */
+ char p_sign_posn;
+ char n_sign_posn;
+#ifdef __USE_ISOC99
+ /* 1 if int_curr_symbol precedes a positive value, 0 if succeeds. */
+ char int_p_cs_precedes;
+ /* 1 iff a space separates int_curr_symbol from a positive value. */
+ char int_p_sep_by_space;
+ /* 1 if int_curr_symbol precedes a negative value, 0 if succeeds. */
+ char int_n_cs_precedes;
+ /* 1 iff a space separates int_curr_symbol from a negative value. */
+ char int_n_sep_by_space;
+ /* Positive and negative sign positions:
+ 0 Parentheses surround the quantity and int_curr_symbol.
+ 1 The sign string precedes the quantity and int_curr_symbol.
+ 2 The sign string follows the quantity and int_curr_symbol.
+ 3 The sign string immediately precedes the int_curr_symbol.
+ 4 The sign string immediately follows the int_curr_symbol. */
+ char int_p_sign_posn;
+ char int_n_sign_posn;
+#else
+ char __int_p_cs_precedes;
+ char __int_p_sep_by_space;
+ char __int_n_cs_precedes;
+ char __int_n_sep_by_space;
+ char __int_p_sign_posn;
+ char __int_n_sign_posn;
+#endif
+};
+/* Set and/or return the current locale. */
+extern char *setlocale (int __category, const char *__locale);
+
+/* Return the numeric/monetary information for the current locale. */
+extern struct lconv *localeconv (void);
Please sign in to comment.
Something went wrong with that request. Please try again.