r2561 - in packages: . libmsgcat-perl libmsgcat-perl/branches libmsgcat-perl/branches/upstream libmsgcat-perl/branches/upstream/current

Raphaël Hertzog hertzog at costa.debian.org
Thu Apr 13 21:21:55 UTC 2006


Author: hertzog
Date: 2006-04-13 21:21:54 +0000 (Thu, 13 Apr 2006)
New Revision: 2561

Added:
   packages/libmsgcat-perl/
   packages/libmsgcat-perl/branches/
   packages/libmsgcat-perl/branches/upstream/
   packages/libmsgcat-perl/branches/upstream/current/
   packages/libmsgcat-perl/branches/upstream/current/Changes
   packages/libmsgcat-perl/branches/upstream/current/MANIFEST
   packages/libmsgcat-perl/branches/upstream/current/Makefile.PL
   packages/libmsgcat-perl/branches/upstream/current/Msgcat.pm
   packages/libmsgcat-perl/branches/upstream/current/Msgcat.xs
   packages/libmsgcat-perl/branches/upstream/current/README
   packages/libmsgcat-perl/branches/upstream/current/sample.msg
   packages/libmsgcat-perl/branches/upstream/current/test.pl
   packages/libmsgcat-perl/branches/upstream/current/typemap
   packages/libmsgcat-perl/tags/
Log:
[svn-inject] Installing original source of libmsgcat-perl

Added: packages/libmsgcat-perl/branches/upstream/current/Changes
===================================================================
--- packages/libmsgcat-perl/branches/upstream/current/Changes	2006-04-13 21:21:18 UTC (rev 2560)
+++ packages/libmsgcat-perl/branches/upstream/current/Changes	2006-04-13 21:21:54 UTC (rev 2561)
@@ -0,0 +1,18 @@
+Revision history for Perl extension Locale::Msgcat.
+
+1.03 15 November 1999
+
+	- Changed the name of the directory for the distribution, ie
+	  Msgcat-version/ instead of Msgcat/.
+
+1.02 15 November 1999
+
+	- XPG4 says that the fields in the message catalog must be separated
+	  by one blank, not many. Corrected this in the sample file.
+
+1.01 12 November 1998
+	- unlinks "sample.cat" after the test has been executed, as
+	  "gencat" would otherwise update the catalog (XPG4).
+
+1.00 26 July 1997
+	- original version.

Added: packages/libmsgcat-perl/branches/upstream/current/MANIFEST
===================================================================
--- packages/libmsgcat-perl/branches/upstream/current/MANIFEST	2006-04-13 21:21:18 UTC (rev 2560)
+++ packages/libmsgcat-perl/branches/upstream/current/MANIFEST	2006-04-13 21:21:54 UTC (rev 2561)
@@ -0,0 +1,9 @@
+Changes
+MANIFEST
+Makefile.PL
+Msgcat.pm
+Msgcat.xs
+README
+sample.msg
+test.pl
+typemap

Added: packages/libmsgcat-perl/branches/upstream/current/Makefile.PL
===================================================================
--- packages/libmsgcat-perl/branches/upstream/current/Makefile.PL	2006-04-13 21:21:18 UTC (rev 2560)
+++ packages/libmsgcat-perl/branches/upstream/current/Makefile.PL	2006-04-13 21:21:54 UTC (rev 2561)
@@ -0,0 +1,10 @@
+use ExtUtils::MakeMaker;
+# See lib/ExtUtils/MakeMaker.pm for details of how to influence
+# the contents of the Makefile that is written.
+WriteMakefile(
+    'NAME'	=> 'Locale::Msgcat',
+    'VERSION_FROM' => 'Msgcat.pm', # finds $VERSION
+    'LIBS'	=> [''],   # e.g., '-lm' 
+    'DEFINE'	=> '',     # e.g., '-DHAVE_SOMETHING' 
+    'INC'	=> '',     # e.g., '-I/usr/include/other' 
+);

