Skip to content

Commit

Permalink
Import of HMBRAND/Text-CSV_XS-0.60 from CPAN.
Browse files Browse the repository at this point in the history
gitpan-cpan-distribution: Text-CSV_XS
gitpan-cpan-version:      0.60
gitpan-cpan-path:         HMBRAND/Text-CSV_XS-0.60.tgz
gitpan-cpan-author:       HMBRAND
gitpan-cpan-maturity:     released
  • Loading branch information
H.Merijn Brand authored and Gitpan committed Oct 22, 2014
1 parent 191d648 commit 441b62d
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 20 deletions.
2 changes: 1 addition & 1 deletion CSV_XS.pm
Expand Up @@ -30,7 +30,7 @@ use DynaLoader ();
use Carp;

use vars qw( $VERSION @ISA );
$VERSION = "0.59";
$VERSION = "0.60";
@ISA = qw( DynaLoader );
bootstrap Text::CSV_XS $VERSION;

Expand Down
47 changes: 30 additions & 17 deletions CSV_XS.xs
Expand Up @@ -3,7 +3,7 @@
* This program is free software; you can redistribute it and/or
* modify it under the same terms as Perl itself.
*/

#define PERL_NO_GET_CONTEXT
#include <EXTERN.h>
#include <perl.h>
#include <XSUB.h>
Expand Down Expand Up @@ -180,7 +180,8 @@ static SV *m_getline, *m_print;
io_handle_loaded = 1; \
}

static SV *SvDiag (int xse)
#define SvDiag(xse) cx_SvDiag (aTHX_ xse)
static SV *cx_SvDiag (pTHX_ int xse)
{
int i = 0;
SV *err;
Expand All @@ -194,7 +195,8 @@ static SV *SvDiag (int xse)
return (err);
} /* SvDiag */

static SV *SetDiag (csv_t *csv, int xse)
#define SetDiag(csv,xse) cx_SetDiag (aTHX_ csv, xse)
static SV *cx_SetDiag (pTHX_ csv_t *csv, int xse)
{
SV *err = SvDiag (xse);

Expand All @@ -208,7 +210,8 @@ static SV *SetDiag (csv_t *csv, int xse)
return (err);
} /* SetDiag */

static void SetupCsv (csv_t *csv, HV *self)
#define SetupCsv(csv,self) cx_SetupCsv (aTHX_ csv, self)
static void cx_SetupCsv (pTHX_ csv_t *csv, HV *self)
{
SV **svp;
STRLEN len;
Expand Down Expand Up @@ -357,7 +360,8 @@ static void SetupCsv (csv_t *csv, HV *self)
csv->used = 0;
} /* SetupCsv */

