sbsv1_os/e32toolp/e32util/preprocessor.pm
changeset 0 83f4b4db085c
child 1 d4b442d23379
equal deleted inserted replaced
-1:000000000000 0:83f4b4db085c
       
     1 # Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 # All rights reserved.
       
     3 # This component and the accompanying materials are made available
       
     4 # under the terms of "Eclipse Public License v1.0"
       
     5 # which accompanies this distribution, and is available
       
     6 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 #
       
     8 # Initial Contributors:
       
     9 # Nokia Corporation - initial contribution.
       
    10 #
       
    11 # Contributors:
       
    12 #
       
    13 # Description:
       
    14 # prepocessor.pm
       
    15 # Used to allow us to access and manipulate other pre processors
       
    16 # 
       
    17 #
       
    18 
       
    19 package Preprocessor;
       
    20 
       
    21 require Exporter;
       
    22 @ISA=qw(Exporter);
       
    23 
       
    24 @EXPORT=qw(
       
    25 	PreprocessorToUseId PreprocessorToUseExe PreprocessorToUsePath 
       
    26 );
       
    27 
       
    28 
       
    29 
       
    30 #
       
    31 # Returns the preprocessor name.
       
    32 # (After checking it is valid)
       
    33 #
       
    34 sub PreprocessorToUseId()
       
    35 {
       
    36     $env="0";
       
    37     if (defined $ENV{ALT_PRE})
       
    38     {
       
    39 	$env = $ENV{ALT_PRE};
       
    40     }
       
    41     
       
    42     if ( $env eq "1" ) # Only a value of 1 will use alternative preprocessor
       
    43     {
       
    44         return "MINGW_NO_CYGWIN";
       
    45     }
       
    46     else
       
    47     {
       
    48         return "DEFAULT";
       
    49     }
       
    50 }
       
    51 
       
    52 
       
    53 
       
    54 #
       
    55 # Returns the preprocessor exe name.
       
    56 # without the exe extension.
       
    57 #
       
    58 
       
    59 
       
    60 sub PreprocessorToUseExe()
       
    61 {
       
    62     $env = &PreprocessorToUseId();
       
    63     
       
    64     if ( ($env eq "DEFAULT") )
       
    65     {
       
    66         return "cpp";
       
    67     }
       
    68     elsif ( $env eq "MINGW_NO_CYGWIN" )
       
    69     {
       
    70         return "scpp";
       
    71     }
       
    72 }
       
    73 
       
    74 
       
    75 
       
    76 
       
    77 #
       
    78 # Returns the full path and exe of the preprocessor relative to the 
       
    79 # gcc\bin path.
       
    80 #
       
    81 sub PreprocessorToUsePath()
       
    82 {
       
    83     $env = &PreprocessorToUseId();
       
    84 
       
    85     if ( ($env eq "") || ($env eq "DEFAULT") )
       
    86     {
       
    87         return "";
       
    88     }
       
    89     elsif ( $env eq "MINGW_NO_CYGWIN" )
       
    90     {
       
    91         return ""; # Currently same path as default (different name though !)
       
    92     }
       
    93     else
       
    94     { # Nothing really to use.
       
    95         die
       
    96             "Unable to find the correct pre processor\n",
       
    97     }
       
    98 }
       
    99 
       
   100 
       
   101 1;