Added: packages/libmsgcat-perl/branches/upstream/current/Msgcat.pm
===================================================================
--- packages/libmsgcat-perl/branches/upstream/current/Msgcat.pm	2006-04-13 21:21:18 UTC (rev 2560)
+++ packages/libmsgcat-perl/branches/upstream/current/Msgcat.pm	2006-04-13 21:21:54 UTC (rev 2561)
@@ -0,0 +1,89 @@
+package Locale::Msgcat;
+
+use strict;
+use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
+
+require Exporter;
+require DynaLoader;
+
+ at ISA = qw(Exporter DynaLoader);
+# Items to export into callers namespace by default. Note: do not export
+# names by default without a very good reason. Use EXPORT_OK instead.
+# Do not simply export all your public functions/methods/constants.
+ at EXPORT = qw(
+	
+);
+$VERSION = '1.03';
+
+## Define required constants
+#require 'nl_types.ph';
+
+bootstrap Locale::Msgcat $VERSION;
+
+# Preloaded methods go here.
+
+# Autoload methods go after =cut, and are processed by the autosplit program.
+
+1;
+__END__
+# Below is the stub of documentation for your module. You better edit it!
+
+=head1 NAME
+
+Locale::Msgcat - Perl extension for blah blah blah
+
+=head1 SYNOPSIS
+
+  use Locale::Msgcat;
+  
+  $cat = new Locale::Msgcat;
+
+  $rc  = $cat->catopen(name, oflag);
+  $msg = $cat->catgets(set_number, message_number, string);
+  $rc  = $cat->catclose();
+
+=head1 DESCRIPTION
+
+The B<Locale::Msgcat> module allows access to the message catalog functions
+which are available on some systems. A new Locale::Msgcat object must first
+be created for each catalog which has to be open at a given time.
+
+The B<catopen> operation opens the catalog whose name is given as argument.
+The oflag can be either 0 or NL_CAT_LOCALE (usually 1) which is the recommended
+value.
+
+The B<catgets> message retrieves message_number for the set_number message
+set, and if not found returns string.
+
+The B<catclose> function should be used when access to a catalog is not
+needed anymore.
+
+=head1 EXAMPLES
+
+  use Locale::Msgcat;
+
+  $cat = new Locale::Msgcat;
+  unless ($cat->catopen("whois.cat", 1)) {
+      print STDERR "Can't open whois catalog.\n";
+      exit(1);
+  }
+  printf "First message, first set : %s\n", $cat->catgets(1, 1, "not found");
+  unless ($cat->catclose()) {
+      print STDERR "Can't close whois catalog.\n";
+      exit(1);
+  }
+
+The above example would print the first message from the first message
+set found in the whois catalog, or if not found it would print "not found".
+
+=head1 AUTHOR
+
+Christophe Wolfhugel, wolf at pasteur.fr
+
+=head1 SEE ALSO
+
+catopen(3), catclose(3), catgets(3), perl(1).
+
+=cut
+
+1;

Added: packages/libmsgcat-perl/branches/upstream/current/Msgcat.xs
===================================================================
--- packages/libmsgcat-perl/branches/upstream/current/Msgcat.xs	2006-04-13 21:21:18 UTC (rev 2560)
+++ packages/libmsgcat-perl/branches/upstream/current/Msgcat.xs	2006-04-13 21:21:54 UTC (rev 2561)
@@ -0,0 +1,63 @@
+#include "EXTERN.h"
+#include "perl.h"
+#include "XSUB.h"
+
+#include <nl_types.h>
+
+typedef	int		SysRet;
+typedef	nl_catd		*Locale__Msgcat;
+
+MODULE = Locale::Msgcat		PACKAGE = Locale::Msgcat		
+
+Locale::Msgcat
+new(packname = "Locale::Msgcat")
+   char *	packname
+   CODE:
+      {
+         RETVAL = (nl_catd *)safemalloc(sizeof(nl_catd));
+      }
+   OUTPUT:
+      RETVAL
+
+void
+DESTROY(catalog)
+   Locale::Msgcat	catalog
+   CODE:
+      safefree((nl_catd *)catalog);
+
+
+SysRet
+catopen(catalog, name, option)
+   Locale::Msgcat	catalog
+   char			*name
+   int			option
+   CODE:
+      {
+         *catalog = catopen(name, option);
+         if (*catalog == (nl_catd) -1)
+            RETVAL = 0;
+         else
+            RETVAL = 1;
+      }
+   OUTPUT:
+      RETVAL
+
+SysRet
+catclose(catalog)
+   Locale::Msgcat	catalog
+   CODE:
+         RETVAL = (catclose(*catalog) == 0);
+   OUTPUT:
+      RETVAL
+
+char *
+catgets(catalog, set_number, message_number, string)
+   Locale::Msgcat	catalog
+   int			set_number
+   int			message_number
+   char *		string
+   CODE:
+      RETVAL = catgets(*catalog, set_number, message_number, string);
+   OUTPUT:
+      RETVAL
+