static int Print (csv_t *csv, SV *dst)
#define Print(csv,dst) cx_Print (aTHX_ csv, dst)
static int cx_Print (pTHX_ csv_t *csv, SV *dst)
{
int result;

Expand Down Expand Up @@ -401,7 +405,8 @@ static int Print (csv_t *csv, SV *dst)
/* Should be extended for EBCDIC ? */
#define is_csv_binary(ch) ((ch < CH_SPACE || ch >= CH_DEL) && ch != CH_TAB)

static int Combine (csv_t *csv, SV *dst, AV *fields)
#define Combine(csv,dst,fields) cx_Combine (aTHX_ csv, dst, fields)
static int cx_Combine (pTHX_ csv_t *csv, SV *dst, AV *fields)
{
int i;

Expand Down Expand Up @@ -494,10 +499,8 @@ static int Combine (csv_t *csv, SV *dst, AV *fields)
return TRUE;
} /* Combine */

#if MAINT_DEBUG
static char str_parsed[40];
#endif
static void ParseError (csv_t *csv, int xse, int pos)
#define ParseError(csv,xse,pos) cx_ParseError (aTHX_ csv, xse, pos)
static void cx_ParseError (pTHX_ csv_t *csv, int xse, int pos)
{
hv_store (csv->self, "_ERROR_POS", 10, newSViv (pos), 0);
if (csv->tmp) {
Expand All @@ -507,7 +510,8 @@ static void ParseError (csv_t *csv, int xse, int pos)
(void)SetDiag (csv, xse);
} /* ParseError */

static int CsvGet (csv_t *csv, SV *src)
#define CsvGet(csv,src) cx_CsvGet (aTHX_ csv, src)
static int cx_CsvGet (pTHX_ csv_t *csv, SV *src)
{
unless (csv->useIO)
return EOF;
Expand Down Expand Up @@ -609,7 +613,8 @@ static int CsvGet (csv_t *csv, SV *src)
}
#endif

static void strip_trail_whitespace (SV *sv)
#define strip_trail_whitespace(sv) cx_strip_trail_whitespace (aTHX_ sv)
static void cx_strip_trail_whitespace (pTHX_ SV *sv)
{
STRLEN len;
char *s = SvPV (sv, len);
Expand All @@ -620,7 +625,8 @@ static void strip_trail_whitespace (SV *sv)
SvCUR_set (sv, len);
} /* strip_trail_whitespace */

static SV *bound_field (csv_t *csv, int i)
#define bound_field(csv,i) cx_bound_field (aTHX_ csv, i)
static SV *cx_bound_field (pTHX_ csv_t *csv, int i)
{
SV *sv = csv->bound;
AV *av;
Expand Down Expand Up @@ -657,7 +663,12 @@ static SV *bound_field (csv_t *csv, int i)
f = 0; \
}

static int Parse (csv_t *csv, SV *src, AV *fields, AV *fflags)
#if MAINT_DEBUG
static char str_parsed[40];
#endif

#define Parse(csv,src,fields,fflags) cx_Parse (aTHX_ csv, src, fields, fflags)
static int cx_Parse (pTHX_ csv_t *csv, SV *src, AV *fields, AV *fflags)
{
int c, f = 0;
int c_ungetc = EOF;
Expand Down Expand Up @@ -747,7 +758,7 @@ restart:
if (csv->verbatim) {
f |= CSV_FLAGS_BIN;
unless (csv->binary)
/* uncovered */ ERROR_INSIDE_FIELD (2030);
ERROR_INSIDE_FIELD (2030);

CSV_PUT_SV (c);
}
Expand Down Expand Up @@ -1079,7 +1090,8 @@ restart:
return TRUE;
} /* Parse */

static int xsParse (HV *hv, AV *av, AV *avf, SV *src, bool useIO)
#define xsParse(hv,av,avf,src,useIO) cx_xsParse (aTHX_ hv, av, avf, src, useIO)
static int cx_xsParse (pTHX_ HV *hv, AV *av, AV *avf, SV *src, bool useIO)
{
csv_t csv;
int result;
Expand Down Expand Up @@ -1137,7 +1149,8 @@ static int xsParse (HV *hv, AV *av, AV *avf, SV *src, bool useIO)
return result;
} /* xsParse */

static int xsCombine (HV *hv, AV *av, SV *io, bool useIO)
#define xsCombine(hv,av,io,useIO) cx_xsCombine (aTHX_ hv, av, io, useIO)
static int cx_xsCombine (pTHX_ HV *hv, AV *av, SV *io, bool useIO)
{
csv_t csv;
int result;
Expand Down
5 changes: 5 additions & 0 deletions ChangeLog
@@ -1,3 +1,8 @@
2009-01-27 0.60 - H.Merijn Brand <h.m.brand@xs4all.nl>

* Optimize for threaded perls. (Goro Fuji, RT#42517)
Non-threaded perls won't notice

2009-01-23 0.59 - H.Merijn Brand <h.m.brand@xs4all.nl>

* Wrong e-mail in META.yml
Expand Down
4 changes: 2 additions & 2 deletions META.yml
@@ -1,6 +1,6 @@
--- #YAML:1.1
name: Text-CSV_XS
version: 0.59
version: 0.60
abstract: Comma-Separated Values manipulation routines
license: perl
author:
Expand All @@ -10,7 +10,7 @@ distribution_type: module
provides:
Text::CSV_XS:
file: CSV_XS.pm
version: 0.59
version: 0.60
requires:
perl: 5.005
DynaLoader: 0
Expand Down

0 comments on commit 441b62d

Please sign in to comment.