fixed some errors

This commit is contained in:
Odweta
2024-02-06 22:04:47 +01:00
parent e40b61a21b
commit f9e820efbc
10 changed files with 355 additions and 355 deletions
+9 -9
View File
@@ -13,28 +13,28 @@ typedef struct {
file_t *file_new(char *path); // initialization function
void file_cleanup(file_t *this); // just to be memory safe...
void file_cleanup(file_t *self); // just to be memory safe...
void file_print(file_t *this); // prints the file as a string
void file_print(file_t *self); // prints the file as a string
char *file_to_string(file_t *this); // returns a string with the file contents
char *file_to_string(file_t *self); // returns a string with the file contents
void file_writeln(file_t *this, char *payload); // appends a given string to the file on a newline
void file_writeln(file_t *self, char *payload); // appends a given string to the file on a newline
void file_write(file_t *this, char *payload); // appends a given string to the file (not on a newline!)
void file_write(file_t *self, char *payload); // appends a given string to the file (not on a newline!)
void file_copy(file_t* src, char *dst); // copy file src into file dst
void file_delete(file_t *this); // deletes a file
void file_delete(file_t *self); // deletes a file
void file_move(file_t* src, char *dst); // moves/renames a file
bool file_exists(file_t *this); // 1 = yes, 0 = no
bool_t file_exists(file_t *self); // TRUE = yes, FALSE = no
void file_create(char *path); // create an empty file with the given name
void file_number_lines(file_t *this); // prepend line numbers in front of each line in a file
void file_number_lines(file_t *self); // prepend line numbers in front of each line in a file
int file_count_words(file_t *this); // counts the number of words in a file
int file_count_words(file_t *self); // counts the number of words in a file
#endif // FILE_H
+12 -12
View File
@@ -2,12 +2,12 @@
#define LIST_H
/*
* What is this?
* What is self?
*
* A list (as I interpret it in this library)
* A list (as I interpret it in self library)
* is a `vector_t` of other `vector_t`s, where
* every inner `vector_t` can be of any type ->
* this means a Python-like list
* self means a Python-like list
*/
#include <odweta/vector.h>
@@ -21,21 +21,21 @@ typedef struct {
list_t *list_new(); // returns a new list
void list_push(list_t *this, type_e type, void *element); // appends an element at the end of a list
void list_push(list_t *self, type_e type, void *element); // appends an element at the end of a list
void list_show(list_t *this); // prints a list
void _list_print_recursive(list_t *this, int depth);
void list_show(list_t *self); // prints a list
void _list_print_recursive(list_t *self, int depth);
void list_cleanup(list_t *this); // freeing pointers
void list_cleanup(list_t *self); // freeing pointers
void *list_pop(list_t *this); // popping the last value of the list and returning it
void *list_pop(list_t *self); // popping the last value of the list and returning it
void list_insert_at(list_t *this, int index, type_e type, void *element); // inserts an element at a given index
void list_insert_at(list_t *self, int index, type_e type, void *element); // inserts an element at a given index
void list_remove_at(list_t *this, int index);
void list_remove_at(list_t *self, int index);
void list_set_at(list_t *this, int index, type_e type, void *element);
void list_set_at(list_t *self, int index, type_e type, void *element);
void *list_get_at(list_t *this, int index);
void *list_get_at(list_t *self, int index);
#endif // LIST_H
+6 -6
View File
@@ -12,16 +12,16 @@ string_t *string_new(); // create a new e
string_t *string_from(char *chars); // create a new string from a given char_sequence
bool string_push_chars(string_t *this, char *chars); // append a char_sequence to a string
bool string_push(string_t *this, string_t *other); // append a string to a string
bool_t string_push_chars(string_t *self, char *chars); // append a char_sequence to a string
bool_t string_push(string_t *self, string_t *other); // append a string to a string
compare_e string_compare(string_t *left, string_t* right); // compare two strings
void string_print(string_t *this); // print a string
void string_println(string_t *this); // print a string with a \n
void string_print(string_t *self); // print a string
void string_println(string_t *self); // print a string with a \n
bool string_is_empty(string_t *this); // return true when s->content == ""
bool_t string_is_empty(string_t *self); // return true when s->content == ""
void string_cleanup(string_t *this); // memory cleanup
void string_cleanup(string_t *self); // memory cleanup
#endif
+1 -1
View File
@@ -3,7 +3,7 @@
#undef bool
typedef enum { false, true } bool;
typedef enum { FALSE, TRUE } bool_t;
typedef enum {
LESS,
+12 -12
View File
@@ -13,30 +13,30 @@ typedef struct {
vector_t *vector_new(type_e type); // size gets determined by the dataType and the capacity starts at 1 and x1.5 every time the vector gets filled up
void vector_reset(vector_t *this); // sets the vector to its original state
void vector_reset(vector_t *self); // sets the vector to its original state
void *vector_pop(vector_t *this); // remove one value from the end of the vector and return it
void *vector_pop(vector_t *self); // remove one value from the end of the vector and return it
void vector_push(vector_t *this, void *element); // push one value at the end of the vector
void vector_push(vector_t *self, void *element); // push one value at the end of the vector
void vector_cleanup(vector_t *this); // freeing pointers
void vector_cleanup(vector_t *self); // freeing pointers
void vector_print(vector_t *this); // shows the vector
void vector_print(vector_t *self); // shows the vector
void vector_print_as_string(vector_t *this); // show the vector as a string if the v->type is CHAR
void vector_print_as_string(vector_t *self); // show the vector as a string if the v->type is CHAR
void vector_insert_at(vector_t *this, int index, void *element); // inserts an element 'element' at index 'index'
void vector_insert_at(vector_t *self, int index, void *element); // inserts an element 'element' at index 'index'
void vector_set_at(vector_t *this, int index, void *element); // set an element's value at a given index
void vector_set_at(vector_t *self, int index, void *element); // set an element's value at a given index
char *vector_to_string(vector_t *this); // convert the vector into a regular string
char *vector_to_string(vector_t *self); // convert the vector into a regular string
void *vector_get_at(vector_t *this, int index); // get an element at the given index
void *vector_get_at(vector_t *self, int index); // get an element at the given index
void vector_remove_at(vector_t *this, int index);
void vector_remove_at(vector_t *self, int index);
void _vector_print_recursive(vector_t *this, int depth);
void _vector_print_recursive(vector_t *self, int depth);
#endif