Coder Social home page Coder Social logo

barrust / c-utils Goto Github PK

View Code? Open in Web Editor NEW
60.0 60.0 10.0 270 KB

C utility libraries

License: MIT License

C 98.15% Makefile 1.85%
bitarray c-language c-programming c-string doublylinkedlist fileutils graph minunit permutations stack string-manipulation stringlib timing unit-testing-framework utilities

c-utils's People

Contributors

barrust avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

c-utils's Issues

Add Cpp Guards

#ifdef __cplusplus
extern "C" {
#endif

/* all the codes */ 

#ifdef __cplusplus
} // extern "C"
#endif

CI using travis-ci

Adding an automatic test for all new code pushed would help ensure everything is working as expected. This could also allow us to test windows environments.

fileutils Windows Support

It would be nice if tests could be run on a windows machine; until travis.ci has better windows support, this may be difficult. Until then, another CI host may be needed. I figure there are issues (readdir, _rmdir, _mkdir, etc) will need to be resolved or thought through,

fs_resolve_path() fails on same directory filename

An error occurs when using the fs_resolve_path function on a filename within the same directory:

fs_resolve_path("./somefile.txt");  // works
fs_resolve_path("somefile.txt");    // segfaults

It seems that we need to check for a -1 result for the first delimiter before jumping into the while loop.

bitarray check-and-set

Add a new function that checks and sets the bit to allow for simpler check and set operations.

Additional minunit assertions

Some thoughts:

  • int not equal
  • int between
  • int greater than
  • int less than
  • double between
  • double greater than
  • double less than

simplify doubly-linked-list

There are many places that the doubly linked list could be simplified and reuse code; this cleanup will make it easier to read and maintain.

Graph OpenMP support

Now that it is (almost) possible to add vertices by id, it would be easier to allow for parallel generation of the graph with OpenMP support. There are a few considerations including using atomic builtins (gcc) for increments and decrements.

fileutils: symlink tests

There are several places in the fileutils library that are not fully tested because they require symlinks, these should be tested in full as much as possible!

generic permissions access and setting

Need a function to get and set the permissions of a filepath as a mode_t

int fs_get_permissions(const char* path);
int fs_set_permissions(const char* path, int new_permissions);

additional functions

  • fs_make_path() - combine into a single path
  • add full path to the file_t object
  • fs_list_dir() - return all the things

additional find functions

It would be beneficial to add a few more functions:

  • s_find_*_alt()
    • Would include a "position" of the delimiter, like the second, etc. and return the point to that version
  • s_find_*_cnt()
    • Would cnt the number of times the delimiter is found in the string

rmdir support

Currently c-utils does not support removing a directory. There are several different removal types that will need to be handled:

  • Single level, empty
  • Single level, not empty (remove those files in the directory?)
  • Recursive
    • files
    • no files

Some set of functionality should be supported!

Examples

Adding some examples to the code base could make it easier for others to get started with the project.

Graph - add vertex by id

Currently, each vertex is assigned an id so that it can be looked up in O(1) time. This makes using this library in parallel difficult as they may not be in the same order as they are from the source. Adding an alternate method of insertion that allows for the id to be passed in would help in making this library closer to thread safe (OpenMP).

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.