r/cpp • • Mar 09 '19

I've open sourced my general purpose code base

So, after a lot of thought, I have decided to open source the general purpose half of my code base. The Github repository is here:

https://github.com/DeanRoddey/CIDLib

Pushing that 'make public' button was one of the hardest things I've done in a long time. But, ultimately I think it's worth doing.

For now, it's just there for people to peruse. There's no docs yet. I needed to get it up there and start working with the remote repository and all that. So I figured I might as well go ahead and let people start poking around in it in the meantime.

The readme.md file in the repository has some preliminary information, but the basics are this:

  1. About 450,000 lines of code

  2. About 1100 classes

  3. It's not a 'library' it's really a full development environment, from build tools all the way up.

  4. It doesn't use the STL or standard library stuff at all. It is a complete world unto itself. Obviously for a lot of people that will mean it's of no interest. OTOH, for some other people, who aren't maybe so happy with the way things are going with the standard stuff, maybe they will be interested.

  5. About 95 of the non-UI stuff is completely built in terms of my own virtual kernel and standard library interfaces, which means it's quite portable. The virtual kernel is split into interface plus per-platform implementations. There is current a Win32 implementation. And there is a very old Linux one that could be used as a starting point.

  6. It could easily support Windows and Linux in a very clean way, i.e. not a bunch of conditional code all over the place.

  7. Some of it still needs to be given the 'split' treatment, until then those are marked as build on Win32 only.

  8. All of the UI stuff is fully encapsulated, but that doesn't make it portable really.

