Giter Site home page Giter Site logo

xtra's Introduction

Moved to werdl/utils

xtra

C made a little easier

  • A little C library that has a load of QOL definitions

Features

  • Alt names for various operators
  • GetType method for type of value
  • Better pythpn-style casting
  • Dynamic Vectors and fixed-size matrices

Methods

Struct: XtraVector

Represents a dynamic 1D vector.

Members:

  • length: Current length of the vector.
  • max: Maximum capacity of the vector.

Function: NewXtraVector

Creates a new XtraVector instance.

Parameters:

  • maxsize: Maximum capacity of the vector (optional, defaults to 16 if not provided).

Returns: Pointer to the created XtraVector instance.

Function: XtraVectorPush

Adds an element to the end of the XtraVector.

Parameters:

  • vec: Pointer to the XtraVector instance.
  • data: Pointer to the data element to be added.

Returns: XtraVectorReturn enum indicating success or failure.

Function: XtraVectorPop

Removes and returns the last element from the XtraVector.

Parameters:

  • vec: Pointer to the XtraVector instance.

Returns: Pointer to the removed element, or NULL if the vector is empty.

Function: XtraVectorIndex

Returns the element at the specified index in the XtraVector.

Parameters:

  • vec: Pointer to the XtraVector instance.
  • index: Index of the element to retrieve.

Returns: Pointer to the element at the specified index, or NULL if the index is out of bounds.

Function: XtraVectorDelete

Deletes the XtraVector and frees the associated memory.

Parameters:

  • vec: Pointer to the XtraVector instance.

Function: XtraVectorDelEl

Creates a new XtraVector without the specified element.

Parameters:

  • vec: Pointer to the XtraVector instance.
  • el: Index of the element to be removed.

Returns: Pointer to the new XtraVector instance.

Function: XtraVectorChangeEl

Creates a new XtraVector with the specified element replaced.

Parameters:

  • vec: Pointer to the XtraVector instance.
  • el: Index of the element to be replaced.
  • data: Pointer to the new data element.

Returns: Pointer to the new XtraVector instance.

Struct: XtraVector2D

Represents a dynamic 2D vector.

Members:

  • CurrWidth: Current width of the vector.
  • CurrLength: Current length of the vector.

Function: NewXtraVector2D

Creates a new XtraVector2D instance.

Parameters:

  • max_width: Maximum width of the vector (optional, defaults to 16 if not provided).
  • max_length: Maximum length of the vector (optional, defaults to 16 if not provided).

Returns: Pointer to the created XtraVector2D instance.

Function: XtraVector2DPush

Adds an element to the specified row in the XtraVector2D.

Parameters:

  • vec: Pointer to the XtraVector2D instance.
  • data: Pointer to the data element to be added.
  • row: Row index where the element will be added.

Returns: XtraVectorReturn enum indicating success or failure.

Function: XtraVector2DNewRow

Adds a new empty row to the XtraVector2D.

Parameters:

  • vec: Pointer to the XtraVector2D instance.

Returns: XtraVectorReturn enum indicating success or failure.

Function: XtraVector2DGrab

Retrieves the element at the specified coordinates in the XtraVector2D.

Parameters:

  • vec: Pointer to the XtraVector2D instance.
  • row: Row index of the element.
  • col: Column index of the element.

Returns: Pointer to the element at the specified coordinates, or NULL if the coordinates are out of bounds.

Function: XtraVector2DDelete

Deletes the XtraVector2D and frees the associated memory.

Parameters:

  • vec: Pointer to the XtraVector2D instance.

xtra's People

Contributors

werdl avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.