Let's make a custom library!

A place to submit all custom code, scripts, and programs.
Forum rules
Do NOT post malicious code or programs. Please review all code posted in this forum before downloading or running any of the code or programs here.

Let's make a custom library!

Post by RatkinHHK on Sat Apr 18, 2015 1:47 pm
([msg=87767]see Let's make a custom library![/msg])

I recently decided to code my own library of functions in C.
And what I need are well.. suggestions.
Any list of potentially useful functions is welcome. I think about dividing them into math-related, string-related etc...
So, if anyone has any idea, thanks in advance..
"You have enemies? Good. That means you've stood up for something, sometime in your life." --- Winston Churchill
User avatar
RatkinHHK
Experienced User
Experienced User
 
Posts: 72
Joined: Tue Nov 11, 2014 6:06 pm
Blog: View Blog (0)


Re: Let's make a custom library!

Post by tremor77 on Sat Apr 18, 2015 7:50 pm
([msg=87768]see Re: Let's make a custom library![/msg])

Are you looking to improve on some of the existing libraries, come up with something new or just having fun with it? I've been using a Broadcom SDK for embedded devices lately that comes with such a basic stripped down set of libraries.. it doesn't even have float or strstr. Trying to think about what might be most useful to me, probably some basic maths.. lightweight, trying to jam stuff into a tiny micro.. would love something that can take 3-axis accelerometer data (x, y, z) delta t and determine speed and direction..
User avatar
tremor77
Addict
Addict
 
Posts: 1098
Joined: Wed Mar 31, 2010 12:00 pm
Location: New York
Blog: View Blog (0)


Re: Let's make a custom library!

Post by ghost107 on Sun Apr 19, 2015 12:24 am
([msg=87769]see Re: Let's make a custom library![/msg])

If it is a standard library, in C++ is STL that has every thing you need and Boost(with C++17 boost will be included into STL), so creating a library for doing this will not be any good.

A standard library for C, would be nice some data structures and algorithms for c:
Data Structure:
- Vectors
- Linked Lists, Ordered Lists and Sorted Lists
- Stacks, Queues and Deques
- Trees
- Heaps and garbage collectors
- Sets, Multisets, and Partitions
- HashTables and Scatter Tables

Algorithms:
- Sorting(insertion sort, Quick Sort, Bouble Sort, Selection sort, Merge sort, Shell sort, Heap sort)
- Search Trees
- Huffman (for compression)

As for math, The base library is Math.h, but for 2D and 3D not so much:
- Vectors
- Matrices
- Transformations:
  1. Translation (Liniar Transform)
  2. Scaling
  3. Rotation
- Quaternions
- Basic Geometry:
  1. Point
    1. Distance between 2 points
    2. Computing the angle of 3 points
  2. Lines
    1. Slope
    2. Distance between point and Line
    3. Intersection point between 2 lines
    4. Distance between 2 lines(3D the minimum distance between 2 lines
  3. Planes
    1. Intersection of a line and a plane
    2. Intersection of 3 planes
    3. Transforming Planes
I use this the most I use at work and home, they are not abstract implemented anywhere(they come with any 2D/3D library, and they are dependable to those libraries)

As for string library string.h does a lot of work, the only thing I would implement for it a regex library.
User avatar
ghost107
Poster
Poster
 
Posts: 321
Joined: Wed Jul 02, 2008 7:57 am
Blog: View Blog (0)


Re: Let's make a custom library!

Post by RatkinHHK on Sun Apr 19, 2015 5:05 am
([msg=87770]see Re: Let's make a custom library![/msg])

Thanks... That's what I was looking for.
I do this mostly as practice and for fun.
"You have enemies? Good. That means you've stood up for something, sometime in your life." --- Winston Churchill
User avatar
RatkinHHK
Experienced User
Experienced User
 
Posts: 72
Joined: Tue Nov 11, 2014 6:06 pm
Blog: View Blog (0)


Re: Let's make a custom library!

Post by tremor77 on Sun Apr 19, 2015 10:13 am
([msg=87771]see Re: Let's make a custom library![/msg])

A good JSON parser also would be nice.
User avatar
tremor77
Addict
Addict
 
Posts: 1098
Joined: Wed Mar 31, 2010 12:00 pm
Location: New York
Blog: View Blog (0)


Re: Let's make a custom library!

Post by pretentious on Tue Apr 21, 2015 5:38 am
([msg=87777]see Re: Let's make a custom library![/msg])

tremor, You sound like you have the most interesting life :D
ghost107 wrote:A standard library for C, would be nice some data structures and algorithms for c:
Data Structure:
- Vectors
- Linked Lists, Ordered Lists and Sorted Lists
- Stacks, Queues and Deques
- Trees
- Heaps and garbage collectors
- Sets, Multisets, and Partitions
- HashTables and Scatter Tables

This. I find the lack of existing vectors in the standard libraries to be pretty unforgivable. I know the explanation and I don't care.
Goatboy wrote:Oh, that's simple. All you need to do is dedicate many years of your life to studying security.

IF you feel like exchanging ASCII arrays, let me know ;)
Can you say brainwashing It's a non stop disco
User avatar
pretentious
Addict
Addict
 
Posts: 1203
Joined: Wed Mar 03, 2010 12:48 am
Blog: View Blog (0)


Re: Let's make a custom library!

Post by tremor77 on Tue Apr 21, 2015 9:53 pm
([msg=87781]see Re: Let's make a custom library![/msg])

pretentious wrote:tremor, You sound like you have the most interesting life :D


Oh.. no.. that's not even close to true,I'm quite mundane.
User avatar
tremor77
Addict
Addict
 
Posts: 1098
Joined: Wed Mar 31, 2010 12:00 pm
Location: New York
Blog: View Blog (0)


Re: Let's make a custom library!

Post by MadM0use on Thu Jun 11, 2015 8:03 pm
([msg=88470]see Re: Let's make a custom library![/msg])

RatkinHHK wrote:I recently decided to code my own library of functions in C.
And what I need are well.. suggestions.
Any list of potentially useful functions is welcome. I think about dividing them into math-related, string-related etc...
So, if anyone has any idea, thanks in advance..



Well if you are talking about writing a regular library, i wouldn't do another graphics library, there are WAY too many of those. A graphics toolkit like fltk would be cool though, and there is a place for that, it would be an abstraction on top of xlib or xcb and shouldn't be too hard if you are already proficient in C.

now when you say CUSTOM library, this infers that you want to replace something that already exists like libc, and this could be a really fun experience for you to get to truly understand the bare bones of the C language, but requires knowledge of assembly, as standard libraries are better coded in assembly. If you want to go this route, I can provide resources, code examples of my own and moral support so feel free to message me because i like the path you have chosen lol
const char main[]="\xeb\xfe -> A fully functional program in C";

<@MadMouse> i am forgot what i was doing today but i had motivation and a distinct plan when i woke up stoned right now

http://pastebin.com/FnwUG5KS
Books:
http://goo.gl/muPm3d
User avatar
MadM0use
Experienced User
Experienced User
 
Posts: 70
Joined: Thu Sep 11, 2014 10:30 pm
Blog: View Blog (0)


Re: Let's make a custom library!

Post by kiran sahu on Fri May 24, 2019 5:47 am
([msg=98273]see Re: Let's make a custom library![/msg])

It is safe to say that you are hoping to enhance a portion of the current libraries, thought of something new or simply messing around with it? I've been utilizing a Broadcom SDK for inserted gadgets recently that accompanies such a fundamental stripped down arrangement of libraries.. it doesn't have glide or strstr. Attempting to consider what may be most helpful to me, likely some essential maths.. lightweight, attempting to stick stuff into a minor smaller scale.. would love something that can take 3-hub accelerometer information (x, y, z) delta t and decide speed and course.
kiran sahu
New User
New User
 
Posts: 2
Joined: Fri May 24, 2019 5:43 am
Blog: View Blog (0)



Return to Custom Code

Who is online

Users browsing this forum: No registered users and 0 guests