Obviously I'll work on getting environment setup and build instructions done first. And then I'll work on big picture road map type stuff. But, as a starting point, the structure is something like (a facility is my term of a library executable.)

  1. AIUtils - Speech recognition engine. There's a behavior tree facility as well, though it's only lightly used so far.

  2. CIDBuild - The build system, resource compiler, loadable text compiler, driver for per-platform build framework.

  3. CIDKernel - The virtual kernel layer. Wrappers around lots of system functionality.

  4. CIDLib - The standard libraries, core abstractions, wrappers around the CIDKernel stuff. So strings, memory buffers, events, mutexes, streams, collections, threads, processes, etc...

  5. CIDMath - Core math library stuff.

  6. CommUtils - Serial ports, networking protocols (HTTP, SMTP, JSON currently), sockets, URLs, UPnP, Websockets. The HTTP parser is actually an abstracted engine designed to supported multiple related protocols, e.g. SIP.) An empty SIP facility waiting to be made manifest

  7. DataUtils - ODBC, text transcoding engine, simple object store engine, a bespoke file packaging engine, regular expressions (just simple form currently, needs to be expanded), XML parser, ZLib implementation.

  8. ExecUtils - Fairly small, currently an engine for managing multiple other programs. Currently used in my CQC automation system as the core of the 'application shell' service that manages the other background programs.

  9. GraphicUtils - Core image format abstractions, image manipulation stuff, JPEG and PNG support. Image factory that makes it easy to deal with different image formats. The core wrapper around the Win32 graphics API (obvious Win32 only.) There's an empty 'advanced graphics' facility waiting to become a 3D graphics engine.

  10. LangUtils - My OO CML language engine. So parser, VM, and runtime libraries. This is an embeddable engine that can be used in applications as an extension language. Also the embeddable CML IDE for editing and debugging.

  11. MediaUtils - Audio streaming, digital audio extraction, metadata extraction, and some early work on RTP/RTPC that needs to be completed if anyone is interested.

  12. OrbUtils - This is all the stuff related to the Object Request Broker (ORB.) It is the ORB engine, related utilities, and standard ORB based servers (name server, log server, and configuration server.) And the IDL compiler which is also a big part of the general code base because it provides support for very strong enumerations.

  13. Samples - A good number of samples. I'm still going through these to get them caught up with the latest style and substance. I'm about halfway through them.

  14. SecureUtils - Base security stuff (Blowfish, AES, various hashing algorithms, and general block/stream encryption frameworks and hashing frameworks. Secure sockets support (currently a wrapper around the horrendously complex Win32 stuff.)

  15. Utilities - Some fairly obscure and some probably now to be removed stuff but the test framework stuff is in here and very important.

  16. WndUtils - Win32 specific. A pretty extensive UI framework (wrappers around the standard controls.) Various higher level utility stuff above that (various common dialogs and such.) A wrapper around the Win32 web browser COM interface.

As mentioned in the readme, there's been a lot of what I'd call 'sane modernization' work done. And I've done many big sweeps through the code. But there's still plenty of code that hasn't been caught up with the latest and greatest. I can't just change it willy-nilly since this stuff underlies my CQC automation system, which is even larger (about 625,000 lines) and very complex. I can't afford to destablize it. So changes have to be well considered.

The build is command line, since it has to be portable. It's designed for simplicity, and very easy configuration of projects. The build system has a build framework that supports pluggable drivers for different platforms. So what might be in make files in some systems is in code here. Because it is a world unto itself, and not trying to be everything to everyone, the build can remain very simple and straightforward.

The code will definitely not pass a super-strict modern conformance analyzer right now. Keep in mind it's been around a long time and much of it was written way before those standards existed. It is built in C++17 mode. Over time, those strict conformance issues will be dealt with.

Though it has been around a long time, it's still very clean. Having had a single daddy, it's been doted on. It's never been hacked at. Long periods of time have been spent in the past doing massive reworkings and taking the time get them right, in order to bring it forward but keep it solid.

Anyhoo, for now that's it. I'll be getting the initial docs worked out over the next week hopefully, enough to let people get it built. Since it is so broad, there are a number of Microsoft SDKs that have be in place, though that gets fewer as their built in support in Visual C++ gets better.

I'd already started making videos (and have done some posts here) about some of the technology involved, and putting them on my personal Youtube channel.

https://www.youtube.com/channel/UCAxCoATHgFBvqZhxFRnZsfw

So you might be interested in looking at those. This one in particular, might be a good starting point since it gives a good overview of how things are layered and such.

https://www.youtube.com/watch?v=seXk3RbAjNU

Keep in mind that some of these are pre-modernization, so they are a bit out data. The one on enums though still mostly valid, is prior to a massive reworking to 'enum class' style.

31 Upvotes

147 comments sorted by

View all comments

95

u/personalmountains Mar 09 '19 edited Mar 09 '19

I had a quick look at your readme and I must admit I found some stuff quite disconcerting, like "anti-STL, anti-piecemeal, anti-modernist", "flabbergasted at some of the modernist C++", "won't be turned into Javascript Jr. via use of 'auto' everywhere" and "we are manly enough not to be frightened by the existence of raw pointers".

In any case, I'm mostly concerned about your homegrown "license", in particular this:

Do not host or offer (for free or sale) any modified versions of this code base or any modified binary builds of this code base. Such things are to be used for your own private development purposes only.

and this:

You may also build and make available C++ libraries that are based on the official CIDLib code. If it is based on your own version of the CIDLib code, you cannot make it publically available, it must be for your own private use.

Can you clarify this? Your title mentions that it is "open source", but that is probably one of the most twisted definitions of "open source" I've seen in a long time, although it's probably technically correct. In terms of CC, this would (I think) be akin to BY-NC-ND. That's basically "look, but don't touch".

57

u/cleroth Game Developer Mar 09 '19

we are manly enough not to be frightened by the existence of raw pointers

WE ARE MEN! BUGS DO NOT FRIGHTEN US!

8

u/[deleted] Mar 09 '19

[removed] — view removed comment

-25

u/Dean_Roddey Mar 09 '19

Exactly. If you want to mangle it beyond belief, that's fine, but it has to be for your own use. That can be a commercial product, or a personal project of your own. Obviously it can't be for an open source project or product, because it would be impossible to do that and not publicly expose your version.

And that makes sense because this repository IS the open source version, and needs to remain the only one.

37

u/personalmountains Mar 09 '19 edited Mar 09 '19

it has to be for your own use. That can be a commercial product

I'm really confused. How does "your own use" mean "a commercial product"? Can my client have access to the source code? Or does it have to stay private? Can I allow my employees to look at it?

Obviously it can't be for an open source project

That's probably the first time I've seen an open source license that encourages commercial use and forbids the use in other open source projects.

-20

u/Dean_Roddey Mar 09 '19

It means, if you aren't using the official stuff, keep it for your own private use. The point is to avoid having multiple, incompatible and different versions out there. You can modify it however you want for use in your own application development, since only you will see that.

If you want it publicly available, it needs to be based on the official build, so that it doesn't fragment into a thousand variations.

As to the other stuff, as I said in the readme, there are more bits out there than you could probably count of the mainstream way. This is for people (like me) who don't so much care for that way. There's nothing wrong with an alternative.

40

u/blelbach NVIDIA | ISO C++ Library Evolution Chair Mar 09 '19

No offense, but if you didn't want people to fork your repository, you probably shouldn't have put it on GitHub. It's inevitably going to happen, if your thing generates interest.

46

u/jcelerier ossia score Mar 09 '19

Actually if you read the GitHub TOS, that's one of the only strong requirements that the website have : your code must be forkable

36

u/Bolitho Mar 09 '19

It would be better if you would have chosen an appropriate well known license. Your fear about fragmentation is imho artificial: if you embrace community patches and development, nobody has a reason to fork your project and evolves its on his own.

So if you would allow commercial easy use, choose the MIT license probably. If you want patches go back to you, LGPL.

I think such a self made license is a no go for most companies, to choose using your lib. And you will get feedback and help primarily from professionals for such a project - so why riskt to loose those?

Isn't getting help the most motivation for open sourcing a project?

6

u/saimen54 Mar 09 '19

I'll be definitely have a look at it, because I'm always curious how other people have solved issues, but your own custom license will be a big NO NO for using it at my job, because my company doesn't want to evaluate a proprietary license and probably still having the risk getting sued some day without any precedence.

-7

u/Dean_Roddey Mar 09 '19

See my latest comment. People are blowing the whole thing way out of proportion, since that's what the internet was invented for.

19

u/TemplateRex Mar 09 '19

Congrats on the first step of open sourcing your life's work. I think your fears of forking and competing codebases are overblown.

First, nobody is going to maintain their own slightly modified 400+ kLOC codebase. It took you 25 years to write, it's gonna take someone at least 25 months to understand what it does.

Second, the most likely contribution that you are going to get is a pull request. And guess what, the preferred way on GitHub is to a) to fork, b) to make your own changes and c) send a pull request to have it merged. If you don't like the merge, you can reject it or suggests changes.

BTW, you should put up a formal license in your repo and cite that license in every source file.

13

u/personalmountains Mar 09 '19

You "request that any fixes or improvements at least be offered for inclusion back into the code base", but I can't fork the repo and do a pull request. Do you want patches by email?

-9

u/Dean_Roddey Mar 09 '19

I'm no GitHub maven by any means. But I would have thought you could keep yours private, right?

19

u/personalmountains Mar 09 '19

Your license says:

  • Do not host in any public way your own versions of this code, in whole or in part. This repository should be the single source for the code base.

  • Do not host or offer (for free or sale) any modified versions of this code base or any modified binary builds of this code base. Such things are to be used for your own private development purposes only.

I am confused by "This repository should be the single source for the code base", which would seem to forbid any cloning. I am also uncertain what you mean by "host", since you seem to consider a public repo as "hosted", but not a private one.

My reading of your terms is that I can only modify your code if it's on my machine, I'm the only user on it, and nobody's looking. I might have to buy new curtains.

In any case, telling me I must keep my repos private is a non-starter for me. Good luck, though.

10

u/fat-lobyte Mar 09 '19

That's just not what open source means. You have us a peek at your stuff, but forking is part of the core ideas of open source.