}
static SV *
-encode_method(pTHX_ encode_t * enc, encpage_t * dir, SV * src,
+encode_method(pTHX_ const encode_t * enc, const encpage_t * dir, SV * src,
int check, STRLEN * offset, SV * term, int * retcode)
{
STRLEN slen;
/* fields ordered to pack nicely on 32-bit machines */
const U8 *seq; /* Packed output sequences we generate
if we match */
- encpage_t *next; /* Page to go to if we match */
+ const encpage_t *next; /* Page to go to if we match */
U8 min; /* Min value of octet to match this entry */
U8 max; /* Max value of octet to match this entry */
U8 dlen; /* destination length -
typedef struct encode_s encode_t;
struct encode_s
{
- encpage_t *t_utf8; /* Starting table for translation from
- the encoding to UTF-8 form */
- encpage_t *f_utf8; /* Starting table for translation
- from UTF-8 to the encoding */
+ const encpage_t *t_utf8; /* Starting table for translation from
+ the encoding to UTF-8 form */
+ const encpage_t *f_utf8; /* Starting table for translation
+ from UTF-8 to the encoding */
const U8 *rep; /* Replacement character in this encoding
e.g. "?" */
int replen; /* Number of octets in rep */
#ifdef U8
/* See comment at top of file for deviousness */
-extern int do_encode(encpage_t *enc, const U8 *src, STRLEN *slen,
+extern int do_encode(const encpage_t *enc, const U8 *src, STRLEN *slen,
U8 *dst, STRLEN dlen, STRLEN *dout, int approx,
const U8 *term, STRLEN tlen);
my @info = ($e2u->{Cname},$u2e->{Cname},qq((U8 *)"$rep"),$replen,$min_el,$max_el);
my $sym = "${enc}_encoding";
$sym =~ s/\W+/_/g;
- print C "encode_t $sym = \n";
+ print C "const encode_t $sym = \n";
# This is to make null encoding work -- dankogai
for (my $i = (scalar @info) - 1; $i >= 0; --$i){
$info[$i] ||= 1;
if ($a->{'Forward'})
{
my $var = $^O eq 'MacOS' ? 'extern' : 'static';
- print $fh "$var encpage_t $name\[",scalar(@{$a->{'Entries'}}),"];\n";
+ print $fh "$var const encpage_t $name\[",scalar(@{$a->{'Entries'}}),"];\n";
}
$a->{'DoneStrings'} = 1;
foreach my $b (@{$a->{'Entries'}})
my ($s,$e,$out,$t,$end,$l) = @$b;
outtable($fh,$t,$bigname) unless $t->{'Done'};
}
- print $fh "\nstatic encpage_t $name\[",scalar(@{$a->{'Entries'}}),"] = {\n";
+ print $fh "\nstatic const encpage_t $name\[",
+ scalar(@{$a->{'Entries'}}), "] = {\n";
foreach my $b (@{$a->{'Entries'}})
{
my ($sc,$ec,$out,$t,$end,$l,$fb) = @$b;
#include "encode.h"
int
-do_encode(encpage_t * enc, const U8 * src, STRLEN * slen, U8 * dst,
+do_encode(const encpage_t * enc, const U8 * src, STRLEN * slen, U8 * dst,
STRLEN dlen, STRLEN * dout, int approx, const U8 *term, STRLEN tlen)
{
const U8 *s = src;
U8 *dend = d + dlen, *dlast = d;
int code = 0;
while (s < send) {
- encpage_t *e = enc;
+ const encpage_t *e = enc;
U8 byte = *s;
while (byte > e->max)
e++;