|
My library
Library for common tasks
|
Macros for emulated overloading. More...


Go to the source code of this file.
Macros | |
| #define | cmpVal(a, b) |
| Compare two values. More... | |
| #define | bubbleSortArr(arr, size) |
| BubbleSort for arrays. More... | |
| #define | quickSortArr(arr, size, ...) |
| Quicksort for arrays. More... | |
| #define | newALFromArray(arr, size) |
| Create an ArrayList from a static array. More... | |
| #define | newLLFromArray(arr, size) |
| Create a LinkedList from a static array. More... | |
| #define | newStackFromArray(arr, size) |
| Create a Stack from a static array. More... | |
| #define | newQueueFromArray(arr, size) |
| Create a Queue from a static array. More... | |
| #define | newStackFromArray(arr, size) |
| Create a Stack from a static array. More... | |
| #define | print(spec, collection) |
| Print contents from an ArrayList, LinkedList, Stack or Queue. More... | |
| #define | areEqual(collection1, collection2) |
| Compare two ArrayList, LinkedList, Stack or Queue. More... | |
| #define | append(list, item) |
| Insert an item at the end of an ArrayList or LinkedList. More... | |
| #define | insert(list, index, item) |
| Insert an element at a specified position of an ArrayList or LinkedList. More... | |
| #define | set(list, index, newItem) |
| Set value of an element of an ArrayList or LinkedList. More... | |
| #define | merge(list1, list2) |
| Merge two ArrayList or LinkedList. More... | |
| #define | slice(list, begin, end) |
| Slice an ArrayList or LinkedList. More... | |
| #define | removeItem(list, index) |
| Remove an item from an ArrayList or LinkedList. More... | |
| #define | getItem(list, index, dest) |
| Get an item from an ArrayList or LinkedList. More... | |
| #define | delete(collection) |
| Delete an ArrayList, LinkedList, Stack or Queue. More... | |
| #define | isIn(collection, item) |
| Detect if an item is inside an ArrayList, LinkedList, Stack or Queue. More... | |
| #define | getLength(collection) |
| Get the number of elements in an ArrayList, LinkedList, Stack, Queue or string. More... | |
| #define | linearSearch(list, key) |
| Linear search for an ArrayList or LinkedList. More... | |
| #define | deleteHead(collection) |
| Delete current Stack or Queue head. More... | |
| #define | isEmpty(collection) |
| Check if an ArrayList, LinkedList, Stack or Queue is empty. More... | |
| #define | peek(collection, dest) |
| Get the item at the head of a Stack or Queue without popping/dequeueing it. More... | |
Macros for emulated overloading.
"C_Cpp.default.cStandard": "c17" in your settings.json file in order to avoid these error reportings | #define append | ( | list, | |
| item | |||
| ) |
Insert an item at the end of an ArrayList or LinkedList.
| list | The list you want to append an item to |
| item | The item you want to append to list |
| #define areEqual | ( | collection1, | |
| collection2 | |||
| ) |
Compare two ArrayList, LinkedList, Stack or Queue.
| collection1 | The first ArrayList, LinkedList, Stack or Queue you want to compare |
| collection2 | The second ArrayList, LinkedList, Stack or Queue you want to compare |
| #define bubbleSortArr | ( | arr, | |
| size | |||
| ) |
BubbleSort for arrays.
| arr | Pointer to the array to be sorted |
| size | Number of elements in the array to be sorted |
| #define cmpVal | ( | a, | |
| b | |||
| ) |
Compare two values.
| a | Pointer to the first value to be compared |
| b | Pointer to the second value to be compared |
| GREATER | First element is grater than the second |
| EQUAL | First element is equal to the second |
| SMALLER | First element is smaller than the second |
| #define delete | ( | collection | ) |
Delete an ArrayList, LinkedList, Stack or Queue.
| collection | The ArrayList, LinkedList, Stack or Queue you want to delete |
| #define deleteHead | ( | collection | ) |
| #define getItem | ( | list, | |
| index, | |||
| dest | |||
| ) |
Get an item from an ArrayList or LinkedList.
| list | The list you want to get an item from |
| index | The index of the item you want to get |
| dest | The address of the variable you want to store the item in |
| #define getLength | ( | collection | ) |
Get the number of elements in an ArrayList, LinkedList, Stack, Queue or string.
| collection | The ArrayList, LinkedList, Stack, Queue or string you want to evaluate |
collection | #define insert | ( | list, | |
| index, | |||
| item | |||
| ) |
Insert an element at a specified position of an ArrayList or LinkedList.
| list | The list you want to insert an element into |
| index | The position you want to insert an item at |
| item | The item you want to insert into list |
| #define isEmpty | ( | collection | ) |
Check if an ArrayList, LinkedList, Stack or Queue is empty.
| collection | The ArrayList, LinkedList, Stack or Queue to be checked |
| TRUE | collection is empty |
| FALSE | collection is not empty |
| #define isIn | ( | collection, | |
| item | |||
| ) |
Detect if an item is inside an ArrayList, LinkedList, Stack or Queue.
| collection | The ArrayList, LinkedList, Stack or Queue you want search in |
| item | The item you want to search |
| TRUE | Given item is contained in collection |
| FALSE | Given item is not contained in collection |
| #define linearSearch | ( | list, | |
| key | |||
| ) |
Linear search for an ArrayList or LinkedList.
| list | The ArrayList or LinkedList to be inspected |
| key | The key to be searched |
| KEY_NOT_FOUND | The key was not found |
| #define merge | ( | list1, | |
| list2 | |||
| ) |
Merge two ArrayList or LinkedList.
| list1 | The first list to be merged, where the merged list is saved |
| list2 | The second list to be merged |
list1 is messed up | #define newALFromArray | ( | arr, | |
| size | |||
| ) |
Create an ArrayList from a static array.
| arr | The array you want to create an ArrayList from |
| size | The size of arr |
arr | #define newLLFromArray | ( | arr, | |
| size | |||
| ) |
Create a LinkedList from a static array.
| arr | The array you want to create a LinkedList from |
| size | The size of arr |
arr in the same order | #define newQueueFromArray | ( | arr, | |
| size | |||
| ) |
Create a Queue from a static array.
| arr | The array you want to create a Queue from |
| size | The size of arr |
arr with the first element of arr as head | #define newStackFromArray | ( | arr, | |
| size | |||
| ) |
Create a Stack from a static array.
| arr | The array you want to create a Stack from |
| size | The size of arr |
arr with the last element of arr as head| arr | The array you want to create a Stack from |
| size | The size of arr |
arr with the first element of arr as head | #define newStackFromArray | ( | arr, | |
| size | |||
| ) |
Create a Stack from a static array.
| arr | The array you want to create a Stack from |
| size | The size of arr |
arr with the last element of arr as head| arr | The array you want to create a Stack from |
| size | The size of arr |
arr with the first element of arr as head | #define peek | ( | collection, | |
| dest | |||
| ) |
Get the item at the head of a Stack or Queue without popping/dequeueing it.
| #define print | ( | spec, | |
| collection | |||
| ) |
Print contents from an ArrayList, LinkedList, Stack or Queue.
| spec | The type and format specifier you want to use to print the single element. Use the printf() conventions |
| collection | The ArrayList, LinkedList, Stack or Queue you want to print |
| #define quickSortArr | ( | arr, | |
| size, | |||
| ... | |||
| ) |
Quicksort for arrays.
| arr | Pointer to the array to be sorted |
| size | Number of elements in the array to be sorted |
| #define removeItem | ( | list, | |
| index | |||
| ) |
Remove an item from an ArrayList or LinkedList.
| list | The list you want to delete an item from |
| index | The index of the item you want to delete |
| #define set | ( | list, | |
| index, | |||
| newItem | |||
| ) |
Set value of an element of an ArrayList or LinkedList.
| list | The list you want to edit |
| index | The index of the item you want to change |
| newItem | The item you want to set the index-th element of list to |
| #define slice | ( | list, | |
| begin, | |||
| end | |||
| ) |
Slice an ArrayList or LinkedList.
| list | The list you want to slice, where the sliced list is saved |
| begin | The index of the beginning of the slice |
| end | The index of the end of the slice |