<commit_before>#ifndef __SIEGE_GRAPHICS_TURTLE_H__
#define __SIEGE_GRAPHICS_TURTLE_H__

#include "../common.h"

#include <stdlib.h>

#ifdef __cplusplus
extern "C"
{
#endif // __cplusplus

/**
    \private
    \brief The state of the turtle, for use with saving/loading SGTurtle states
    \warning
        For internal use only.
*/
typedef struct SGTurtleState
{
    /**
        \private
        \brief Turtle's horizontal position
        \warning
            For internal use only.
    */
    float x;
    /**
        \private
        \brief Turtle's vertical position
        \warning
            For internal use only.
    */
    float y;
    /**
        \private
        \brief Turtle's angle, in radians
        \warning
            For internal use only.
    */
    float angle;
    /**
        \private
        \brief Turtle's pen state
        \warning
            For internal use only.
    */
    SGbool draw;
} SGTurtleState;

/**
    \brief A turtle, for use in turtle graphics
*/
typedef struct SGTurtle
{
    /**
        \private
        \brief Turtle's internal position stack
        \warning
            For internal use only.
    */
    SGTurtleState* stack;
    /**
        \private
        \brief The size of the turtle's stack
        \warning
            For internal use only.
    */
    size_t stacklen;

    /**
        \name States
    */
    // @{
    /**
        \private
        \brief Turtle's state at its creation

        Used in \ref sgTurtleReset "sgTurtleReset".

        \warning
            For internal use only.
    */
    SGTurtleState start;
    /**
        \private
        \brief Turtle's previous state
        \warning
            For internal use only.
    */
    SGTurtleState prev;
    /**
        \private
        \brief Turtle's current
        \warning
            For internal use only.
    */
    SGTurtleState curr;
    // @}
} SGTurtle;

SGbool SG_EXPORT _sgTurtleInit(void);
SGbool SG_EXPORT _sgTurtleDeinit(void);

// @{
/**
    \memberof SGTurtle
    \brief Create a turtle with angle in radians
    \param x Start x position
    \param y Start y position
    \param rads Start angle in radians
    \param draw The initial pen position, SG_TRUE to draw (down), SG_FALSE otherwise (up)
    \return The newly created turtle if successful, NULL otherwise.
*/
SGTurtle* SG_EXPORT sgTurtleCreateRads(float x, float y, float rads, SGbool draw);
/**
    \memberof SGTurtle
    \brief Create a turtle with angle in degrees
    \param x Start x position
    \param y Start y position
    \param degs Start angle in degrees
    \param draw The initial pen position, SG_TRUE to draw (down), SG_FALSE otherwise (up)
    \return The newly created turtle if successful, NULL otherwise.
*/
SGTurtle* SG_EXPORT sgTurtleCreateDegs(float x, float y, float degs, SGbool draw);
/**
    \memberof SGTurtle
    \brief Destroy a turtle
    \param turtle The turtle to destroy
*/
void SG_EXPORT sgTurtleDestroy(SGTurtle* turtle);
// @}

/**
    \name State
*/
// @{
/**
    \memberof SGTurtle
    \brief Reset the turtle's state to the start state
    \param turtle The turtle of which state to reset

    This function sets the turtle's state (position, angle, pen state) to what it was when the turtle was first created.
*/
void SG_EXPORT sgTurtleReset(SGTurtle* turtle);
/**
    \memberof SGTurtle
    \brief Push the turtle's state to the stack
    \param turtle The turtle of which state to push

    This function pushes the turtle's state (position, angle, pen state) onto its stack, making it available for later.

    \sa
        sgTurtlePop
*/
void SG_EXPORT sgTurtlePush(SGTurtle* turtle);
/**
    \memberof SGTurtle
    \param Pop the turtle's state off the stack and set it
    \param turtle The turtle of which state we want to pop and set

    This function gets the state on top of its stack, removes it and then sets it as the current state.

    \sa
        sgTurtlePush
*/
void SG_EXPORT sgTurtlePop(SGTurtle* turtle);
// @}<commit_msg>Minor correction in the docs<commit_after>#ifndef __SIEGE_GRAPHICS_TURTLE_H__
#define __SIEGE_GRAPHICS_TURTLE_H__

#include "../common.h"

#include <stdlib.h>

#ifdef __cplusplus
extern "C"
{
#endif // __cplusplus

/**
    \private
    \brief The state of the turtle, for use with saving/loading SGTurtle states
    \warning
        For internal use only.
*/
typedef struct SGTurtleState
{
    /**
        \private
        \brief Turtle's horizontal position
        \warning
            For internal use only.
    */
    float x;
    /**
        \private
        \brief Turtle's vertical position
        \warning
            For internal use only.
    */
    float y;
    /**
        \private
        \brief Turtle's angle, in radians
        \warning
            For internal use only.
    */
    float angle;
    /**
        \private
        \brief Turtle's pen state
        \warning
            For internal use only.
    */
    SGbool draw;
} SGTurtleState;

/**
    \brief A turtle, for use in turtle graphics
*/
typedef struct SGTurtle
{
    /**
        \private
        \brief Turtle's internal position stack
        \warning
            For internal use only.
    */
    SGTurtleState* stack;
    /**
        \private
        \brief The size of the turtle's stack
        \warning
            For internal use only.
    */
    size_t stacklen;

    /**
        \name States
    */
    // @{
    /**
        \private
        \brief Turtle's state at its creation

        Used in \ref sgTurtleReset "sgTurtleReset".

        \warning
            For internal use only.
    */
    SGTurtleState start;
    /**
        \private
        \brief Turtle's previous state
        \warning
            For internal use only.
    */
    SGTurtleState prev;
    /**
        \private
        \brief Turtle's current
        \warning
            For internal use only.
    */
    SGTurtleState curr;
    // @}
} SGTurtle;

SGbool SG_EXPORT _sgTurtleInit(void);
SGbool SG_EXPORT _sgTurtleDeinit(void);

// @{
/**
    \memberof SGTurtle
    \brief Create a turtle with angle in radians
    \param x Start x position
    \param y Start y position
    \param rads Start angle in radians
    \param draw The initial pen position, SG_TRUE to draw (down), SG_FALSE otherwise (up)
    \return The newly created turtle if successful, NULL otherwise.
*/
SGTurtle* SG_EXPORT sgTurtleCreateRads(float x, float y, float rads, SGbool draw);
/**
    \memberof SGTurtle
    \brief Create a turtle with angle in degrees
    \param x Start x position
    \param y Start y position
    \param degs Start angle in degrees
    \param draw The initial pen position, SG_TRUE to draw (down), SG_FALSE otherwise (up)
    \return The newly created turtle if successful, NULL otherwise.
*/
SGTurtle* SG_EXPORT sgTurtleCreateDegs(float x, float y, float degs, SGbool draw);
/**
    \memberof SGTurtle
    \brief Destroy a turtle
    \param turtle The turtle to destroy
*/
void SG_EXPORT sgTurtleDestroy(SGTurtle* turtle);
// @}

/**
    \name State
*/
// @{
/**
    \memberof SGTurtle
    \brief Reset the turtle's state to the start state
    \param turtle The turtle of which state to reset

    This function sets the turtle's state (position, angle, pen state) to what it was when the turtle was first created.
*/
void SG_EXPORT sgTurtleReset(SGTurtle* turtle);
/**
    \memberof SGTurtle
    \brief Push the turtle's state to the stack
    \param turtle The turtle of which state to push

    This function pushes the turtle's state (position, angle, pen state) onto its stack, making it available for later.

    \sa
        sgTurtlePop
*/
void SG_EXPORT sgTurtlePush(SGTurtle* turtle);
/**
    \memberof SGTurtle
    \brief Pop the turtle's state off the stack and set it
    \param turtle The turtle of which state we want to pop and set

    This function gets the state on top of its stack, removes it and then sets it as the current state.

    \sa
        sgTurtlePush
*/
void SG_EXPORT sgTurtlePop(SGTurtle* turtle);
// @}
{'fraction_non_alphanumeric': 0.07902963611354258, 'fraction_numerical': 0.0, 'mean_word_length': 2.1012020162853817, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '509338', 'n_tokens_mistral': 2629, 'n_tokens_neox': 2306, 'n_words': 900}