D library projects

Adam D. Ruppe destructionator at gmail.com
Thu Nov 12 12:00:11 PST 2009


On Thu, Nov 12, 2009 at 10:59:38AM -0800, Walter Bright wrote:
> Some packages that look particularly useful are:
> http
> image
> net

I have some code that might be useful for these, that I've accumulated
over time. 

Warning, ugly code:


IMAGE RELATED

http://arsdnet.net/dcode/png.d

This one is a from scratch PNG library. It isn't quite complete, but
I'm using it already in my DWS project - the fetchPaletteWin32, getANDMask,
and getFlippedUnfilteredDatastream (nice names, I know) functions can take
indexed, semi-transparent PNG files and spit out the pieces to make a Windows
ico type icon. Also in there are functions to make doing palette swaps easier.

It *should* compile as both D1 and D2. I originally wrote it in D2, but had
to use it in a D1 project, so I cut out the immutable, etc. to make it work
there.

Why not use libpng? When I started it, I just wanted to see some of the bytes
in the file. Then it grew from there, since I prefer using small code over
bigger libraries.

http://arsdnet.net/dcode/dimage

Another image thing. It is part D and part C. It reads and writes (some)
Windows .bmp files, and can display them on both Windows and Linux.

auto a = new BMP("image.bmp");
a.display(); // pops up a window showing the bmp

Also allows some basic read/write of the bmp's pixels in memory.


NETWORK RELATED

http://arsdnet.net/dcode/httpdconnection.d

This is a module to my network manager* that speaks HTTP as a server - well,
enough of it so my browser could view the pages it served anyway. Still needs
more work to be complete, but is already good enough to run a website off.

In fact, my one of my websites is written /entirely/ in D, and
runs on a custom minimal Linux system that takes a total of 18 MB on disk
and 8 MB running! Its IP address has been commandeered, but here's the same
program running on another server of mine: http://206.125.170.166:81/

* My network manager is here: http://arsdnet.net/dcode/netman.d and it
  does sending, reading, and connections using the select() call. Problem
  with it is it is a little ugly and Linux only.


Umm where was I.. I forgot. Oh well, one more:

MISC

http://arsdnet.net/dcode/exec.d

This one offers one function: exec(...) which runs a child process, directing
its stdio into strings. It is Linux only and kinda sucks - I made it just
for some shell script like things a long time ago.

I'd like to redo this to work with input and output ranges, and work across
platforms, along with some convenience functions to really kill shell 
scripting, but haven't had the time.



==========

I have a buttload of code here, in various messy forms. (The coolest one is
a 2D, networked game engine for D1... no website though. And now of course
my d windowing system project is moving along. http://arsdnet.net/dws )

But my weekends only have time to do so much about cleaning it up and
posting it to the web.

-- 
Adam D. Ruppe
http://arsdnet.net



More information about the Digitalmars-d mailing list