Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 2696c86e86
Fetching contributors…

Cannot retrieve contributors at this time

72 lines (57 sloc) 2.085 kb
/*
* Copyright (C) 2001-2009, The Parrot Foundation.
*/
#include "parrot/cclass.h"
#include "pmc/pmc_float.h"
#include "pmc/pmc_integer.h"
static INTVAL dynpmc_TclFloat;
static INTVAL dynpmc_TclInt;
pmclass TclString
dynpmc auto_attrs
extends String
does string
group tcl_group
hll tcl
maps String
{
VTABLE void class_init() {
dynpmc_TclFloat = Parrot_pmc_get_type_str(INTERP, CONST_STRING(INTERP, "TclFloat"));
dynpmc_TclInt = Parrot_pmc_get_type_str(INTERP, CONST_STRING(INTERP, "TclInt"));
}
VTABLE void set_number_native(FLOATVAL value) {
pmc_reuse(INTERP, SELF, dynpmc_TclFloat, 0);
SETATTR_Float_fv(INTERP, SELF, value);
}
VTABLE void set_integer_native(INTVAL value) {
pmc_reuse(INTERP, SELF, dynpmc_TclInt, 0);
SETATTR_Integer_iv(INTERP, SELF, value);
}
VTABLE INTVAL get_bool() {
PMC * const _class = VTABLE_get_class(interp, SELF);
STRING * const get_bool = CONST_STRING(interp, "get_bool");
INTVAL result = -9999; /* default, should never be used */
/* Get the vtable override for 'get_bool', run that instead. */
PMC * const method = Parrot_oo_find_vtable_override_for_class(interp, _class, get_bool);
if (!PMC_IS_NULL(method)) {
Parrot_ext_call(interp, method, "Pi->I", SELF, &result);
}
return result;
}
VTABLE INTVAL get_integer() {
PMC * const _class = VTABLE_get_class(interp, SELF);
STRING * const get_integer= CONST_STRING(interp, "get_integer");
INTVAL result = -10000; /* default, should never be used */
/* Get the vtable override for 'get_integer', run that instead. */
PMC * const method = Parrot_oo_find_vtable_override_for_class(interp, _class, get_integer);
if (!PMC_IS_NULL(method)) {
Parrot_ext_call(interp, method, "Pi->I", SELF, &result);
}
return result;
}
}
/*
* Local variables:
* c-file-style: "parrot"
* End:
* vim: expandtab shiftwidth=4:
*/
Jump to Line
Something went wrong with that request. Please try again.