Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

C programming for TCL geeks.

11 views
Skip to first unread message

Tcl Bliss

unread,
Dec 20, 2009, 9:17:13 PM12/20/09
to
I have had an itch for a long time to start programming in C in order
to create my own extensions for TCL, or, may be even do some core
hacking. I did take C in college many years ago and passed the class
(one semester) without any problems. Of course, I hardly remember any
of it right now but I am sure I can pick it up quickly. What put me
off for years (or scared me away) was all the make, Makefile,
automake, dynamic/static libraries, m4 macros and so on. I have
compiled the Linux kernel and many applications on my own but never
fully understood what was going on.

My question is: If I to start right now, how quickly can I get up to
speed?
Is all that stuff really as complicated as it looks?
And, most important - where do I start? I have the C programming book,
so that is not a problem. Were do I start with all the other stuff?

I would appreciate any/all suggestions.

Robert H

unread,
Dec 20, 2009, 9:43:00 PM12/20/09
to

I would pick a side project to get up to speed. I know that the Gnocl
project would love another C coder.

Robert

Tcl Bliss

unread,
Dec 21, 2009, 5:20:15 PM12/21/09
to

Sid: Wait? Why do I have to be the platypus? Why not make him the
platypus?!
-- From "Ice Age" -- :) :) :)

I will keep it in mind. It seems like a good candidate for Google
Summer Of Code though. Not an easy project to start with.
I am also looking for a good book on improving the source code reading
skills.


Larry W. Virden

unread,
Dec 22, 2009, 7:18:51 AM12/22/09
to
On Dec 20, 9:17 pm, Tcl Bliss <tcl.bl...@gmail.com> wrote:
> What put me
> off for years (or scared me away) was all the make, Makefile,
> automake, dynamic/static libraries, m4 macros and so on. I have
> compiled the Linux kernel and many applications on my own but never
> fully understood what was going on.

Note that make/makefile/automake is not C programming, but one
particular method used for building a C application in a manner to
reduce what a person building the application has to do to get the C
program to build during deployment. Originally, each person who
wanted to build an application would get a note saying "type cc file.c
-Ipath -llibrary -o file" to build the application. However as C ran
on new platforms, people had to make changes to the applications, to
the build commands, etc. the process became more and more complicated.
The make command was created to allow a pseudo scripting of the build
process so that a person wanting to build an application could just
type "make" and not have to worry about the various steps and flags
needed. As time went along, the people writing the code found it more
and more difficult to know all the variations they needed to think
about when creating code that would build and execute the same on
different platforms. The GNU project created a framework with automake
and other tools to help code builders (who have intention on their
code building on many platforms) generate code to do so.

>
> My question is: If I to start right now, how quickly can I get up to
> speed?

Writing C code, particular after having been exposed to C coding
before, isn't bad. Writing C code that interacts with Tcl is learning
about a variety of C functions to call in libtcl. Writing C code that
interacts with Tk is learning another set of library functions (of
course, if you don't know Tk yet, there is also the learning of event
programming that you need to learn).

> Is all that stuff really as complicated as it looks?
> And, most important - where do I start? I have the C programming book,
> so that is not a problem. Were do I start with all the other stuff?

I think this is a great question.

I recommend that you first learn to program Tcl at the script level.
Become comfortable with that. Then if you are thinking about writing
software involving Tk, learn to make use of that as well.

Next, take the Tcl and Tk source distribution. Use these to learn
about using make. Read the included files and follow their
directions.

Next, get the "sample" Tcl extension. This is an example of how to
write some simple C code to interact with Tcl. Take a look at the
actual code. This demonstrates a Tcl extension framework called TEA,
which is a set of defined standards for putting together code so that
it would build and interact with Tcl in an expected manner.

You likely have a book teaching C, after having taking a class in it.
I've seen two books that have talked a bit about building C apps - the
"Tcl and Tk toolkit" book initially written by John Ousterhout and now
recently released with additional material by Ken Jones, and a group
effort book by Welch, Hobbes, and others. I suspect there are other
printed books which cover similar topics.

Ralf Fassel

unread,
Dec 22, 2009, 10:56:47 AM12/22/09
to
* Tcl Bliss <tcl....@gmail.com>

| I have had an itch for a long time to start programming in C in order
| to create my own extensions for TCL,
--<snip-snip>--

| My question is: If I to start right now, how quickly can I get up to
| speed?

Of course that depends on what you want to do. A simple hello-world
extension should run in less than 15 minutes. Maybe start at
http://wiki.tcl.tk/11153

Also a search on http://wiki.tcl.tk/ for "C extension" shows some more
resources.

HTH
R'

Alexandre Ferrieux

unread,
Dec 22, 2009, 11:14:35 AM12/22/09
to

Another approach would be to learn from the Tcl core itself, and in an
useful manner: by tackling bugs !
To do that, just go to the SourceForge project for Tcl (or even Tk),
Trackers -> Bugs, sort by priority, pick one in a field you're
interested in, and dive !
It may feel a bit steep at first sight, but quickly familiarity will
seep in. And you'll be simultaneously learning from (mostly) brilliant
code and helping the community. (Much better than by writing an N+1th
extension doing something a 3-line script can do).

-Alex


Tcl Bliss

unread,
Dec 22, 2009, 1:18:45 PM12/22/09
to
Thank everyone for your input. It is really helpful.

TCC and CRITCL look interesting as a way to create and use C code
quickly.

bobicanprogram

unread,
Jan 1, 2010, 7:46:47 AM1/1/10
to


You might want to check out the iCanProgram Intro to Linux Programming
nofee course at:

http://www.icanprogram.com/linuxProgramming.html

It offers a mixture of Tcl/Tk and C examples along with simple
explanations of build tools like Makefiles etc.

bob

0 new messages