Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.0 KiB

  1. use IO::File;
  2. #
  3. # genbasemac.pl
  4. #
  5. # Arguments:
  6. # objdir, modulename, coffbase.txt path
  7. #
  8. # Purpose:
  9. # generates a base.mac to specify the coffbase of a module for use with
  10. # managed code (e.g. CS compiler)
  11. #
  12. # Returns: 0 if success, non-zero otherwise
  13. #
  14. $argc = @ARGV;
  15. die "Usage: genbasemac objdir modulename coffbase-path\n" if ( $argc < 3 );
  16. $MacFileName = $ARGV[0] . "\\coffbase.mac";
  17. $ModuleName = $ARGV[1];
  18. $CoffbaseFile = $ARGV[2];
  19. open( FH, "<$CoffbaseFile" ) or die "ERROR: $CoffbaseFile does not exist.\n";
  20. while(<FH>)
  21. {
  22. if (m/^[;\s*]{0}$ModuleName\s+((0x[0-9a-fA-F]+)|([0-9]+))\s+((0x[0-9a-fA-F]+)|([0-9]+))/i)
  23. {
  24. @coffbase=split();
  25. }
  26. }
  27. close(FH);
  28. $coffbase = @coffbase;
  29. if ($coffbase > 1)
  30. {
  31. open( FH, ">$MacFileName" );
  32. print FH "#\n# Auto-generated COFFBASE from $CoffbaseFile \n";
  33. print FH "#\n# Module: $ModuleName \n#\n";
  34. print FH "MANAGED_COFFBASE=$coffbase[1]\n";
  35. close( FH );
  36. }
  37. else
  38. {
  39. print "genbasemac: module $ModuleName not found in $CoffbaseFile\n";
  40. }
  41. exit( 0 );