Added: packages/libmsgcat-perl/branches/upstream/current/README
===================================================================
--- packages/libmsgcat-perl/branches/upstream/current/README	2006-04-13 21:21:18 UTC (rev 2560)
+++ packages/libmsgcat-perl/branches/upstream/current/README	2006-04-13 21:21:54 UTC (rev 2561)
@@ -0,0 +1,30 @@
+This is Msgcat, a small Perl modules for systems which support the XPG4
+message catalog functions : catopen(3), catgets(3) and catclose(4).
+
+You need perl 5.004 or later to use this library.
+
+You install the library by running these commands:
+
+  perl Makefile.PL
+  make
+  make test
+  make install
+
+Please report any bugs/suggestions to Christophe Wolfhugel <wolf at pasteur.fr>.
+
+All files contained in this installation are Copyright (C) 1997 C. Wolfhugel
+unless otherwise specified. All rights reserved.
+
+This library is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+Systems where the library is known to work
+
+  Digital Unix 4
+  Linux (2.0.29, Debian 1.3)
+  Solaris 2.5
+
+Systems where the library won't work (usually because the catalog functions
+are not available)
+
+  SunOS 4.1.3

Added: packages/libmsgcat-perl/branches/upstream/current/sample.msg
===================================================================
--- packages/libmsgcat-perl/branches/upstream/current/sample.msg	2006-04-13 21:21:18 UTC (rev 2560)
+++ packages/libmsgcat-perl/branches/upstream/current/sample.msg	2006-04-13 21:21:54 UTC (rev 2561)
@@ -0,0 +1,9 @@
+$quote "
+
+$set 1  First set of messages
+
+1	"Hi there ?"
+
+$set 2	Second set of messages
+
+1	"It's raining."

Added: packages/libmsgcat-perl/branches/upstream/current/test.pl
===================================================================
--- packages/libmsgcat-perl/branches/upstream/current/test.pl	2006-04-13 21:21:18 UTC (rev 2560)
+++ packages/libmsgcat-perl/branches/upstream/current/test.pl	2006-04-13 21:21:54 UTC (rev 2561)
@@ -0,0 +1,61 @@
+# Before `make install' is performed this script should be runnable with
+# `make test'. After `make install' it should work as `perl test.pl'
+
+######################### We start with some black magic to print on failure.
+
+# Change 1..1 below to 1..last_test_to_print .
+# (It may become useful if the test is moved to ./t subdirectory.)
+
+BEGIN { $| = 1; print "1..7\n"; }
+END {print "not ok 1\n" unless $loaded;}
+
+my @gencat = qw(
+	gencat
+	/bin/gencat /usr/bin/gencat /usr/sbin/gencat /sbin/gencat
+	/etc/gencat /usr/etc/gencat /usr/local/bin/gencat
+);
+
+use Locale::Msgcat;
+$loaded = 1;
+print "ok 1\n";
+
+## Generate the catalog
+if (MakeCat() != 0) {
+   print "not ok 2\n";
+   exit 0;
+}
+print "ok 2\n";
+
+unless ($a = new Locale::Msgcat) {
+   print "not ok 2\n";
+   exit 0;
+}
+print "ok 2\n";
+
+unless ($a->catopen("./sample.cat", 1)) {
+   print "not ok 3\n";
+   exit 0;
+}
+print "ok 3\n";
+
+print "not " if ($a->catgets(1, 1, "test") ne "Hi there ?");
+print "ok 4\n";
+print "not " if ($a->catgets(2, 1, "test") ne "It's raining.");
+print "ok 5\n";
+print "not " if ($a->catgets(2, 2, "test") ne "test");
+print "ok 6\n";
+print "not " unless ($a->catclose());
+print "ok 7\n";
+
+unlink("sample.cat");
+exit 0;
+
+## Makes the message catalog
+sub MakeCat {
+   my $i;
+
+   while ($i = shift(@gencat)) {
+      return 0 if (system("$i sample.cat sample.msg") == 0);
+   }
+   return 1;
+}

Added: packages/libmsgcat-perl/branches/upstream/current/typemap
===================================================================
--- packages/libmsgcat-perl/branches/upstream/current/typemap	2006-04-13 21:21:18 UTC (rev 2560)
+++ packages/libmsgcat-perl/branches/upstream/current/typemap	2006-04-13 21:21:54 UTC (rev 2561)
@@ -0,0 +1 @@
+Locale::Msgcat		T_PTROBJ




More information about the Pkg-perl-cvs-commits mailing list