openbcm

Git mirror of https://github.com/Broadcom-Network-Switching-Software/OpenBCM
git clone git://git.finwo.net/mirror/broadcom/openbcm
Log | Files | Refs | README

bcm2c.pl (731B)


      1 # 
      2 #
      3 # This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      4 # 
      5 # Copyright 2007-2019 Broadcom Inc. All rights reserved.
      6 #
      7 # bcm2c - compile config.bcm into static code
      8 
      9 $|=1;
     10 open (BCMFILE, $ARGV[0]) || die " bcm2c: could not open .bcm file[$ARGV[0]]\n";
     11 
     12 print <<'EOT';
     13 /*
     14  * This file is automatically generated by bcm2c.pl.  DO NOT EDIT!
     15  */
     16 #include <sal/appl/config.h>
     17 EOT
     18 $n_vars = 0;
     19 printf("void\nsal_config_init_defaults(void)\n{\n");
     20 while (<BCMFILE>) { 
     21     next if /#/;
     22     ($attr,$val) = split(/=/);
     23     chop $val;
     24     if(($attr ne "") && ($val ne "")){
     25 	printf("\tsal_config_set(\"$attr\",\"$val\");\n");
     26 	$n_vars++;
     27     }
     28 }
     29 print "}\n";