obj_ops.h#
Various object operations.
Authors#
TheSilvered
Functions#
Nst_obj_eq_c#
Synopsis:
bool Nst_obj_eq_c(Nst_Obj *ob1, Nst_Obj *ob2)
Description:
Call Nst_obj_eq making the result a C bool.
Nst_obj_ne_c#
Synopsis:
bool Nst_obj_ne_c(Nst_Obj *ob1, Nst_Obj *ob2)
Description:
Call Nst_obj_ne making the result a C bool.
Nst_obj_eq#
Synopsis:
Nst_ObjRef *Nst_obj_eq(Nst_Obj *ob1, Nst_Obj *ob2)
Description:
Implements the == operator. Is guaranteed to not fail.
Nst_obj_ne#
Synopsis:
Nst_ObjRef *Nst_obj_ne(Nst_Obj *ob1, Nst_Obj *ob2)
Description:
Implements the != operator. Is guaranteed to not fail.
Nst_obj_gt#
Synopsis:
Nst_ObjRef *Nst_obj_gt(Nst_Obj *ob1, Nst_Obj *ob2)
Description:
Implements the > operator. On failure the error is set.
Nst_obj_lt#
Synopsis:
Nst_ObjRef *Nst_obj_lt(Nst_Obj *ob1, Nst_Obj *ob2)
Description:
Implements the < operator. On failure the error is set.
Nst_obj_ge#
Synopsis:
Nst_ObjRef *Nst_obj_ge(Nst_Obj *ob1, Nst_Obj *ob2)
Description:
Implements the >= operator. On failure the error is set.
Nst_obj_le#
Synopsis:
Nst_ObjRef *Nst_obj_le(Nst_Obj *ob1, Nst_Obj *ob2)
Description:
Implements the <= operator. On failure the error is set.
Nst_obj_add#
Synopsis:
Nst_ObjRef *Nst_obj_add(Nst_Obj *ob1, Nst_Obj *ob2)
Description:
Implements the + operator. On failure the error is set.
Nst_obj_sub#
Synopsis:
Nst_ObjRef *Nst_obj_sub(Nst_Obj *ob1, Nst_Obj *ob2)
Description:
Implements the - operator. On failure the error is set.
Nst_obj_mul#
Synopsis:
Nst_ObjRef *Nst_obj_mul(Nst_Obj *ob1, Nst_Obj *ob2)
Description:
Implements the null operator. On failure the error is set.
Nst_obj_div#
Synopsis:
Nst_ObjRef *Nst_obj_div(Nst_Obj *ob1, Nst_Obj *ob2)
Description:
Implements the / operator. On failure the error is set.
Nst_obj_pow#
Synopsis:
Nst_ObjRef *Nst_obj_pow(Nst_Obj *ob1, Nst_Obj *ob2)
Description:
Implements the ^ operator. On failure the error is set.
Nst_obj_mod#
Synopsis:
Nst_ObjRef *Nst_obj_mod(Nst_Obj *ob1, Nst_Obj *ob2)
Description:
Implements the % operator. On failure the error is set.
Nst_obj_bwor#
Synopsis:
Nst_ObjRef *Nst_obj_bwor(Nst_Obj *ob1, Nst_Obj *ob2)
Description:
Implements the | operator. On failure the error is set.
Nst_obj_bwand#
Synopsis:
Nst_ObjRef *Nst_obj_bwand(Nst_Obj *ob1, Nst_Obj *ob2)
Description:
Implements the & operator. On failure the error is set.
Nst_obj_bwxor#
Synopsis:
Nst_ObjRef *Nst_obj_bwxor(Nst_Obj *ob1, Nst_Obj *ob2)
Description:
Implements the ^^ operator. On failure the error is set.
Nst_obj_bwls#
Synopsis:
Nst_ObjRef *Nst_obj_bwls(Nst_Obj *ob1, Nst_Obj *ob2)
Description:
Implements the << operator. On failure the error is set.
Nst_obj_bwrs#
Synopsis:
Nst_ObjRef *Nst_obj_bwrs(Nst_Obj *ob1, Nst_Obj *ob2)
Description:
Implements the >> operator. On failure the error is set.
Nst_obj_lgor#
Synopsis:
Nst_ObjRef *Nst_obj_lgor(Nst_Obj *ob1, Nst_Obj *ob2)
Description:
Implements the || operator. On failure the error is set.
Nst_obj_lgand#
Synopsis:
Nst_ObjRef *Nst_obj_lgand(Nst_Obj *ob1, Nst_Obj *ob2)
Description:
Implements the && operator. On failure the error is set.
Nst_obj_lgxor#
Synopsis:
Nst_ObjRef *Nst_obj_lgxor(Nst_Obj *ob1, Nst_Obj *ob2)
Description:
Implements the &| operator. On failure the error is set.
Nst_obj_neg#
Synopsis:
Nst_ObjRef *Nst_obj_neg(Nst_Obj *ob)
Description:
Implements the -: operator. On failure the error is set.
Nst_obj_len#
Synopsis:
Nst_ObjRef *Nst_obj_len(Nst_Obj *ob)
Description:
Implements the $ operator. On failure the error is set.
Nst_obj_bwnot#
Synopsis:
Nst_ObjRef *Nst_obj_bwnot(Nst_Obj *ob)
Description:
Implements the ~ operator. On failure the error is set.
Nst_obj_lgnot#
Synopsis:
Nst_ObjRef *Nst_obj_lgnot(Nst_Obj *ob)
Description:
Implements the ! operator. On failure the error is set.
Nst_obj_stdout#
Synopsis:
Nst_ObjRef *Nst_obj_stdout(Nst_Obj *ob)
Description:
Implements the >>> operator. On failure the error is set.
Nst_obj_stdin#
Synopsis:
Nst_ObjRef *Nst_obj_stdin(Nst_Obj *ob)
Description:
Implements the <<< operator. On failure the error is set.
Nst_obj_typeof#
Synopsis:
Nst_ObjRef *Nst_obj_typeof(Nst_Obj *ob)
Description:
Implements the ?:: operator. On failure the error is set.
Nst_obj_import#
Synopsis:
Nst_ObjRef *Nst_obj_import(Nst_Obj *ob)
Description:
Implements the |#| operator. On failure the error is set.
Nst_obj_to_repr_str#
Synopsis:
Nst_ObjRef *Nst_obj_to_repr_str(Nst_Obj *ob)
Description:
Cast an object to its string representation.
All objects can be casted, even custom types, but the function can still fail to allocate memory.
Parameters:
ob: the object to be casted
Returns:
The new string or NULL on failure. The error is set.
Nst_obj_cast#
Synopsis:
Nst_ObjRef *Nst_obj_cast(Nst_Obj *ob, Nst_Obj *type)
Description:
Cast an object from a type to another.
Casting an object to Bool is guaranteed to not fail. All objects can be casted
to Str but the function can still fail if a memory allocation is unsuccessful.
Parameters:
ob: the object to be castedtype: the type to cast the object to
Returns:
The casted object or NULL on failure. The error is set.
Nst_obj_contains#
Synopsis:
Nst_ObjRef *Nst_obj_contains(Nst_Obj *ob1, Nst_Obj *ob2)
Description:
Implements the <.> operator. On failure the error is set.
Nst_obj_concat#
Synopsis:
Nst_ObjRef *Nst_obj_concat(Nst_Obj *ob1, Nst_Obj *ob2)
Description:
Concatenate two objects into a string.
Both objects are casted to Str before being concatenated.
Parameters:
ob1: the first objectob2: the second object
Returns:
The result of the concatenation or NULL on failure. The error is set.
Nst_obj_range#
Synopsis:
Nst_ObjRef *Nst_obj_range(Nst_Obj *start, Nst_Obj *stop, Nst_Obj *step)
Description:
Create a range object given the start, stop and step.
Parameters:
start: the starting value of the rangestop: the the excluded stopping index of the rangestep: the step of the range
Returns:
The new range object or NULL on failure. The error is set.