I understand your skepticism, it seems impossible, and I totally agree 
it DOES seem impossible, yet that is what I am seeing.

I thought maybe I had done something wrong, so I recreated my experiment 
(I had already deleted the file).  I was running it from Eclipse, so I 
opened a DOS window and ran it directly and got the same result.

The script is too large to post, but what it does is read C header files 
and generates an array of these "structs" which have two strings: the 
type and the name of a typedef.  It then goes through the list making 
them to be somewhat "primary" types for another script to process.  Here 
are some examples of the output:

float    UBT_Feet_Type
uint_8    UBT_Turn_Directions_Type
struct    NCBYTERD_PositionConvRecType
uint_32    NCTPLYGN_PolygonIterationsType
struct[4]  NCTPLYGN_QuadralateralPolygonVerticesType
struct    NCTPLYGN_QuadralateralClassType
struct[8]  NCTPLYGN_QuadralateralPolygonSetType
uint_8    NCPRMYTP_DataStatusType
double    NCPRMYTP_DegreesType
enum    NCPRMYTP_PeriodsTypeEnum

One thing I just noticed is that the script with the Struct class 
doesn't work correctly.  It doesn't make the types "primary" and it 
doesn't generate as many lines.  Obviously, there's something I don't 
understand about how to use Struct.

Here is the difference between the 2 scripts.  The array

FILE COMPARISON
Produced: 10/16/2007 1:27:12 PM

Mode:  Just Differences

Left file: C:\workspace\CreateSfct\h_file_types_diff.txt     Right file: 
C:\workspace\CreateSfct\h_file_types (before struct mod).rb
L19  $typedef_rec    = Struct.new("Typedef", :typedef_type, 
:typedef_name)
R19  TYPEDEF_TYPE    = 0
     TYPEDEF_NAME    = 1
------------------------------------------------------------------------
------------------------------------------------------------------------
L74        typedef_type = type_arr[j][:typedef_type]
           typedef_name = type_arr[j][:typedef_name]
R75        typedef_type = type_arr[j][TYPEDEF_TYPE]
           typedef_name = type_arr[j][TYPEDEF_NAME]
------------------------------------------------------------------------
------------------------------------------------------------------------
L88            type_arr[j][:typedef_type].sub!(/\w+/, primary_t)
R89            type_arr[j][TYPEDEF_TYPE].sub!(/\w+/, primary_t)
------------------------------------------------------------------------
------------------------------------------------------------------------
L91        if type_arr[j][:typedef_type] =~ /\[([A-Z]\w*)\]/ then
             type_arr[j][:typedef_type].sub!($1,define_lookup($1,define_hash))
R92        if type_arr[j][TYPEDEF_TYPE] =~ /\[([A-Z]\w*)\]/ then
             type_arr[j][TYPEDEF_TYPE].sub!($1,define_lookup($1,define_hash))
------------------------------------------------------------------------
------------------------------------------------------------------------
L186       return $typedef_rec.new("enum", enum_name)
R187       return ["enum", enum_name]
------------------------------------------------------------------------
------------------------------------------------------------------------
L202       return $typedef_rec.new(typedef_type, typedef_name)
R203       return [typedef_type, typedef_name]
------------------------------------------------------------------------
------------------------------------------------------------------------
L546     type_arr.each do |x|
           print(x[:typedef_type], "\t\t", x[:typedef_name], "\n")
R547     type_arr.each do |typedef_type, typedef_name|
           print(typedef_type, "\t\t", typedef_name, "\n")
------------------------------------------------------------------------
-- 
Posted via http://www.ruby-forum.com/.