From: gw Date: 2005-01-01T07:45:56+09:00 Subject: Re: wrapping Ruby around OLD code >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. > >I think that's well possible, but can not say for sure -- could you post >some sample code? Oh, and are you planning to port the old code manually >to Ruby? It might be possible to automate that step. > I really would rather not get into details until someone who has attempted to embed some "old" code responds. Our "special" verbs could even exist as separate OS executable which write a file with relevant results which Ruby could then read to maintain an datatype. These "special" verbs always do quite a bit of work and the results are not typically voluminous. They often modify a separate "picture" file. One could think of it as sculpting and transforming a multi-image greyscale image and what is needed via Ruby is a way to keep track of a list of variables that describe the state of that multi-image file. There are like.... 500? such variables, some of which are arrays of basic types like integers and reals. I fully expect to automate the process of gluing these special verbs into ruby. Before I do ANYTHING though (like write something in Ruby other than puts "hello world") I am looking to see if there is a trap into which I will fall "for sure" attempting to do this. In the past the guys I worked with figured we could crudely wrap our old stuff with expect. Worked pretty good. Only had to come up with maybe 5 new pieces of code to get a passable thing. Later, at our leisure we could (if ever) integrate the script into compiled code so it would run 10x faster. Ruby has the promise of making that step easily done. This weekend I guess I'll look for an example of making a hw.c whose only method is "talk" and when activated will print "hello world" and see how hard that is to push into Ruby (at least naively that is how this search will start). George