NAME ^

src/pmc/cpointer.pmc - CPointer

DESCRIPTION ^

The CPointer PMC creates a PMC abstraction for a typed C pointer. It is particularly used by the CallSignature PMC, for the return values of a C-level PCC invocation using a CallSignature to pass the arguments and fetch the results.

Attributes ^

A CPointer PMC has two attributes:

pointer

A void * pointer to an integer, number, string, or PMC.

sig

A string signature for the pointer. The possible signature values follow the standard defined for PCC.

  I   a Parrot integer (INTVAL)
  N   a Parrot number  (FLOATVAL)
  S   a Parrot string  (STRING *)
  P   a Parrot object  (PMC *)

Vtable Functions ^

These are the vtable functions for the CPointer class.

void init()

Initializes the pointer object.

void mark()

Marks the signature as live. Also marks a STRING or PMC pointed to by the pointer.

void destroy()

Destroys the PMC and frees all allocated memory.

PMC *clone()

Creates and returns a clone of the pointer.

void *get_pointer()

Returns the pointer.

void set_pointer(void *)

Sets the pointer.

STRING *get_string_keyed_str(STRING *key)

Returns the string signature.

void set_string_keyed_str(STRING *key, STRING *value)

Sets the string signature.

INTVAL get_integer()

Returns the integer value that the pointer points to (if the pointer is to an integer or PMC).

void set_integer_native(INTVAL value)

Sets the integer value that the pointer points to (if the pointer is to an integer or PMC).

FLOATVAL get_number()

Returns the floating point value that the pointer points to (if the pointer is to a number or PMC).

void set_number_native(FLOATVAL value)

Sets the floating point value that the pointer points to (if the pointer is to a number or PMC).

STRING *get_string()

Returns the Parrot string value that the pointer points to (if the pointer is to a string or PMC).

void set_string_native(STRING *value)

Sets the Parrot string value that the pointer points to (if the pointer is to a string or PMC).

PMC *get_pmc()

Returns the PMC value that the pointer points to (if the pointer is to a PMC).

void set_pmc(PMC *value)

Sets the PMC value that the pointer points to (if the pointer is to a PMC).

INTVAL get_bool()

Returns whether the pointer is not NULL.

INTVAL is_same(PMC *pmc2)

Returns whether the pointer has the same value as *pmc2.


parrot