cmakepp_lang/types/cmakepp_type

Defines functions for manipulating a CMakePPLang object’s type.

cmakepp_lang/types/cmakepp_type._cpp_get_cmakepp_type(is_cpp_obj type obj)

Note

This is a macro, and so does not introduce a new scope.

Encapsulates the process of getting a CMakePP object’s type.

CMakePP introduces several additional built-in types as well as the ability for users to define their own types. This function encapsulates the logic to determine if an object is a CMakePP type, and if it is, how to determine that type.

Parameters:
  • is_cpp_obj (desc) – Identifier for the variable which will hold whether or not obj is a CMakePP object.

  • type (desc) – Identifier to hold the type of obj if it is indeed a CMakePP object.

  • obj (str) – The object for which we want to know if it is a CMakePP object, and if it is, what is its type.

Returns:

is_cpp_obj will be set to TRUE if obj is a CMakePP built-in type or a user-defined type and FALSE otherwise. If is_cpp_obj is TRUE than type will be set to the type of obj. If is_cpp_obj is FALSE than type will be set to the empty string.

Return type:

(bool, type) or (bool, desc)

Note

This function is used as part of the type-checking machinery and can not rely on cpp_assert_signature to check its input types. It is a macro to avoid the need to call cpp_return to forward the return.

Error Checking

_cpp_get_cmakepp_type will ensure that it was provided three arguments. If it was not provided exactly three arguments an error will be raised.

cmakepp_lang/types/cmakepp_type._cpp_set_cmakepp_type(this type)

Encapsulates the process of setting a CMakePP object’s type.

CMakePP introduces several additional built-in types as well as the ability for users to define their own types. This function encapsulates the logic for setting a CMakePP object’s type.

Note

That before calling this function the “this”-pointer will simply be a description. It is this function which makes the CMakePP runtime recognize the “this”-pointer as actually-being of the specified type.

Parameters:
  • this (desc) – The “this”-pointer for the CMakePP object we are setting the type of.

  • type (type) – The type we are making this.

Error Checking

_cpp_set_cmakepp_type will assert that it is called with exactly two arguments, and if it is not, will raise an error.