I am an amateur try to hack together a little project. It is a simple note storage and retrieval console app on Windows Vista (and XP – i’m hoping to run the whole thing off a USB Stick).
I use Sqlite as the store and Tcl/SQL scripts to add notes (and tags!) and also retrieve them by tag. 3 tables and a “Toxi” schema.
So anyway… I want to use it from either a “dos prompt” or more frequently tclsh (NOT wish!) I don’t want the windowing shell or to use TK at all. But to help visually distinguish some things, stdin from stdout, notes from timestamps, etc, I want to change the font color on-the-fly with some kind of crude markup.
I found a c++ project that will do exactly this! Jaded Hobo put it up on: http://www.codeproject.com/script/Articles/ViewDownloads.aspx?aid=9130. Jaded Hobo says the header file “Console.H” is sufficient to include in a c++ project, but he doesn’t know TCL.
I found SWIG, the interface compiler, and I’m going to give it a try. But I’m clueless on a few things:
-
Can just a header file be enough?
-
The SWIG Win32 examples aren’t as edifying as the ‘nix example and they use MS VC++ (VStudio)- I want to use Quincy/MinGW.
(Oh, btw this is my first ever attempt at using C of any kind. So can you show how to use SWIG with Quincy?)
-
How can I glean from the header source just what the heck to type in my Tcl script to use it?
Thank you for reading this, let alone answering. I started to put it on comp.lang.tcl but I don’t like my email addr broadcast like that.
A header isn’t enough by itself. On the other hand, you really don’t need to go to all that much work since this page indicates that the API is actually really simple. Here’s the C code that you need:
Compile this up into a DLL (it’s got no fancy dependencies at all, beyond Tcl itself) called
consolecolor.dll(the name should match the entry point function somewhat) and then you’ll be able to use theloadcommand to import the newconsolecolorcommand into your code, like this:For a guide to how to pick colors, see this MSDN page.