Toy 1.1.6
The Toy programming language is an imperative bytecode-intermediate embedded scripting language
Loading...
Searching...
No Matches
Data Structures | Typedefs | Functions
toy_reffunction.h File Reference

@???@ More...

#include <stddef.h>
#include "toy_common.h"

Go to the source code of this file.

Data Structures

struct  Toy_RefFunction
 

Typedefs

typedef void *(* Toy_RefFunctionAllocatorFn) (void *pointer, size_t oldSize, size_t newSize)
 @???@
 
typedef struct Toy_RefFunction Toy_RefFunction
 @???@
 

Functions

TOY_API void Toy_setRefFunctionAllocatorFn (Toy_RefFunctionAllocatorFn)
 Conforms to and is invoked by Toy's memory API, and generally shouldn't be used.
 
TOY_API Toy_RefFunction * Toy_createRefFunction (const void *data, size_t length)
 Returns a new Toy_RefFunction, containing a copy of data, or NULL on error. This function also sets the returned refFunction's reference counter to 1.
 
TOY_API void Toy_deleteRefFunction (Toy_RefFunction *refFunction)
 Reduces the refFunction's reference counter by 1 and, if it reaches 0, frees the memory.
 
TOY_API int Toy_countRefFunction (Toy_RefFunction *refFunction)
 Returns the total number of references to refFunction, for debugging.
 
TOY_API size_t Toy_lengthRefFunction (Toy_RefFunction *refFunction)
 Returns the length of the underlying bytecode of refFunction.
 
TOY_API Toy_RefFunction * Toy_copyRefFunction (Toy_RefFunction *refFunction)
 Increases the reference counter of refFunction by 1, before returning the given pointer.
 
TOY_API Toy_RefFunction * Toy_deepCopyRefFunction (Toy_RefFunction *refFunction)
 Behaves identically to Toy_copyRefFunction, except that it explicitly preforms a deep copy of the internal memory. Using this function should be done carefully, as it incurs a performance penalty that negates the benefit of this module.
 

Detailed Description

@???@

Typedef Documentation

◆ Toy_RefFunction

@???@

◆ Toy_RefFunctionAllocatorFn

void *(* Toy_RefFunctionAllocatorFn)(void *pointer, size_t oldSize, size_t newSize)

@???@

Parameters
pointer
oldSize
newSize

Function Documentation

◆ Toy_copyRefFunction()

Toy_RefFunction * Toy_copyRefFunction ( Toy_RefFunction *  refFunction)

Increases the reference counter of refFunction by 1, before returning the given pointer.

Parameters
refFunction
Returns

◆ Toy_countRefFunction()

int Toy_countRefFunction ( Toy_RefFunction *  refFunction)

Returns the total number of references to refFunction, for debugging.

Parameters
refFunction
Returns

◆ Toy_createRefFunction()

Toy_RefFunction * Toy_createRefFunction ( const void *  data,
size_t  length 
)

Returns a new Toy_RefFunction, containing a copy of data, or NULL on error. This function also sets the returned refFunction's reference counter to 1.

Parameters
data
length
Returns

◆ Toy_deepCopyRefFunction()

Toy_RefFunction * Toy_deepCopyRefFunction ( Toy_RefFunction *  refFunction)

Behaves identically to Toy_copyRefFunction, except that it explicitly preforms a deep copy of the internal memory. Using this function should be done carefully, as it incurs a performance penalty that negates the benefit of this module.

Parameters
refFunction
Returns

◆ Toy_deleteRefFunction()

void Toy_deleteRefFunction ( Toy_RefFunction *  refFunction)

Reduces the refFunction's reference counter by 1 and, if it reaches 0, frees the memory.

Parameters
refFunction

◆ Toy_lengthRefFunction()

size_t Toy_lengthRefFunction ( Toy_RefFunction *  refFunction)

Returns the length of the underlying bytecode of refFunction.

Parameters
refFunction
Returns

◆ Toy_setRefFunctionAllocatorFn()

void Toy_setRefFunctionAllocatorFn ( Toy_RefFunctionAllocatorFn  )

Conforms to and is invoked by Toy's memory API, and generally shouldn't be used.

Parameters
Toy_RefFunctionAllocatorFn