Giter Site home page Giter Site logo

nyuuuukie / asm-library Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 45 KB

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

Makefile 3.17% Assembly 67.63% C 29.19%
42ecole 42projects libasm

asm-library's Introduction

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:

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:

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:

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 <path_to_libdir> 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 <path_to_lib> -lasm -I <path_to_lib>

  • gcc test.o <path_to_lib>/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

asm-library's People

Contributors

nyuuuukie 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.