Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/nyuuuukie/asm-library

Reproduction of some C standard functions used for working with C-style strings and lists in assembler (nasm)
https://github.com/nyuuuukie/asm-library

42ecole 42projects libasm

Last synced: 5 days ago
JSON representation

Reproduction of some C standard functions used for working with C-style strings and lists in assembler (nasm)

Awesome Lists containing this project

README

        

# Asm-library
### _Reproduction of some C standard functions used for working with C-style strings and lists in assembler (NASM)_

## Description:
Basic part of the lib contains the following functions:

```c
size_t ft_strlen(const char *str);

char *ft_strdup(const char *str);

char *ft_strcpy(char *dst, const char *src);

ssize_t ft_read(int fd, void *buffer, size_t length);

int ft_strcmp(const char *str1, const char *str2);

ssize_t ft_write(int fd, const void *buffer, size_t length);

```

Additional part uses the following struct:

```c
typedef struct s_list
{
void *data;
struct s_list *next;
} t_list;
```
* Field `data` can store any type
* Field `next` refers to the next element of the list

It also contain these functions to work with the list:

```c
int ft_atoi_base(char *str, char *base);

int ft_list_size(t_list *begin_list);

void ft_list_push_front(t_list **begin_list, void *data);

void ft_list_sort(t_list **begin_list, int (*cmp)());

void ft_list_remove_if(t_list **begin_list, void *data, int (*cmp)(), void (*free_ctl)(void *));

```

## Creation:
Use **`make`** or **`make -C `** to compile basic part of a lib.
If you want create library with additional part, you should use **`make bonus`**

## Using examles:
Compiling with .c/.o/.s files:
* `gcc test.c -L -lasm -I `

* `gcc test.o /libasm.a`

## Run test:
Use **`make run`** or **`make runb`** to compile library with test main function.
To run test type **`./a.out`** and pass them 2 or 3 args:
* `./a.out "hello"` will test all basic functions except strcmp

* `./a.out "hello" "world"` will test all basic functions including strcmp