1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

#if defined INTEL_W32

Discussion in 'C' started by jennifer123, Jun 25, 2007.

  1. jennifer123

    jennifer123 New Member

    Joined:
    Jun 25, 2007
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    Hello every one, I am using visual C++ tool to debug the following code. However, during a line by line debug, the execution flow DOES NOT move to (#if defined INTEL_W32 ). I am using visual C++ on windows XP .
    Can any one kindly tell me what is the MEANING of

    #if defined INTEL_W32
    ===============================================
    Debugging following program:

    Code:
    #if defined INTEL_W32
    
    static Boolean fFirstTime = FALSE;
    UInt32 ulLinearAddress;
    UInt32 offset;
    
    // Always register the atexit routine at least once, so any allocated
    // resources are guaranteed to be released and freed. The function
    // halpFreeLinearAddress is fully reentrant, so it can be called
    // multiple times, in any order, without causing any harm.
    if (!fFirstTime)
    { fFirstTime = TRUE;
    printf("fFirstTime = %d \n",fFirstTime); // added
    atexit(halpFreeLinearAddress);
    }
    
    
    // Use the configured register address to retrieve the linear address.
    // NOTE: for PCI the register address should be zero, causing the VxD
    // to locate the S1D13A05 in PCI address space.
    
    if (HalInfo.dwRegisterAddress > HalInfo.dwMemoryAddress)
    {
    	gnHalErrCode = halpGetLinearAddress(HalInfo.dwMemoryAddress, &ulLinearAddress);
    	
    	
    	
    	if (gnHalErrCode != ERR_NONE)
    		return FALSE;
    	
    	offset = HalInfo.dwRegisterAddress - HalInfo.dwMemoryAddress;
    	
    	if (offset == 0)
    		offset = 0x200000;
    	
    	gpHalMemAddr = (pvUInt32) ulLinearAddress;
    	gpHalRegAddr = (pvUInt32)(ulLinearAddress + offset);
    	
    	
    }
    else
    {
    	gnHalErrCode = halpGetLinearAddress(HalInfo.dwRegisterAddress, &ulLinearAddress);
    	
    	if (gnHalErrCode != ERR_NONE)
    		return FALSE;
    	
    	offset = HalInfo.dwMemoryAddress - HalInfo.dwRegisterAddress;
    	
    	if (offset == 0)
    		offset = 0x200000;
    	
    	gpHalRegAddr = (pvUInt32) ulLinearAddress;
    	gpHalMemAddr = (pvUInt32)(ulLinearAddress + offset);
    	
    	printf ("<<<<<<<<<gpHalMemAddr, %d \n",gpHalMemAddr); // added
    	printf ("<<<<<<<<<gpHalRegAddr, %d \n",gpHalRegAddr); //added
    	
    	
    }
    
    if (pReg)
    *pReg = (UInt32) gpHalRegAddr;
    
    if (pMem)
    *pMem = (UInt32) gpHalMemAddr;
    #else
    
    // ********DEBUGGING WILL CONTINUE FROM HERE ******
    
    gpHalRegAddr = (pvUInt32) HalInfo.dwRegisterAddress; gpHalMemAddr = (pvUInt32) HalInfo.dwMemoryAddress;
    
    if (pReg)
    *pReg = HalInfo.dwRegisterAddress;
    
    
    if (pMem)
    *pMem = HalInfo.dwMemoryAddress;
    
    
    
    
    #endif
    
    return TRUE;
    
    }
     
    Last edited by a moderator: Jun 25, 2007
  2. DaWei

    DaWei New Member

    Joined:
    Dec 6, 2006
    Messages:
    835
    Likes Received:
    5
    Trophy Points:
    0
    Occupation:
    Semi-retired EE
    Location:
    Texan now in Central NY
    Home Page:
    Statements that begin with # are preprocessor directives. They are processed before the compiler sees the source code. For example, #include <afile> causes the contents of afile to be pasted directly into the source at the point of inclusion. #define myLength 10 causes every occurrence of the word, myLength, to be replaced with the text, 10. All these things are done before the compiler compiles, the linker links.

    In the case of #if defined INTEL_W32 (or, usually, just #ifdef INTEL_W32), any material between the #if and a #else or #endif will be included in the source code IF there has been a previous statement defining INTEL_W32. If that value has not been defined, the material will not be included. Obviously, if the material is not included, the code will not be compiled, no executable statements will result.

    You should take an hour or so and learn what actually happens in the steps that occur between the pounding of the keyboard and the execution of machine-code statements.
     
  3. jennifer123

    jennifer123 New Member

    Joined:
    Jun 25, 2007
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    thank you for replying.... i am sure i understand the purpose of #if defined and #else. BUT WHAT is the meaning of INTEL_W32 does it mean one has to use windows XP or windows 98.

    Does 32 refers to the architecture which we are using ? or if there is any platform requirement (like windows 98 or windows XP ) to compile.
     

Share This Page