next up previous contents index
Next: Data Dictionary Up: Code Previous: ir2classes.pl

dict2xh.pl

#!/usr/local/bin/perl

while (<>) {
    /^([^ ]*) *(.*)$/;
    $classname = $1;
    $username = $2;
    STDERR << $classname ;
    if ((/CLASS/) || (/----/))
    {
        print"";
    }
    else 
    {
        @attribs = `bhgqdict -c "$classname" 
                             -a /usr/lpp/cicssm/data/bhgsm.dict`;
        
        print "\n\n/***************************************/\n";
        print "\n class $classname\n { \t\t /* $username */ \n";
        for (@attribs)
        {
            /^([^ ]*) *([^ ]*) *(.*)$/;
            $attrib = $1;       
            $attr_type = $2;
            $username = $3;

            if ((/ATTRIBUTE/) || (/------/))
            { 
                print"\t\t\t /* Attributes */\n";
            }
            else 
            {
                print"     $attr_type \t\t $attrib;\t/* $username */\n";
            }
        }

    @allmethods = `bhgqdict -c "$classname" 
                            -m /usr/lpp/cicssm/data/bhgsm.dict`;
    for (@allmethods)
    {
        if ((/METHOD/) || (/-----------/))
        {
            print"\t\t /* METHODS */\n"; 
        }
        else 
        {
            if (/(.*)/)
            {
                /^([^ ]*) *(.*)$/;
                $methodname = $1;
                $username = $2;
                
                @methodparm = `bhgqdict 
                               -c "$classname" 
                               -m "$methodname" 
                               -p /usr/lpp/cicssm/data/bhgsm.dict`;
                print"\t\t\t /* METHOD: $username */\n";
                print "     void\t $methodname(";
                $kommaflag = 0;
                
                for (@methodparm)
                {
                    if ((/PARAM/) || (/----/))
                    {
                        print"";
                    }
                    else
                    {
                        /^([^ ]*) *([^ ]*) *([^ ]*) *(.*)$/;
                        $parmname = $1;
                        $parmtype = $2;
                        $direction = $3;
                        $parmdescript = $4;
                        if ($kommaflag == 1){
                            print ", "; }
                        print"\n\t\t $parmtype\t $parmname\t 
                                              /* $parmdescript */";
                        $kommaflag = 1;
                    }
                }              # for (@methodparm) 
            }              # if (/(.*)/) 
            print");\n";
        }              #  else 
    }             #  for (@allmethods) 
        
    @relations = `bhgqdict -c "$classname" 
                           -r /usr/lpp/cicssm/data/bhgsm.dict`;
    for (@relations)
    {
        if ((/RELATIONSHIP/) || (/-----------/))
        {
            print"\t\t\t /* RELATIONSHIPS */\n"; 
        }
        else 
        {
            if (/(.*)/)
            {
                /^([+|-])([^ ]*) *([^ ]*) *(.*)$/;
                $plusminus = $1;
                $relname = $2;
                $relclass = $3;
                $reldesc = $4;

                print"\t\t\t /* $reldesc*/\n"; 
                print" $relclass *\t $relname; \t /* 
                       $reldesc */\n";
            }
        }                     # else  
    }                    # for (@relations) 


    print "\n }; /* end of class $classname */ \n";
#    print "\n/******************************************/\n";
    print "";
    }
}
 



Copyright Munich Network Management Team