Permalink
Browse files

converting to PARROT_INTERP in the PMCs

git-svn-id: https://svn.parrot.org/parrot/trunk@20123 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
  • Loading branch information...
1 parent 0a8feb1 commit 6fb3a5198a124299ddd8276f533369f55aadf526 @petdance petdance committed Jul 23, 2007
View
4 compilers/imcc/instructions.c
@@ -53,8 +53,8 @@ const char types[] = "INPS";
Emitter emitters[2] = {
{e_file_open,
e_file_emit,
- (int (*)(Interp *, void *, IMC_Unit *))NULLfunc,
- (int (*)(Interp *, void *, IMC_Unit *))NULLfunc,
+ NULL,
+ NULL,
e_file_close},
{e_pbc_open,
View
8 config/gen/core_pmcs.pm
@@ -102,16 +102,16 @@ sub generate_c {
END_C
- print {$OUT} "extern void Parrot_${_}_class_init(Interp *, int, int);\n" foreach (@pmcs);
+ print {$OUT} "extern void Parrot_${_}_class_init(PARROT_INTERP, int, int);\n" foreach (@pmcs);
print {$OUT} <<"END_C";
/* HEADERIZER HFILE: none */
/* This isn't strictly true, but the headerizer should not bother */
-void Parrot_register_core_pmcs(Interp *interp, PMC* registry);
-extern void Parrot_initialize_core_pmcs(Interp *interp);
-void Parrot_initialize_core_pmcs(Interp *interp)
+void Parrot_register_core_pmcs(PARROT_INTERP, PMC* registry);
+extern void Parrot_initialize_core_pmcs(PARROT_INTERP);
+void Parrot_initialize_core_pmcs(PARROT_INTERP)
{
int pass;
for (pass = 0; pass <= 1; ++pass) {
View
22 config/init/hints/linux.pm
@@ -8,17 +8,21 @@ use warnings;
use Config;
+sub option_or_data {
+ my $conf = shift;
+ my $arg = shift;
+
+ my $opt = $conf->options->get( $arg );
+ return $opt ? $opt : $conf->data->get( $arg );
+}
+
sub runstep {
my ( $self, $conf ) = @_;
- my $libs = $conf->options->get('libs') ?
- $conf->options->get('libs') : $conf->data->get('libs');
- my $cflags = $conf->options->get('ccflags') ?
- $conf->options->get('ccflags') : $conf->data->get('ccflags');
- my $cc = $conf->options->get('cc') ?
- $conf->options->get('cc') : $conf->data->get('cc');
- my $linkflags = $conf->options->get('linkflags') ?
- $conf->options->get('linkflags') : $conf->data->get('linkflags');
+ my $libs = option_or_data('libs');
+ my $cflags = option_or_data('cflags');
+ my $cc = option_or_data('cc');
+ my $linkflags = option_or_data('linkflags');
# should find g++ in most cases
my $link = $conf->data->get('link') || 'c++';
@@ -31,7 +35,7 @@ sub runstep {
if ( $cc =~ /icc/ ) {
# Intel C++ compiler has the same name as its C compiler
- $link = 'icc';
+ $link = $cc;
# don't allow icc to pretend it's gcc
$cflags .= ' -no-gcc';
View
2 include/parrot/register.h
@@ -127,7 +127,7 @@ void mark_register_stack( PARROT_INTERP, NOTNULL(Stack_Chunk_t* chunk) )
PARROT_CANNOT_RETURN_NULL
PARROT_WARN_UNUSED_RESULT
struct Parrot_Context * Parrot_alloc_context( PARROT_INTERP,
- NOTNULL(INTVAL *n_regs_used) )
+ NOTNULL(INTVAL *number_regs_used) )
__attribute__nonnull__(1)
__attribute__nonnull__(2);
View
1 lib/Parrot/Configure/Step/List.pm
@@ -13,6 +13,7 @@ my @steps = qw(
init::install
init::miniparrot
init::hints
+ init::attributes
init::headers
inter::progs
inter::make
View
3 src/interpreter.c
@@ -727,8 +727,7 @@ void
runops_int(PARROT_INTERP, size_t offset)
{
int lo_var_ptr;
- opcode_t *(*core) (Interp *, opcode_t *) =
- (opcode_t *(*) (Interp *, opcode_t *)) 0;
+ opcode_t *(*core) (PARROT_INTERP, opcode_t *) = NULL;
if (!interp->lo_var_ptr) {
/*
View
6 src/pmc/addrregistry.pmc
@@ -30,16 +30,14 @@ e.g. with C<Parrot_register_pmc> if it isn't visible to Parrot.
#include "pmc_hash.h"
static size_t
-key_hash_int(Interp *interp, void *value, size_t seed)
+key_hash_int(SHIM_INTERP, void *value, size_t seed)
{
- UNUSED(interp);
return (size_t)value ^ seed;
}
static int
-int_compare(Interp *interp, const void * const a, const void * const b)
+int_compare(SHIM_INTERP, const void * const a, const void * const b)
{
- UNUSED(interp);
return a != b;
}
View
8 src/pmc/array.pmc
@@ -38,7 +38,7 @@ static PMC* undef(Interp* interp)
/*
-=item C<static PMC* retval(Interp *interp, void *ret)>
+=item C<static PMC* retval(PARROT_INTERP, void *ret)>
Processes C<*ret>, returning the appropriate PMC, or raising an
exception if necessary.
@@ -47,7 +47,7 @@ exception if necessary.
*/
-static PMC* retval(Interp *interp, void *ret)
+static PMC* retval(PARROT_INTERP, void *ret)
{
PMC *value;
if (ret == 0)
@@ -68,7 +68,7 @@ static PMC* retval(Interp *interp, void *ret)
/*
=item C<static PMC*
-Parrot_Array_set_pmc_ptr(Interp *interp, List *list, INTVAL key)>
+Parrot_Array_set_pmc_ptr(PARROT_INTERP, List *list, INTVAL key)>
Returns a pointer to the element at index C<key> of C<*list>. If
this element was previously empty, then this function also creates
@@ -79,7 +79,7 @@ and assigns an "undef" PMC to that element.
*/
static PMC*
-Parrot_Array_set_pmc_ptr(Interp *interp, List *list, INTVAL key)
+Parrot_Array_set_pmc_ptr(PARROT_INTERP, List *list, INTVAL key)
{
void * const ret = list_get(interp, list, key, enum_type_PMC);
PMC *value;
View
134 src/pmc/bigint.pmc
@@ -41,55 +41,55 @@ typedef struct BIGINT {
# define BN(x) ((BIGINT*)PMC_struct_val(x))->b
static void
-bigint_init(Interp *interp, PMC *self) {
+bigint_init(PARROT_INTERP, PMC *self) {
PMC_struct_val(self) = malloc(sizeof (BIGINT));
mpz_init(BN(self));
}
static void
-bigint_clear(Interp *interp, PMC *self) {
+bigint_clear(PARROT_INTERP, PMC *self) {
mpz_clear(BN(self));
}
static void
-bigint_set(Interp *interp, PMC *dest, PMC *src) {
+bigint_set(PARROT_INTERP, PMC *dest, PMC *src) {
mpz_set(BN(dest), BN(src));
}
static void
-bigint_set_long(Interp *interp, PMC *self, long value) {
+bigint_set_long(PARROT_INTERP, PMC *self, long value) {
mpz_set_si(BN(self), value);
}
static void
-bigint_set_double(Interp *interp, PMC *self, double value) {
+bigint_set_double(PARROT_INTERP, PMC *self, double value) {
mpz_set_d(BN(self), value);
}
static void
-bigint_set_str(Interp *interp, PMC *self, char* value, int base) {
+bigint_set_str(PARROT_INTERP, PMC *self, char* value, int base) {
mpz_set_str(BN(self), value, base);
}
static BIGNUM*
-bigint_get_self(Interp *interp, PMC *self) {
+bigint_get_self(PARROT_INTERP, PMC *self) {
return PMC_struct_val(self);
}
static void
-bigint_set_self(Interp *interp, PMC *self, BIGNUM *value) {
+bigint_set_self(PARROT_INTERP, PMC *self, BIGNUM *value) {
mpz_set(BN(self), (mpz_srcptr)value);
}
static long
-bigint_get_long(Interp *interp, PMC *self) {
+bigint_get_long(PARROT_INTERP, PMC *self) {
if (mpz_fits_slong_p(BN(self)))
return mpz_get_si(BN(self));
real_exception(interp, NULL, 1, "bigint_get_long: number too big");
return 0;
}
static int
-bigint_get_bool(Interp *interp, PMC *self) {
+bigint_get_bool(PARROT_INTERP, PMC *self) {
if (mpz_sgn(BN(self)) != 0) {
return 1;
}
@@ -98,25 +98,25 @@ bigint_get_bool(Interp *interp, PMC *self) {
}
}
static char *
-bigint_get_string(Interp *interp, PMC *self, int base) {
+bigint_get_string(PARROT_INTERP, PMC *self, int base) {
size_t n = mpz_sizeinbase(BN(self), base) + 2;
char *s = (char *)mem_sys_allocate(n);
return mpz_get_str(s, base, BN(self));
}
static double
-bigint_get_double(Interp *interp, PMC *self) {
+bigint_get_double(PARROT_INTERP, PMC *self) {
return mpz_get_d(BN(self));
}
static void
-bigint_add_bigint(Interp *interp, PMC* self, PMC *value, PMC *dest)
+bigint_add_bigint(PARROT_INTERP, PMC* self, PMC *value, PMC *dest)
{
mpz_add(BN(dest), BN(self), BN(value));
}
static void
-bigint_add_bigint_int(Interp *interp, PMC* self, INTVAL value,
+bigint_add_bigint_int(PARROT_INTERP, PMC* self, INTVAL value,
PMC *dest)
{
int n = value < 0;
@@ -127,13 +127,13 @@ bigint_add_bigint_int(Interp *interp, PMC* self, INTVAL value,
mpz_add_ui(BN(dest), BN(self), value);
}
static void
-bigint_sub_bigint(Interp *interp, PMC* self, PMC *value, PMC *dest)
+bigint_sub_bigint(PARROT_INTERP, PMC* self, PMC *value, PMC *dest)
{
mpz_sub(BN(dest), BN(self), BN(value));
}
static void
-bigint_sub_bigint_int(Interp *interp, PMC* self, INTVAL value,
+bigint_sub_bigint_int(PARROT_INTERP, PMC* self, INTVAL value,
PMC *dest)
{
int n = value < 0;
@@ -143,27 +143,27 @@ bigint_sub_bigint_int(Interp *interp, PMC* self, INTVAL value,
mpz_sub_ui(BN(dest), BN(self), value);
}
static void
-bigint_mul_bigint(Interp *interp, PMC* self, PMC *value, PMC *dest)
+bigint_mul_bigint(PARROT_INTERP, PMC* self, PMC *value, PMC *dest)
{
mpz_mul(BN(dest), BN(self), BN(value));
}
static void
-bigint_mul_bigint_int(Interp *interp, PMC* self, INTVAL value,
+bigint_mul_bigint_int(PARROT_INTERP, PMC* self, INTVAL value,
PMC *dest)
{
mpz_mul_si(BN(dest), BN(self), value);
}
static void
-bigint_pow_bigint_int(Interp *interp, PMC* self, INTVAL value,
+bigint_pow_bigint_int(PARROT_INTERP, PMC* self, INTVAL value,
PMC *dest)
{
mpz_pow_ui(BN(dest), BN(self), value);
}
static void
-int_check_divide_zero(Interp *interp, INTVAL value)
+int_check_divide_zero(PARROT_INTERP, INTVAL value)
{
if (value == 0) {
real_exception(interp, NULL, E_ZeroDivisionError,
@@ -172,7 +172,7 @@ int_check_divide_zero(Interp *interp, INTVAL value)
}
static void
-bigint_check_divide_zero(Interp *interp, PMC *value)
+bigint_check_divide_zero(PARROT_INTERP, PMC *value)
{
/* Throw an exception if we are dividing by zero. */
if (mpz_cmp_si(BN(value), 0) == 0) {
@@ -182,14 +182,14 @@ bigint_check_divide_zero(Interp *interp, PMC *value)
}
static void
-bigint_div_bigint(Interp *interp, PMC* self, PMC *value, PMC *dest)
+bigint_div_bigint(PARROT_INTERP, PMC* self, PMC *value, PMC *dest)
{
bigint_check_divide_zero(interp, value);
/* this is mpz_fdiv_q */
mpz_div(BN(dest), BN(self), BN(value));
}
static void
-bigint_div_bigint_int(Interp *interp, PMC* self, INTVAL value, PMC *dest)
+bigint_div_bigint_int(PARROT_INTERP, PMC* self, INTVAL value, PMC *dest)
{
int n;
int_check_divide_zero(interp, value);
@@ -203,13 +203,13 @@ bigint_div_bigint_int(Interp *interp, PMC* self, INTVAL value, PMC *dest)
mpz_div_ui(BN(dest), BN(self), value);
}
static void
-bigint_fdiv_bigint(Interp *interp, PMC* self, PMC *value, PMC *dest)
+bigint_fdiv_bigint(PARROT_INTERP, PMC* self, PMC *value, PMC *dest)
{
bigint_check_divide_zero(interp, value);
mpz_fdiv_q(BN(dest), BN(self), BN(value));
}
static void
-bigint_fdiv_bigint_int(Interp *interp, PMC* self, INTVAL value, PMC *dest)
+bigint_fdiv_bigint_int(PARROT_INTERP, PMC* self, INTVAL value, PMC *dest)
{
int n;
int_check_divide_zero(interp, value);
@@ -223,14 +223,14 @@ bigint_fdiv_bigint_int(Interp *interp, PMC* self, INTVAL value, PMC *dest)
}
static void
-bigint_mod_bigint(Interp *interp, PMC* self, PMC *value, PMC *dest)
+bigint_mod_bigint(PARROT_INTERP, PMC* self, PMC *value, PMC *dest)
{
bigint_check_divide_zero(interp, value);
mpz_mod(BN(dest), BN(self), BN(value));
}
static void
-bigint_mod_bigint_int(Interp *interp, PMC* self, INTVAL value, PMC *dest)
+bigint_mod_bigint_int(PARROT_INTERP, PMC* self, INTVAL value, PMC *dest)
{
int n;
int_check_divide_zero(interp, value);
@@ -242,33 +242,33 @@ bigint_mod_bigint_int(Interp *interp, PMC* self, INTVAL value, PMC *dest)
mpz_mod_ui(BN(dest), BN(self), value);
}
static INTVAL
-bigint_cmp(Interp *interp, PMC* self, PMC *value)
+bigint_cmp(PARROT_INTERP, PMC* self, PMC *value)
{
return mpz_cmp(BN(self), BN(value));
}
static INTVAL
-bigint_cmp_int(Interp *interp, PMC* self, INTVAL value)
+bigint_cmp_int(PARROT_INTERP, PMC* self, INTVAL value)
{
return mpz_cmp_si(BN(self), value);
}
static void
-bigint_abs(Interp *interp, PMC* self, PMC *dest)
+bigint_abs(PARROT_INTERP, PMC* self, PMC *dest)
{
VTABLE_morph(interp, dest, enum_class_BigInt);
mpz_abs(BN(dest), BN(self));
}
static void
-bigint_neg(Interp *interp, PMC* self, PMC *dest)
+bigint_neg(PARROT_INTERP, PMC* self, PMC *dest)
{
VTABLE_morph(interp, dest, enum_class_BigInt);
mpz_neg(BN(dest), BN(self));
}
static void
-bigint_bitwise_shl_bigint_int(Interp *interp, PMC* self,
+bigint_bitwise_shl_bigint_int(PARROT_INTERP, PMC* self,
INTVAL value, PMC *dest)
{
/* The third args to mpz_mul_2exp and mpz_tdiv_q_2exp are unsigned, so we
@@ -279,7 +279,7 @@ bigint_bitwise_shl_bigint_int(Interp *interp, PMC* self,
mpz_tdiv_q_2exp(BN(dest), BN(self), -value);
}
static void
-bigint_bitwise_shr_bigint_int(Interp *interp, PMC* self,
+bigint_bitwise_shr_bigint_int(PARROT_INTERP, PMC* self,
INTVAL value, PMC *dest)
{
/* The third args to mpz_mul_2exp and mpz_tdiv_q_2exp are unsigned, so we
@@ -293,201 +293,199 @@ bigint_bitwise_shr_bigint_int(Interp *interp, PMC* self,
#else /* ifdef PARROT_HAS_GMP */
static void
-bigint_init(Interp *interp, PMC *self) {
+bigint_init(PARROT_INTERP, PMC *self) {
real_exception(interp, NULL, E_LibraryNotLoadedError,
"no bigint lib loaded");
}
static void
-bigint_clear(Interp *interp, PMC *self) {
+bigint_clear(PARROT_INTERP, PMC *self) {
real_exception(interp, NULL, E_LibraryNotLoadedError,
"no bigint lib loaded");
}
static void
-bigint_set_long(Interp *interp, PMC *self, long value) {
+bigint_set_long(PARROT_INTERP, PMC *self, long value) {
real_exception(interp, NULL, E_LibraryNotLoadedError,
"no bigint lib loaded");
}
static void
-bigint_set(Interp *interp, PMC *dest, PMC *src) {
+bigint_set(PARROT_INTERP, PMC *dest, PMC *src) {
real_exception(interp, NULL, E_LibraryNotLoadedError,
"no bigint lib loaded");
}
static void
-bigint_set_double(Interp *interp, PMC *self, double value) {
+bigint_set_double(PARROT_INTERP, PMC *self, double value) {
real_exception(interp, NULL, E_LibraryNotLoadedError,
"no bigint lib loaded");
}
static void
-bigint_set_str(Interp *interp, PMC *self, char* value, int base) {
+bigint_set_str(PARROT_INTERP, PMC *self, char* value, int base) {
real_exception(interp, NULL, E_LibraryNotLoadedError,
"no bigint lib loaded");
}
static void
-bigint_set_self(Interp *interp, PMC *self, BIGNUM *value) {
+bigint_set_self(PARROT_INTERP, PMC *self, BIGNUM *value) {
real_exception(interp, NULL, E_LibraryNotLoadedError,
"no bigint lib loaded");
}
static BIGNUM*
-bigint_get_self(Interp *interp, PMC *self) {
+bigint_get_self(PARROT_INTERP, PMC *self) {
real_exception(interp, NULL, E_LibraryNotLoadedError,
"no bigint lib loaded");
return NULL;
}
static char *
-bigint_get_string(Interp *interp, PMC *self, int base) {
+bigint_get_string(PARROT_INTERP, PMC *self, int base) {
real_exception(interp, NULL, E_LibraryNotLoadedError,
"no bigint lib loaded");
return NULL;
}
static long
-bigint_get_long(Interp *interp, PMC *self) {
+bigint_get_long(PARROT_INTERP, PMC *self) {
real_exception(interp, NULL, E_LibraryNotLoadedError,
"no bigint lib loaded");
return 0L;
}
static long
-bigint_get_bool(Interp *interp, PMC *self) {
+bigint_get_bool(PARROT_INTERP, PMC *self) {
real_exception(interp, NULL, E_LibraryNotLoadedError,
"no bigint lib loaded");
return 0L;
}
static double
-bigint_get_double(Interp *interp, PMC *self) {
+bigint_get_double(PARROT_INTERP, PMC *self) {
real_exception(interp, NULL, E_LibraryNotLoadedError,
"no bigint lib loaded");
return 0.0;
}
static void
-bigint_add_bigint(Interp *interp, PMC* self, PMC *value, PMC *dest)
+bigint_add_bigint(PARROT_INTERP, PMC* self, PMC *value, PMC *dest)
{
real_exception(interp, NULL, E_LibraryNotLoadedError,
"no bigint lib loaded");
}
static void
-bigint_add_bigint_int(Interp *interp, PMC* self, INTVAL value, PMC *dest)
+bigint_add_bigint_int(PARROT_INTERP, PMC* self, INTVAL value, PMC *dest)
{
real_exception(interp, NULL, E_LibraryNotLoadedError,
"no bigint lib loaded");
}
static void
-bigint_sub_bigint(Interp *interp, PMC* self, PMC *value, PMC *dest)
+bigint_sub_bigint(PARROT_INTERP, PMC* self, PMC *value, PMC *dest)
{
real_exception(interp, NULL, E_LibraryNotLoadedError,
"no bigint lib loaded");
}
static void
-bigint_sub_bigint_int(Interp *interp, PMC* self, INTVAL value, PMC *dest)
+bigint_sub_bigint_int(PARROT_INTERP, PMC* self, INTVAL value, PMC *dest)
{
real_exception(interp, NULL, E_LibraryNotLoadedError,
"no bigint lib loaded");
}
static void
-bigint_mul_bigint(Interp *interp, PMC* self, PMC *value, PMC *dest)
+bigint_mul_bigint(PARROT_INTERP, PMC* self, PMC *value, PMC *dest)
{
real_exception(interp, NULL, E_LibraryNotLoadedError,
"no bigint lib loaded");
}
static void
-bigint_mul_bigint_int(Interp *interp, PMC* self, INTVAL value,
+bigint_mul_bigint_int(PARROT_INTERP, PMC* self, INTVAL value,
PMC *dest)
{
real_exception(interp, NULL, E_LibraryNotLoadedError,
"no bigint lib loaded");
}
static void
-bigint_pow_bigint_int(Interp *interp, PMC* self, INTVAL value,
+bigint_pow_bigint_int(PARROT_INTERP, PMC* self, INTVAL value,
PMC *dest)
{
real_exception(interp, NULL, E_LibraryNotLoadedError,
"no bigint lib loaded");
}
static void
-bigint_div_bigint(Interp *interp, PMC* self, PMC *value, PMC *dest)
+bigint_div_bigint(PARROT_INTERP, PMC* self, PMC *value, PMC *dest)
{
real_exception(interp, NULL, E_LibraryNotLoadedError,
"no bigint lib loaded");
}
static void
-bigint_div_bigint_int(Interp *interp, PMC* self, INTVAL value, PMC *dest)
+bigint_div_bigint_int(PARROT_INTERP, PMC* self, INTVAL value, PMC *dest)
{
real_exception(interp, NULL, E_LibraryNotLoadedError,
"no bigint lib loaded");
}
static void
-bigint_fdiv_bigint(Interp *interp, PMC* self, PMC *value, PMC *dest)
+bigint_fdiv_bigint(PARROT_INTERP, PMC* self, PMC *value, PMC *dest)
{
real_exception(interp, NULL, E_LibraryNotLoadedError,
"no bigint lib loaded");
}
static void
-bigint_fdiv_bigint_int(Interp *interp, PMC* self, INTVAL value, PMC *dest)
+bigint_fdiv_bigint_int(PARROT_INTERP, PMC* self, INTVAL value, PMC *dest)
{
real_exception(interp, NULL, E_LibraryNotLoadedError,
"no bigint lib loaded");
}
static void
-bigint_mod_bigint(Interp *interp, PMC* self, PMC *value, PMC *dest)
+bigint_mod_bigint(PARROT_INTERP, PMC* self, PMC *value, PMC *dest)
{
real_exception(interp, NULL, E_LibraryNotLoadedError,
"no bigint lib loaded");
}
static void
-bigint_mod_bigint_int(Interp *interp, PMC* self, INTVAL value, PMC *dest)
+bigint_mod_bigint_int(PARROT_INTERP, PMC* self, INTVAL value, PMC *dest)
{
real_exception(interp, NULL, E_LibraryNotLoadedError,
"no bigint lib loaded");
}
static INTVAL
-bigint_cmp(Interp *interp, PMC* self, PMC *value)
+bigint_cmp(PARROT_INTERP, PMC* self, PMC *value)
{
real_exception(interp, NULL, E_LibraryNotLoadedError,
"no bigint lib loaded");
return 0;
}
static INTVAL
-bigint_cmp_int(Interp *interp, PMC* self, INTVAL value)
+bigint_cmp_int(PARROT_INTERP, PMC* self, INTVAL value)
{
real_exception(interp, NULL, E_LibraryNotLoadedError,
"no bigint lib loaded");
return 0;
}
static void
-bigint_abs(Interp *interp, PMC* self, PMC *dest)
+bigint_abs(PARROT_INTERP, PMC* self, PMC *dest)
{
real_exception(interp, NULL, E_LibraryNotLoadedError,
"no bigint lib loaded");
}
static void
-bigint_neg(Interp *interp, PMC* self, PMC *dest)
+bigint_neg(PARROT_INTERP, PMC* self, PMC *dest)
{
real_exception(interp, NULL, E_LibraryNotLoadedError,
"no bigint lib loaded");
}
static void
-bigint_bitwise_shl_bigint(Interp *interp, PMC* self, PMC *value, PMC *dest)
+bigint_bitwise_shl_bigint(PARROT_INTERP, PMC* self, PMC *value, PMC *dest)
{
real_exception(interp, NULL, E_LibraryNotLoadedError,
"no bigint lib loaded");
}
static void
-bigint_bitwise_shl_bigint_int(Interp *interp, PMC* self,
- INTVAL value, PMC *dest)
+bigint_bitwise_shl_bigint_int(PARROT_INTERP, PMC* self, INTVAL value, PMC *dest)
{
real_exception(interp, NULL, E_LibraryNotLoadedError,
"no bigint lib loaded");
}
static void
-bigint_bitwise_shr_bigint(Interp *interp, PMC* self, PMC *value, PMC *dest)
+bigint_bitwise_shr_bigint(PARROT_INTERP, PMC* self, PMC *value, PMC *dest)
{
real_exception(interp, NULL, E_LibraryNotLoadedError,
"no bigint lib loaded");
}
static void
-bigint_bitwise_shr_bigint_int(Interp *interp, PMC* self,
- INTVAL value, PMC *dest)
+bigint_bitwise_shr_bigint_int(PARROT_INTERP, PMC* self, INTVAL value, PMC *dest)
{
real_exception(interp, NULL, E_LibraryNotLoadedError,
"no bigint lib loaded");
View
11 src/pmc/class.pmc
@@ -92,7 +92,8 @@ An empty ResizablePMCArray PMC is allocated during initialization.
/* This function builds the attribute index (table to map class name and
* attribute name to an index) for the current class. */
static void
-build_attrib_index(Parrot_Interp interp, PMC *self) {
+build_attrib_index(PARROT_INTERP, PMC *self)
+{
Parrot_Class * const _class = PARROT_CLASS(self);
int cur_index = 0;
PMC * const table = pmc_new(interp, enum_class_Hash);
@@ -152,7 +153,8 @@ build_attrib_index(Parrot_Interp interp, PMC *self) {
*/
static void
-fail_if_type_exists(Interp *interp, PMC *name) {
+fail_if_type_exists(PARROT_INTERP, PMC *name)
+{
INTVAL type;
PMC * const classname_hash = interp->class_hash;
@@ -182,7 +184,7 @@ fail_if_type_exists(Interp *interp, PMC *name) {
* allows the new object metamodel to interact with the old one until it does.
*/
static INTVAL
-register_type(Parrot_Interp interp, PMC *name) {
+register_type(PARROT_INTERP, PMC *name) {
INTVAL type;
PMC *classname_hash, *item;
@@ -216,7 +218,8 @@ register_type(Parrot_Interp interp, PMC *name) {
/* Takes a hash and initializes the class based on it. */
static void
-init_class_from_hash(Parrot_Interp interp, PMC *self, PMC *info) {
+init_class_from_hash(PARROT_INTERP, PMC *self, PMC *info)
+{
Parrot_Class *_class = PARROT_CLASS(self);
STRING *name_str = string_from_cstring(interp, "name", 4);
STRING *parents_str = string_from_cstring(interp, "parents", 7);
View
6 src/pmc/complex.pmc
@@ -197,7 +197,7 @@ complex_locate_keyed_num(Interp* interp, PMC* self, STRING *key) {
}
static void
-int_check_divide_zero(Interp *interp, INTVAL value)
+int_check_divide_zero(PARROT_INTERP, INTVAL value)
{
if (value == 0) {
real_exception(interp, NULL, E_ZeroDivisionError,
@@ -206,7 +206,7 @@ int_check_divide_zero(Interp *interp, INTVAL value)
}
static void
-float_check_divide_zero(Interp *interp, FLOATVAL value)
+float_check_divide_zero(PARROT_INTERP, FLOATVAL value)
{
if (value == 0.0) {
real_exception(interp, NULL, E_ZeroDivisionError,
@@ -215,7 +215,7 @@ float_check_divide_zero(Interp *interp, FLOATVAL value)
}
static void
-complex_check_divide_zero(Interp *interp, PMC *value)
+complex_check_divide_zero(PARROT_INTERP, PMC *value)
{
/* Throw an exception if we are dividing by zero. */
if (RE(value) == 0.0 && IM(value) == 0.0) {
View
24 src/pmc/default.pmc
@@ -30,7 +30,7 @@ generated from F<vtable.tbl> by F<tools/build/pmc2c.pl>.
/*
-=item C<static const char *caller(Interp *interp, PMC *pmc)>
+=item C<static const char *caller(PARROT_INTERP, PMC *pmc)>
Returns a C string for the name of C<*pmc>.
@@ -39,15 +39,15 @@ Returns a C string for the name of C<*pmc>.
*/
static const char *
-caller(Interp *interp, PMC *pmc /*NULLOK*/)
+caller(PARROT_INTERP, PMC *pmc /*NULLOK*/)
{
return pmc && pmc->vtable && pmc->vtable->whoami ?
VTABLE_name(interp, pmc)->strstart : "(null)";
}
/*
-=item C<static void cant_do_method(Interp *interp, PMC * pmc,
+=item C<static void cant_do_method(PARROT_INTERP, PMC * pmc,
const char *methname)>
Throws an exception "$methname() not implemented in class '$class'", used by
@@ -58,7 +58,7 @@ all unimplemented messages.
*/
static void
-cant_do_method(Interp *interp, PMC *pmc /*NULLOK*/, const char *methname)
+cant_do_method(PARROT_INTERP, PMC *pmc /*NULLOK*/, const char *methname)
{
real_exception(interp, NULL, ILL_INHERIT,
"%s() not implemented in class '%s'", methname,
@@ -68,7 +68,7 @@ cant_do_method(Interp *interp, PMC *pmc /*NULLOK*/, const char *methname)
/*
=item C<static INTVAL
-check_set_std_props(Interp *interp, PMC *pmc, STRING *key, PMC *value)>
+check_set_std_props(PARROT_INTERP, PMC *pmc, STRING *key, PMC *value)>
Called from C<setprop()>.
@@ -81,7 +81,7 @@ in a future call to C<propagate_std_props()>
*/
static INTVAL
-check_set_std_props(Interp *interp, PMC *pmc, STRING *key, PMC *value)
+check_set_std_props(PARROT_INTERP, PMC *pmc, STRING *key, PMC *value)
{
/* the quick hack below cannot be used because the string could
be constructed in an interpreter that is later destroyed */
@@ -127,7 +127,7 @@ check_set_std_props(Interp *interp, PMC *pmc, STRING *key, PMC *value)
/*
=item C<static void
-propagate_std_props(Interp *interp, PMC *self, PMC *prop_hash)>
+propagate_std_props(PARROT_INTERP, PMC *self, PMC *prop_hash)>
Set pending standard properties in C<prop_hash>.
@@ -136,7 +136,7 @@ Set pending standard properties in C<prop_hash>.
*/
static void
-propagate_std_props(Interp *interp, PMC *self, PMC *prop_hash) {
+propagate_std_props(PARROT_INTERP, PMC *self, PMC *prop_hash) {
if (self->vtable->flags & (VTABLE_IS_CONST_FLAG | VTABLE_IS_READONLY_FLAG)){
PMC * const pmc_true = pmc_new(interp, enum_class_Integer);
PMC_int_val(pmc_true) = 1;
@@ -168,7 +168,7 @@ has_pending_std_props(PMC *self) {
/*
=item C<static PMC*
-check_get_std_props(Interp *interpeter, PMC *self, STRING *key)>
+check_get_std_props(PARROT_INTERPeter, PMC *self, STRING *key)>
Checks if we can infer the value of C<key> property from C<self> without
looking at its prophash. Returns C<PMCNULL> if not, returns the value otherwise.
@@ -177,7 +177,7 @@ looking at its prophash. Returns C<PMCNULL> if not, returns the value otherwise.
*/
static PMC*
-check_get_std_props(Interp *interp, PMC *self, STRING *key) {
+check_get_std_props(PARROT_INTERP, PMC *self, STRING *key) {
if ((self->vtable->flags & (VTABLE_IS_CONST_FLAG | VTABLE_IS_READONLY_FLAG))
&&!string_compare(interp, key,
string_from_cstring(interp, "_ro", 3))) {
@@ -192,7 +192,7 @@ check_get_std_props(Interp *interp, PMC *self, STRING *key) {
/*
=item C<static PMC *
-make_prop_hash(Interp *interp, PMC *self)>
+make_prop_hash(PARROT_INTERP, PMC *self)>
Create a property hash for C<self>. Returns the created hash. Inferred
properties will be added to the hash and it will be set as
@@ -203,7 +203,7 @@ C<PMC_metadata(self)>.
*/
static PMC*
-make_prop_hash(Interp *interp, PMC *self) {
+make_prop_hash(PARROT_INTERP, PMC *self) {
PMC *prop;
if (!self->pmc_ext)
View
18 src/pmc/delegate.pmc
@@ -34,7 +34,7 @@ let flow through.
*/
static void
-vtable_meth_not_found(Interp *interp, PMC *pmc, const char *meth)
+vtable_meth_not_found(PARROT_INTERP, PMC *pmc, const char *meth)
{
char *_class;
@@ -75,22 +75,22 @@ useful defaults and don't throw exceptions.
*/
void init() {
- STRING *meth = CONST_STRING(interp, "init");
- PMC *sub = Parrot_find_vtable_meth(INTERP, SELF, meth);
+ STRING* const meth = CONST_STRING(interp, "init");
+ PMC* const sub = Parrot_find_vtable_meth(INTERP, SELF, meth);
if (!PMC_IS_NULL(sub))
Parrot_run_meth_fromc(interp, sub, SELF, meth);
}
void init_pmc(PMC* initializer) {
- STRING *meth = CONST_STRING(interp, "init_pmc");
- PMC *sub = Parrot_find_vtable_meth(INTERP, SELF, meth);
+ STRING* const meth = CONST_STRING(interp, "init_pmc");
+ PMC* const sub = Parrot_find_vtable_meth(INTERP, SELF, meth);
if (!PMC_IS_NULL(sub))
Parrot_run_meth_fromc_args(interp, sub, pmc, meth, "vP", initializer);
}
PMC* instantiate(PMC* sig) {
- STRING *meth = CONST_STRING(interp, "instantiate");
- PMC *sub = Parrot_find_vtable_meth(INTERP, SELF, meth);
+ STRING* const meth = CONST_STRING(interp, "instantiate");
+ PMC* const sub = Parrot_find_vtable_meth(INTERP, SELF, meth);
if (PMC_IS_NULL(sub))
return SUPER(sig);
return (PMC*) Parrot_run_meth_fromc(INTERP, sub, SELF, meth);
@@ -138,8 +138,8 @@ Invokes a subroutine.
*/
opcode_t* invoke(void *next) {
- STRING *meth = CONST_STRING(interp, "invoke");
- PMC *sub = Parrot_find_vtable_meth(INTERP, SELF, meth);
+ STRING* const meth = CONST_STRING(interp, "invoke");
+ PMC* const sub = Parrot_find_vtable_meth(INTERP, SELF, meth);
if (PMC_IS_NULL(sub))
vtable_meth_not_found(INTERP, SELF, "invoke");
INTERP->current_object = SELF;
View
9 src/pmc/eval.pmc
@@ -22,7 +22,7 @@ evaluation and execution.
#include "parrot/parrot.h"
static void
-clear_fixups(Interp *interp, Parrot_sub *sub_data)
+clear_fixups(PARROT_INTERP, Parrot_sub *sub_data)
{
opcode_t i, ci;
PackFile_ByteCode *seg;
@@ -55,7 +55,7 @@ clear_fixups(Interp *interp, Parrot_sub *sub_data)
}
static PMC*
-get_sub(Interp *interp, PMC* self, int idx)
+get_sub(PARROT_INTERP, PMC* self, int idx)
{
opcode_t i, n, ci;
PackFile_ByteCode *seg;
@@ -86,15 +86,14 @@ get_sub(Interp *interp, PMC* self, int idx)
}
static void
-mark_subs(Interp *interp, PMC* self)
+mark_subs(PARROT_INTERP, PMC* self)
{
opcode_t i, ci;
- PackFile_ByteCode *seg;
PackFile_FixupTable *ft;
PackFile_ConstTable *ct;
PMC *sub;
+ PackFile_ByteCode * const seg = PMC_sub(self)->seg;
- seg = PMC_sub(self)->seg;
if (!seg)
return;
ft = seg->fixups;
View
2 src/pmc/exception_handler.pmc
@@ -24,7 +24,7 @@ exception object's C<_P5> attribute.
#include "parrot/oplib/ops.h"
static opcode_t *
-pass_exception_args(Interp *interp, const char *sig,
+pass_exception_args(PARROT_INTERP, const char *sig,
opcode_t *dest, parrot_context_t * old_ctx, ...)
{
va_list ap;
View
6 src/pmc/fixedbooleanarray.pmc
@@ -31,14 +31,14 @@ PMC>.
#define BITS_PER_CHAR 8
static void
-booleanarray_init(Interp *interp, PMC *self) {
+booleanarray_init(PARROT_INTERP, PMC *self) {
PMC_int_val(self) = 0;
PMC_int_val2(self) = 0;
PMC_data(self) = NULL;
}
static void
-booleanarray_clone(Interp *interp, PMC *self, PMC *dest) {
+booleanarray_clone(PARROT_INTERP, PMC *self, PMC *dest) {
PMC_int_val(dest) = PMC_int_val(self);
PMC_int_val2(dest) = PMC_int_val2(self);
if (PMC_data(self)) {
@@ -51,7 +51,7 @@ booleanarray_clone(Interp *interp, PMC *self, PMC *dest) {
}
static void
-booleanarray_clear(Interp *interp, PMC *self) {
+booleanarray_clear(PARROT_INTERP, PMC *self) {
PMC_int_val(self) = 0;
PMC_int_val2(self) = 0;
if (PMC_data(self)) {
View
6 src/pmc/fixedpmcarray.pmc
@@ -34,10 +34,10 @@ swap(void **x, void **y)
*y = t;
}
-typedef INTVAL(*sort_func_t)(Interp *, void*, void*);
+typedef INTVAL(*sort_func_t)(PARROT_INTERP, void*, void*);
static INTVAL
-COMPARE(Interp *interp, void *a, void *b, PMC *cmp)
+COMPARE(PARROT_INTERP, void *a, void *b, PMC *cmp)
{
if (PMC_IS_NULL(cmp))
return mmd_dispatch_i_pp(interp, (PMC *)a, (PMC *)b, MMD_CMP);
@@ -51,7 +51,7 @@ COMPARE(Interp *interp, void *a, void *b, PMC *cmp)
}
static void
-quicksort(Interp *interp, void **data, UINTVAL n, PMC *cmp)
+quicksort(PARROT_INTERP, void **data, UINTVAL n, PMC *cmp)
{
UINTVAL i, j, ln, rn;
View
20 src/pmc/hash.pmc
@@ -24,7 +24,7 @@ These are the vtable functions for the Hash PMC.
/*
-=item C<static PMC * get_integer_pmc(Interp *interp, INTVAL base_type )>
+=item C<static PMC * get_integer_pmc(PARROT_INTERP, INTVAL base_type )>
Lookup the PMC type which is used for storing native integers.
@@ -34,7 +34,7 @@ TODO: PMCs extending Hash should probably register themselves.
*/
-static PMC* get_integer_pmc(Interp *interp, INTVAL base_type) {
+static PMC* get_integer_pmc(PARROT_INTERP, INTVAL base_type) {
return pmc_new(interp,
Parrot_get_ctx_HLL_type(interp, enum_class_Integer));
@@ -43,7 +43,7 @@ static PMC* get_integer_pmc(Interp *interp, INTVAL base_type) {
/*
-=item C<static PMC * get_number_pmc(Interp *interp, INTVAL base_type )>
+=item C<static PMC * get_number_pmc(PARROT_INTERP, INTVAL base_type )>
Lookup the PMC type which is used for floating point numbers.
@@ -53,15 +53,15 @@ TODO: PMCs extending Hash should probably register themselves.
*/
-static PMC * get_number_pmc(Interp *interp, INTVAL base_type) {
+static PMC * get_number_pmc(PARROT_INTERP, INTVAL base_type) {
return pmc_new(interp,
Parrot_get_ctx_HLL_type(interp, enum_class_Float));
}
/*
-=item C<static PMC * get_string_pmc(Interp *interp, INTVAL base_type )>
+=item C<static PMC * get_string_pmc(PARROT_INTERP, INTVAL base_type )>
Lookup the PMC type which is used for storing strings.
@@ -71,7 +71,7 @@ TODO: PMCs extending Hash should probably register themselves.
*/
-static PMC * get_string_pmc(Interp *interp, INTVAL base_type) {
+static PMC * get_string_pmc(PARROT_INTERP, INTVAL base_type) {
return pmc_new(interp,
Parrot_get_ctx_HLL_type(interp, enum_class_String));
@@ -80,21 +80,19 @@ static PMC * get_string_pmc(Interp *interp, INTVAL base_type) {
/*
-=item C<static STRING* make_hash_key(Interp *interp, PMC *key)>
+=item C<static STRING* make_hash_key(PARROT_INTERP, PMC *key)>
Returns a Parrot string for C<*key>.
=cut
*/
-static STRING* make_hash_key(Interp *interp, PMC * key)
+static STRING* make_hash_key(PARROT_INTERP, NOTNULL(PMC *key))
{
- if (key == NULL) {
+ if (key == NULL)
real_exception(interp, NULL, E_KeyError,
"Hash: Cannot use NULL key");
- return NULL;
- }
return key_string(interp, key);
}
View
8 src/pmc/integer.pmc
@@ -24,12 +24,12 @@ register.
#include <assert.h>
/* XXX create MMD headers to in Pmc2c.pm */
-extern INTVAL Parrot_BigInt_is_equal_BigInt(Interp*, PMC*, PMC*);
-extern PMC* Parrot_BigInt_multiply_int(Interp *interp,
+extern INTVAL Parrot_BigInt_is_equal_BigInt(PARROT_INTERP, PMC*, PMC*);
+extern PMC* Parrot_BigInt_multiply_int(PARROT_INTERP,
PMC* pmc, INTVAL value, PMC* dest) ;
static PMC*
-overflow(Interp *interp, PMC *self, INTVAL b, PMC *dest, int mmd)
+overflow(PARROT_INTERP, PMC *self, INTVAL b, PMC *dest, int mmd)
{
const INTVAL a = VTABLE_get_integer(interp, self);
@@ -50,7 +50,7 @@ overflow(Interp *interp, PMC *self, INTVAL b, PMC *dest, int mmd)
}
static PMC*
-overflow_p(Interp *interp, PMC *self, PMC *val, PMC *dest, int mmd)
+overflow_p(PARROT_INTERP, PMC *self, PMC *val, PMC *dest, int mmd)
{
const INTVAL a = VTABLE_get_integer(interp, self);
View
2 src/pmc/lexinfo.pmc
@@ -23,7 +23,7 @@ These are the vtable functions for the lexinfo PMC.
#include "pmc_hash.h"
static size_t
-key_hash_STRING(Interp *interp, void *value, size_t seed)
+key_hash_STRING(PARROT_INTERP, void *value, size_t seed)
{
STRING * const s = (STRING *)value;
View
4 src/pmc/multiarray.pmc
@@ -37,15 +37,15 @@ array creation.
/*
-=item C<static INTVAL calc_offset(Interp *interp, List *list, PMC *key)>
+=item C<static INTVAL calc_offset(PARROT_INTERP, List *list, PMC *key)>
Calculates the offset for C<*key>.
=cut
*/
-static INTVAL calc_offset(Interp *interp, List*list, PMC *key)
+static INTVAL calc_offset(PARROT_INTERP, List*list, PMC *key)
{
INTVAL l;
INTVAL ninj;
View
2 src/pmc/nci.pmc
@@ -151,7 +151,7 @@ shifted down.
*/
opcode_t* invoke(void * next) {
- typedef INTVAL(*nci_sub_t)(Interp * , PMC *);
+ typedef INTVAL(*nci_sub_t)(PARROT_INTERP, PMC *);
nci_sub_t func = PObj_flag_TEST(private2, SELF)
? (nci_sub_t) PMC_struct_val(SELF)
: (nci_sub_t) D2FPTR(PMC_data(SELF));
View
3 src/pmc/object.pmc
@@ -24,7 +24,8 @@ Implements an instance of a class.
/* This finds the index of an attribute in an object's attribute store and
* returns it. Returns -1 if the attribute does not exist. */
static INTVAL
-get_attrib_index(Parrot_Interp interp, PMC *self, STRING *name) {
+get_attrib_index(PARROT_INTERP, PMC *self, STRING *name)
+{
Parrot_Class * const _class = PARROT_CLASS(self);
int num_classes, i;
View
6 src/pmc/parrotthread.pmc
@@ -59,7 +59,7 @@ stop_GC(Interp* parent, Interp *thread)
coke's]
*/
-static INTVAL do_thread_run(Interp *interp, PMC *thread,
+static INTVAL do_thread_run(PARROT_INTERP, PMC *thread,
INTVAL clone_flags, PMC *sub, PMC *args) {
INTVAL tid;
@@ -76,7 +76,7 @@ static INTVAL do_thread_run(Interp *interp, PMC *thread,
return tid;
}
-static INTVAL do_thread_run_clone_default(Interp *interp,
+static INTVAL do_thread_run_clone_default(PARROT_INTERP,
PMC *thread, PMC *sub, PMC *args) {
return do_thread_run(interp, thread, PARROT_CLONE_DEFAULT, sub, args);
}
@@ -101,7 +101,7 @@ Equivalent to calling run with PARROT_CLONE_DEFAULT.
*/
void class_init() {
- int typ = enum_class_ParrotThread;
+ const int typ = enum_class_ParrotThread;
if (pass) {
register_nci_method(INTERP, typ,
View
8 src/pmc/sarray.pmc
@@ -178,7 +178,7 @@ ret_pmc(Interp* interp, const HashEntry *e)
/*
=item C<static PARROT_INLINE HashEntry *
-shift_entry(Interp *interp, PMC *self)>
+shift_entry(PARROT_INTERP, PMC *self)>
Removes and returns the first element from the array.
@@ -187,7 +187,7 @@ Removes and returns the first element from the array.
*/
static PARROT_INLINE HashEntry *
-shift_entry(Interp *interp, PMC *self)
+shift_entry(PARROT_INTERP, PMC *self)
{
HashEntry * const e = (HashEntry *) PMC_data(self);
HashEntry *ret;
@@ -208,7 +208,7 @@ shift_entry(Interp *interp, PMC *self)
/*
=item C<static PARROT_INLINE HashEntry *
-get_entry(Interp *interp, PMC *self, INTVAL key)>
+get_entry(PARROT_INTERP, PMC *self, INTVAL key)>
Returns the element for index C<key>.
@@ -217,7 +217,7 @@ Returns the element for index C<key>.
*/
static PARROT_INLINE HashEntry*
-get_entry(Interp *interp, PMC *self, INTVAL key)
+get_entry(PARROT_INTERP, PMC *self, INTVAL key)
{
HashEntry *e = (HashEntry *) PMC_data(self);
const INTVAL start_index = UVal_int(e[0].val);
View
6 src/pmc/scalar.pmc
@@ -1,5 +1,5 @@
/*
-Copyright (C) 2001-2006, The Perl Foundation.
+Copyright (C) 2001-2007, The Perl Foundation.
$Id$
=head1 NAME
@@ -22,10 +22,10 @@ These are the vtable functions for the scalar base PMC class
/* XXX This should be declared in a .h file somewhere */
extern PMC *
-Parrot_BigInt_bitwise_shl_int(Interp *interp, PMC* pmc, INTVAL value, PMC* dest);
+Parrot_BigInt_bitwise_shl_int(PARROT_INTERP, PMC* pmc, INTVAL value, PMC* dest);
static PMC *
-bitwise_left_shift_internal(Interp *interp, PMC *self,
+bitwise_left_shift_internal(PARROT_INTERP, PMC *self,
PMC *dest, INTVAL shift_amount)
{
/* This handles both left and right shifts; the sign of shift_amount
View
10 src/pmc/slice.pmc
@@ -50,7 +50,7 @@ structures.
*
*/
static void
-set_slice_start(Interp *interp, PMC *self, PMC *key, PMC *agg)
+set_slice_start(PARROT_INTERP, PMC *self, PMC *key, PMC *agg)
{
parrot_range_t *range = mem_allocate_typed(parrot_range_t);
@@ -158,9 +158,9 @@ range_end:
* next range PMC in Key chain
*/
static void
-set_slice_next(Interp *interp, PMC *self, PMC *agg)
+set_slice_next(PARROT_INTERP, PMC *self, PMC *agg)
{
- parrot_range_t *r = (parrot_range_t *)PMC_struct_val(self);
+ parrot_range_t * const r = (parrot_range_t *)PMC_struct_val(self);
if (!r || (INTVAL) r == -1)
real_exception(interp, NULL, E_StopIteration, "StopIteration");
@@ -186,8 +186,8 @@ next_range:
}
}
else {
- STRING *cur = RVal_str(r->cur);
- STRING *end = RVal_str(r->end);
+ STRING * const cur = RVal_str(r->cur);
+ STRING * const end = RVal_str(r->end);
if (string_compare(interp, cur, end) < 0)
RVal_str(r->cur) = string_increment(interp, cur);
View
57 src/pmc/unmanagedstruct.pmc
@@ -27,14 +27,13 @@ bounds access will very likely segfault.
#include <assert.h>
-static INTVAL key_2_idx(Interp *interp, PMC *pmc, PMC *key);
-static size_t calc_offsets(Interp *interp, PMC*,
- PMC *init, size_t toff);
+static INTVAL key_2_idx(PARROT_INTERP, PMC *pmc, PMC *key);
+static size_t calc_offsets(PARROT_INTERP, PMC*, PMC *init, size_t toff);
/*
=item C<static char *
-char_offset_int(Interp *interp, PMC *pmc, INTVAL ix, int *type)>
+char_offset_int(PARROT_INTERP, PMC *pmc, INTVAL ix, int *type)>
Returns the pointer for the element at index C<ix>, and sets the element
type in C<*type>.
@@ -44,7 +43,7 @@ type in C<*type>.
*/
static char *
-char_offset_int(Interp *interp, PMC *pmc, INTVAL ix, int *type)
+char_offset_int(PARROT_INTERP, PMC *pmc, INTVAL ix, int *type)
{
size_t offs, n;
ix *= 3;
@@ -68,7 +67,7 @@ char_offset_int(Interp *interp, PMC *pmc, INTVAL ix, int *type)
/*
=item C<static INTVAL
-key_2_idx(Interp *interp, PMC *pmc, PMC *key)>
+key_2_idx(PARROT_INTERP, PMC *pmc, PMC *key)>
Returns the index for the element associated with key C<*key>. Raises an
exception if the key doesn't exist.
@@ -78,7 +77,7 @@ exception if the key doesn't exist.
*/
static INTVAL
-key_2_idx(Interp *interp, PMC *pmc, PMC *key)
+key_2_idx(PARROT_INTERP, PMC *pmc, PMC *key)
{
int ix;
ix = 0;
@@ -110,7 +109,7 @@ key_2_idx(Interp *interp, PMC *pmc, PMC *key)
/*
=item C<static char *
-char_offset_key(Interp *interp, PMC *pmc, PMC *key, int *type)>
+char_offset_key(PARROT_INTERP, PMC *pmc, PMC *key, int *type)>
Returns the pointer for the element associated with key C<*key>, and
sets the element type in C<*type>.
@@ -120,7 +119,7 @@ sets the element type in C<*type>.
*/
static char *
-char_offset_key(Interp *interp, PMC *pmc, PMC *key, int *type)
+char_offset_key(PARROT_INTERP, PMC *pmc, PMC *key, int *type)
{
size_t offs, count, size, max;
PMC *next, *init;
@@ -204,7 +203,7 @@ char_offset_key(Interp *interp, PMC *pmc, PMC *key, int *type)
/*
=item C<static INTVAL
-ret_int(Interp *interp, const char *p, int type)>
+ret_int(PARROT_INTERP, const char *p, int type)>
Returns the element of type C<type> starting at C<*p> as an C<INTVAL>.
@@ -216,11 +215,11 @@ we need some more configure support for type sizes.
*/
static INTVAL
-ret_int(Interp *interp, const char *p, int type)
+ret_int(PARROT_INTERP, const char *p, int type)
__attribute__nonnull__(1);
static INTVAL
-ret_int(Interp *interp, const char *p, int type)
+ret_int(PARROT_INTERP, const char *p, int type)
{
switch (type) {
case enum_type_INTVAL:
@@ -267,7 +266,7 @@ ret_int(Interp *interp, const char *p, int type)
/*
=item C<static FLOATVAL
-ret_float(Interp *interp, const char *p, int type)>
+ret_float(PARROT_INTERP, const char *p, int type)>
Returns the element of type C<type> starting at C<*p> as a C<FLOATVAL>.
@@ -276,11 +275,11 @@ Returns the element of type C<type> starting at C<*p> as a C<FLOATVAL>.
*/
static FLOATVAL
-ret_float(Interp *interp, const char *p, int type)
+ret_float(PARROT_INTERP, const char *p, int type)
__attribute__nonnull__(1);
static FLOATVAL
-ret_float(Interp *interp, const char *p, int type)
+ret_float(PARROT_INTERP, const char *p, int type)
{
switch (type) {
case enum_type_FLOATVAL:
@@ -298,7 +297,7 @@ ret_float(Interp *interp, const char *p, int type)
/*
=item C<static STRING*
-ret_string(Interp *interp, char *p, int type)>
+ret_string(PARROT_INTERP, char *p, int type)>
Returns the element of type C<type> starting at C<*p> as a Parrot string.
@@ -307,7 +306,7 @@ Returns the element of type C<type> starting at C<*p> as a Parrot string.
*/
static STRING*
-ret_string(Interp *interp, char *p, int type)
+ret_string(PARROT_INTERP, char *p, int type)
{
char *cstr;
size_t len;
@@ -328,7 +327,7 @@ ret_string(Interp *interp, char *p, int type)
/*
=item C<static PMC*
-ret_pmc(Interp *interp, PMC* pmc, char *p, int type, INTVAL idx)>
+ret_pmc(PARROT_INTERP, PMC* pmc, char *p, int type, INTVAL idx)>
Returns the element of type C<type> starting at C<*p> as a PMC.
@@ -337,7 +336,7 @@ Returns the element of type C<type> starting at C<*p> as a PMC.
*/
static PMC*
-ret_pmc(Interp *interp, PMC* pmc, char *p, int type, INTVAL idx)
+ret_pmc(PARROT_INTERP, PMC* pmc, char *p, int type, INTVAL idx)
{
PMC *ret = NULL, *init, *ptr;
@@ -392,14 +391,14 @@ ret_pmc(Interp *interp, PMC* pmc, char *p, int type, INTVAL idx)
/*
=item C<static void
-set_int(Interp *interp, char *p, int type, INTVAL value)>
+set_int(PARROT_INTERP, char *p, int type, INTVAL value)>
=cut
*/
static void
-set_int(Interp *interp, char *p, int type, INTVAL value)
+set_int(PARROT_INTERP, char *p, int type, INTVAL value)
{
switch (type) {
case enum_type_uint8:
@@ -428,7 +427,7 @@ set_int(Interp *interp, char *p, int type, INTVAL value)
/*
=item C<static void
-set_float(Interp *interp, char *p, int type, FLOATVAL value)>
+set_float(PARROT_INTERP, char *p, int type, FLOATVAL value)>
Sets the value of the element of type C<type> starting at C<*p> to
C<value>.
@@ -438,7 +437,7 @@ C<value>.
*/
static void
-set_float(Interp *interp, char *p, int type, FLOATVAL value)
+set_float(PARROT_INTERP, char *p, int type, FLOATVAL value)
{
switch (type) {
case enum_type_FLOATVAL:
@@ -459,7 +458,7 @@ set_float(Interp *interp, char *p, int type, FLOATVAL value)
/*
=item C<static void
-set_string(Interp *interp, char *p, int type, STRING *value)>
+set_string(PARROT_INTERP, char *p, int type, STRING *value)>
Sets the value of the element of type C<type> starting at C<*p> to
C<*value>.
@@ -469,7 +468,7 @@ C<*value>.
*/
static void
-set_string(Interp *interp, char *p, int type, STRING* value)
+set_string(PARROT_INTERP, char *p, int type, STRING* value)
{
char *cstr;
switch (type) {
@@ -489,7 +488,7 @@ set_string(Interp *interp, char *p, int type, STRING* value)
/*
=item C<static int
-calc_align(Interp *interp, PMC *pmc, PMC *type_pmc,
+calc_align(PARROT_INTERP, PMC *pmc, PMC *type_pmc,
int type, int offs)>
Alignment of contained structures is the alignment of the
@@ -504,7 +503,7 @@ This is recursive as structure definitions.
*/
static int
-calc_align(Interp *interp, PMC* pmc, PMC* type_pmc,
+calc_align(PARROT_INTERP, PMC* pmc, PMC* type_pmc,
int type, int offs)
{
int align = data_types[type - enum_first_type].size;
@@ -555,7 +554,7 @@ calc_align(Interp *interp, PMC* pmc, PMC* type_pmc,
/*
=item C<static size_t
-calc_offsets(Interp *interp, PMC *pmc, PMC *value, size_t toff)>
+calc_offsets(PARROT_INTERP, PMC *pmc, PMC *value, size_t toff)>
Calculates the offsets for the C<struct>. See C<init_pmc()> for a
description of C<*value>.
@@ -565,7 +564,7 @@ description of C<*value>.
*/
static size_t
-calc_offsets(Interp *interp, PMC* pmc, PMC *value, size_t toff)
+calc_offsets(PARROT_INTERP, PMC* pmc, PMC *value, size_t toff)
{
size_t i, n = (size_t)VTABLE_elements(interp, value);
int size;

0 comments on commit 6fb3a51

Please sign in to comment.