[Tinyos-commits] CVS: tinyos-1.x/tos/lib/VM/languages/motlle/tools genfns.pl, 1.3, 1.4

David Gay idgay at users.sourceforge.net
Tue Oct 25 15:33:23 PDT 2005


Update of /cvsroot/tinyos/tinyos-1.x/tos/lib/VM/languages/motlle/tools
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26029/tools

Modified Files:
	genfns.pl 
Log Message:
-s option to mload to specify scheme code


Index: genfns.pl
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/tos/lib/VM/languages/motlle/tools/genfns.pl,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** genfns.pl	25 Oct 2005 00:39:11 -0000	1.3
--- genfns.pl	25 Oct 2005 22:33:21 -0000	1.4
***************
*** 8,23 ****
  $target = shift @ARGV;
  
  while (<>)
  {
      chomp;
      if (/^module\s+(\w+)/) {
! 	$module = $1;
! 	$configuration = $module;
  	$configuration =~ s/M$//;
      }
      if (/^\s*\/\/FN\s+(.*)/) {
! 	if (!defined $module) {
! 	    print STDERR "$ARGV:$.: Module name unknown.\n";
! 	    $module = $configuration = "unknown";
  	    $error = 1;
  	}
--- 8,28 ----
  $target = shift @ARGV;
  
+ $dir = `dirname $target`;
+ chomp $dir;
+ 
  while (<>)
  {
      chomp;
      if (/^module\s+(\w+)/) {
! 	$configuration = $1;
  	$configuration =~ s/M$//;
      }
+     if (/^configuration\s+(\w+)/) {
+ 	$configuration = $1;
+     }
      if (/^\s*\/\/FN\s+(.*)/) {
! 	if (!defined $configuration) {
! 	    print STDERR "$ARGV:$.: Component name unknown.\n";
! 	    $configuration = "unknown";
  	    $error = 1;
  	}
***************
*** 55,58 ****
--- 60,66 ----
  		    $interface{$fn} = $1;
  		}
+ 		elsif (/interface\s+MateBytecode\s+as\s+(\w+)\s*;/) {
+ 		    $interface{$fn} = $1;
+ 		}
  		else {
  		    $msg = "command for $fn not found on next line";
***************
*** 76,80 ****
      if (eof) {
  	close ARGV;
! 	undef $module;
      }
  }
--- 84,88 ----
      if (eof) {
  	close ARGV;
! 	undef $configuration;
      }
  }
***************
*** 82,86 ****
  exit 2 if $error;
  
! mkdir "gen";
  
  die unless open(ALLFNS, ">$target");
--- 90,94 ----
  exit 2 if $error;
  
! mkdir $dir;
  
  die unless open(ALLFNS, ">$target");
***************
*** 90,95 ****
      print "$fn: numparams=$numparams{$fn} returnval=$returnval{$fn} desc=\"$help\"\n";
  
!     $cname = "m$fn";
      $cname =~ tr/A-Z/a-z/;
      $cname =~ s/[-\$]/_/g;
      $cname =~ s/\?/p/g;
--- 98,104 ----
      print "$fn: numparams=$numparams{$fn} returnval=$returnval{$fn} desc=\"$help\"\n";
  
!     $cname = "mf_$fn";
      $cname =~ tr/A-Z/a-z/;
+     $cname =~ s/->/2/g;
      $cname =~ s/[-\$]/_/g;
      $cname =~ s/\?/p/g;
***************
*** 107,114 ****
      print ALLFNS "<FUNCTION name=$cname>\n";
  
!     die unless open (ODF, ">gen/OP$cname.odf");
!     print ODF "<FUNCTION name=$cname opcode=$cname username=$fn numparams=$numparams{$fn} returnval=$returnval{$fn} desc=\"$help\">\n";
      close ODF;
!     die unless open (OPNC, ">gen/OP$cname.nc");
      print OPNC <<CONF;
  configuration OP$cname {
--- 116,123 ----
      print ALLFNS "<FUNCTION name=$cname>\n";
  
!     die unless open (ODF, ">$dir/OP$cname.odf");
!     print ODF "<FUNCTION name=$cname opcode=$cname username=\"$fn\" numparams=$numparams{$fn} returnval=$returnval{$fn} desc=\"$help\">\n";
      close ODF;
!     die unless open (OPNC, ">$dir/OP$cname.nc");
      print OPNC <<CONF;
  configuration OP$cname {



More information about the Tinyos-commits mailing list