Feb 122013
 

You know I used to believe Ada is an elegant programming language because its codes look well organized, I thought it inherited this from Pascal till I found out I wrote some codes like this:

Codes

Ada do need a “continue” statement.

 

Jun 242009
 

Found something cute – Here is a ASDF interface of Win32 for SBCL, seems I can create Win32 application easily with it.

So, I’m kind of away from Ada now since the new GNAT 2009 did not solve the Win32 binding issue, my work on Ada became a interpretter, that is, reading C/C++ specification of Win32 APIs, and then use Ada to rewrite them, I’m pretty sure I was bored with it so I slowered down the development.

Lisp … seems like a different story, the community is a lot more active (based on discussion in USENET), also there are more than one compiler/interpreter providers vs. one from Ada (yes, GNAT is great, but it’s GNAT only), I can see SBCL and CMUCL are pretty promissing, while a lot other providers are coming up.

I may go write the PPCam program again, with Lisp, I know I’m stubborn, but I just want to get it done, with any non-Microsoft, and non-Borland software.

BTW, I gave up the idea of finding an IDE, I’ll work on command line to build a GUI application ๐Ÿ™‚

May 292009
 

Yesterday (actually, May 27) I encountered a pretty long “glitch” on http://libre.adacore.com, and was wondering either there were too many downloads that brought down the site, or AdaCore gurus were working on the site for the coming release.

I’m genius ๐Ÿ˜€ – it turned out GNAT GPL 2009 is ready today, I’ve been waiting for this version for quite some time, most because of the new feature that can generate Ada specification based on C/C++ header files.

I’m going to see if I can get Ada specification files for DirectShow stuffs, I believe this kind of feature works fine on *nix, but for Windows … I don’t have much confidence as Windows is at the bottom of the supporting list in open source world.

Let’s see.

May 202009
 

There are some promising features, the most important one to me is generate Ada specification based on C/C++ header files, this will give me a break on creating my own bindings.

Let’s see – their web site mentioned late May, so it could be just couple of days ahead.

May 152009
 

Here is the perfect explanation on how to setup a ARM linux emulator, there are only three things I change:

  • I installed binary qemu package instead of building from source
  • Those ARM kernels are now 2.6.18-6, guess version will be changed again later on
  • I didn’t install SSH – I’m using console for all the time (check below)

Pretty fun, and on my P4 2.8G Ubuntu it runs pretty smoothly- I guess it runs much more faster than most real ARM single board computers, but I don’t have anything to verify it.

Turning on console took me sometime, as I was lost on host and VM’s setting, actually it is pretty simple:

  • turn on ttyAMA0 in VM, I replaced tty2 with ttyAMA0 in /etc/inittab:
    2:23:respawn:/sbin/getty 38400 ttyAMA0
  • launch the VM without graphic (too much resource), and let VM use ttyAMA0 as console:
    qemu-system-arm -M versatilepb -kernel vmlinuz-2.6.18-6-versatile -initrd initrd.img-2.6.18-6-versatile -hda hda.img -append “console=ttyAMA0 root=/dev/sda1” -serial stdio -nographic

Now after reboot, I have my ARM box now:

$ uname -a
Linux ubuntu 2.6.28-11-generic #42-Ubuntu SMP Fri Apr 17 01:57:59 UTC 2009 i686 GNU/Linux

It does not have full Ubuntu packages, I’m trying to do cross compiling (using GNAT) as I want to use Ada for all its development.

Once everything works I will get a dev board ๐Ÿ™‚

May 022009
 

I believe I just had spent too much time on languages like C and Perl (though I’m not good at Perl at all), so I got enough trouble with strong type language, like Ada, as you can imagine.

I would like to say the problem comes from programming with mixed languages – I’m doing my PPCam project on Windows platform, all APIs, no wonder, are in C format, and I believe things will be the same on Linux though Ada may have better binding for non-GUI libraries. I have all sort of pointers passed to/returned from APIs and get to convert them to corresponding arrays, and this becomes boring due to Ada is a strong type language thus even for similiar types you have to do the same thing again, even as simple as to instantiate a new Unchecked_Conversion. Let me say it again, BORING.

I don’t know what happens to OS X, I got impression that most API there were in Object Pascal format but I never did serious programming on Mac (maybe time to take a try?), but it doesn’t matter at all now as I will spend at least 2/3 of my time on Windows and Linux programming, as best case for OS X is I can take it as 1st tier platform as Windows and Linux.

So using Ada with C is still my destiny, have to live with it, I think I just need to accumulate enough convertors to make things work.

 Posted by at 21:06  Tagged with:
Apr 162009
 

After some tough time dealing with DirectShow stuffs, finally I can preview video from my own web cam now.

There will be something to be tuned at this moment, like how to arrange the command area and video areas, but I believe I’ve overcome one of the most difficult stuff.

There are still three potential headache ahead:

  1. P2P communication, theoratically it won’t be hard as I did it before, but with Ada I have to deal with those UDP stuffs again, just now sure how easy Ada can handle it
  2. Stream video out, means I need to have my own filter, or, maybe I can find an existing one doing that, but again, I’m not sure
  3. Showing streamed video from the other side (the remote window), have no idea so far

A friend told me I can rely on existing protocols like RSTP or MMS, I have the concerns of violating copyright/patents, but I do some research before picking the protocol I’m going to use. At this moment I prefer some cross platform protocol, maybe all of them are, but again (yes, again and again), I’m not sure.

I will try to see if there anyone who can give me some hints on how to do the layout, by now, I will pause the development for couple of days, take some rest, as I’ve made what I promised (preview video by the end of this week). ๐Ÿ™‚

Apr 152009
 

I guess I’ve got all necessary functions from DirectShow for PPCam project, and created a DirectShow binding. It is still partial as I didn’t check other APIs that are unrelated to PPCam project.

I keyed ~1,800 lines of codes today (include blank and comment lines), what I did is reading MSDN, dig out what kind of APIs I need to use, then check Windows SDK to get the C version of declaration, and write binding. There is a great sample from adapower.org, which taught me how to make it.

Actually this is a nice exercise, using Ada doing DirectShow stuffs is actually using C interface. DirectShow is purely COM based so using OO language, especially C++ is the most natual way, but, I still believe using C is the best way to understand what’s inside, and this helps me know more about the whole structure, and do help implementing good programs.

Apr 112009
 

I got a sample from Windows SDK that uses DirectShow to capture video from webcam, it works for now but I’m still reading, just need to know how much it can fit into my PPCam project.

The problem is, I need to make the C program works for me to capture video and put an extra filter to grab data and send to the other end, and after that I need to convert the program from C to Ada. Or, I should start from the sample provided by the SDK and convert it to Ada, then see how to get the extra filter.

I just made the decision to go with the #2 option, it will make more activities in PPCam project, and would let me think more in Ada way.

By the way, I got all my useful search results from Yahoo, it seems to me Yahoo is not that far away from Google in web search, guess we can slowly get market share back.