gw wrote:

> 
> Here is my question: Embedding our OLD code into Ruby is how big a chore?
> A lot of this code dates from the late 1980's and is in NO WAY object
> oriented. Python seems like it might let me get away with embedding old
> code without make major complaints. Have any of you attempted to
> incorporate procedural code (tied together with global variables) into
> Ruby? I would understand if knowledgeable programmers plead with me to not
> sully Ruby's name by attempting this Frankenstein. However, I want the
> power of new life for our "specialty verbs" that a modern, supported
> "scripting" language would provide.
> 

It's hard to say how much of a chore it would be without knowing more about
your code. In general it is easier to write Ruby extensions than it is to
write Python extensions.

I assume your "old" code is written in C. (If it isn't C or C++ I think
you're out-of-luck.) I have some experience with C code from the mid-80's
(wrote a great deal of it, inherited a great deal more). I wrote the
RMagick extension, a Ruby binding for ImageMagick. ImageMagick is written
in C and (although the ImageMagick code can in no way be described as
"old") it is definitely not object-oriented. It was not particularly
difficult to create a Ruby extension from it. The methods are generally
very thin layers over the ImageMagick functions, just enough to convert the
arguments from Ruby objects to C data, call the function, and convert the
result as necessary back to a Ruby object. Ruby has a rich set of macros
and functions to convert between Ruby objects and C data. For example, the
NUM2DBL macro takes a Ruby Float object and produces a double. The
rb_float_new() function does the reverse.

Offhand I don't think the global variables will cause you problems except
for threading issues, which you can bypass by simply not running
multi-threaded programs.

Read the "Extending Ruby" chapter in _Programming Ruby_. It's available
online here: http://www.rubycentral.com/book/ext_ruby.html.

You can also get some tips by reading the Ruby library source code files,
like array.c or hash.c. There's also scads of other C extensions you can
look at for guidance. Poke around on RubyForge. Also this newsgroup is full
of infinitely-patient and scarily-smart folks always eager to answer
questions. I know from experience.