]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Demo/WIN32-MSVC/main_full.c
Update linker script so main stack starts on 8-byte alignment.
[freertos] / FreeRTOS / Demo / WIN32-MSVC / main_full.c
index 2f1fb6653c7215cd75422ce5899d3f7576da7740..d1270f092b6f46178b07474d3be0d6b92329aa30 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
-    FreeRTOS V8.2.0rc1 - Copyright (C) 2014 Real Time Engineers Ltd.\r
+    FreeRTOS V9.0.1 - Copyright (C) 2017 Real Time Engineers Ltd.\r
     All rights reserved\r
 \r
     VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
@@ -8,29 +8,20 @@
 \r
     FreeRTOS is free software; you can redistribute it and/or modify it under\r
     the terms of the GNU General Public License (version 2) as published by the\r
-    Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.\r
+    Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception.\r
 \r
+    ***************************************************************************\r
     >>!   NOTE: The modification to the GPL is included to allow you to     !<<\r
     >>!   distribute a combined work that includes FreeRTOS without being   !<<\r
     >>!   obliged to provide the source code for proprietary components     !<<\r
     >>!   outside of the FreeRTOS kernel.                                   !<<\r
+    ***************************************************************************\r
 \r
     FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY\r
     WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\r
     FOR A PARTICULAR PURPOSE.  Full license text is available on the following\r
     link: http://www.freertos.org/a00114.html\r
 \r
-    1 tab == 4 spaces!\r
-\r
-    ***************************************************************************\r
-     *                                                                       *\r
-     *    Having a problem?  Start by reading the FAQ "My application does   *\r
-     *    not run, what could be wrong?".  Have you defined configASSERT()?  *\r
-     *                                                                       *\r
-     *    http://www.FreeRTOS.org/FAQHelp.html                               *\r
-     *                                                                       *\r
-    ***************************************************************************\r
-\r
     ***************************************************************************\r
      *                                                                       *\r
      *    FreeRTOS provides completely free yet professionally developed,    *\r
      *                                                                       *\r
     ***************************************************************************\r
 \r
-    ***************************************************************************\r
-     *                                                                       *\r
-     *   Investing in training allows your team to be as productive as       *\r
-     *   possible as early as possible, lowering your overall development    *\r
-     *   cost, and enabling you to bring a more robust product to market     *\r
-     *   earlier than would otherwise be possible.  Richard Barry is both    *\r
-     *   the architect and key author of FreeRTOS, and so also the world's   *\r
-     *   leading authority on what is the world's most popular real time     *\r
-     *   kernel for deeply embedded MCU designs.  Obtaining your training    *\r
-     *   from Richard ensures your team will gain directly from his in-depth *\r
-     *   product knowledge and years of usage experience.  Contact Real Time *\r
-     *   Engineers Ltd to enquire about the FreeRTOS Masterclass, presented  *\r
-     *   by Richard Barry:  http://www.FreeRTOS.org/contact\r
-     *                                                                       *\r
-    ***************************************************************************\r
+    http://www.FreeRTOS.org/FAQHelp.html - Having a problem?  Start by reading\r
+    the FAQ page "My application does not run, what could be wrong?".  Have you\r
+    defined configASSERT()?\r
 \r
-    ***************************************************************************\r
-     *                                                                       *\r
-     *    You are receiving this top quality software for free.  Please play *\r
-     *    fair and reciprocate by reporting any suspected issues and         *\r
-     *    participating in the community forum:                              *\r
-     *    http://www.FreeRTOS.org/support                                    *\r
-     *                                                                       *\r
-     *    Thank you!                                                         *\r
-     *                                                                       *\r
-    ***************************************************************************\r
+    http://www.FreeRTOS.org/support - In return for receiving this top quality\r
+    embedded software for free we request you assist our global community by\r
+    participating in the support forum.\r
 \r
-    http://www.FreeRTOS.org - Documentation, books, training, latest versions,\r
-    license and Real Time Engineers Ltd. contact details.\r
+    http://www.FreeRTOS.org/training - Investing in training allows your team to\r
+    be as productive as possible as early as possible.  Now you can receive\r
+    FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers\r
+    Ltd, and the world's leading authority on the world's leading RTOS.\r
 \r
     http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
     including FreeRTOS+Trace - an indispensable productivity tool, a DOS\r
@@ -82,7 +56,7 @@
     http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.\r
     Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.\r
 \r
-    http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High\r
+    http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High\r
     Integrity Systems ltd. to sell under the OpenRTOS brand.  Low cost OpenRTOS\r
     licenses offer ticketed support, indemnification and commercial middleware.\r
 \r
 \r
 /*\r
  *******************************************************************************\r
- * NOTE 1: The Win32 port is a simulation (or is that emulation?) only!  Do not\r
- * expect to get real time behaviour from the Win32 port or this demo\r
- * application.  It is provided as a convenient development and demonstration\r
- * test bed only.  This was tested using Windows XP on a dual core laptop.\r
- *\r
- * Windows will not be running the FreeRTOS simulator threads continuously, so\r
- * the timing information in the FreeRTOS+Trace logs have no meaningful units.\r
- * See the documentation page for the Windows simulator for an explanation of\r
- * the slow timing:\r
+ * NOTE: Windows will not be running the FreeRTOS demo threads continuously, so\r
+ * do not expect to get real time behaviour from the FreeRTOS Windows port, or\r
+ * this demo application.  Also, the timing information in the FreeRTOS+Trace\r
+ * logs have no meaningful units.  See the documentation page for the Windows\r
+ * port for further information:\r
  * http://www.freertos.org/FreeRTOS-Windows-Simulator-Emulator-for-Visual-Studio-and-Eclipse-MingW.html\r
- * - READ THE WEB DOCUMENTATION FOR THIS PORT FOR MORE INFORMATION ON USING IT -\r
  *\r
  * NOTE 2:  This project provides two demo applications.  A simple blinky style\r
  * project, and a more comprehensive test and demo application.  The\r
  * "Check" task - This only executes every five seconds but has a high priority\r
  * to ensure it gets processor time.  Its main function is to check that all the\r
  * standard demo tasks are still operational.  While no errors have been\r
- * discovered the check task will print out "OK" and the current simulated tick\r
- * time.  If an error is discovered in the execution of a task then the check\r
- * task will print out an appropriate error message.\r
+ * discovered the check task will print out "No Errors" along with some system\r
+ * status information.  If an error is discovered in the execution of a task\r
+ * then the check task will print out an appropriate error message.\r
  *\r
  */\r
 \r
 #include "EventGroupsDemo.h"\r
 #include "IntSemTest.h"\r
 #include "TaskNotify.h"\r
+#include "QueueSetPolling.h"\r
+#include "StaticAllocation.h"\r
+#include "blocktim.h"\r
+#include "AbortDelay.h"\r
 \r
 /* Priorities at which the tasks are created. */\r
 #define mainCHECK_TASK_PRIORITY                        ( configMAX_PRIORITIES - 2 )\r
@@ -201,19 +174,34 @@ static void prvDemonstrateTaskStateAndHandleGetFunctions( void );
 static void prvDemonstratePendingFunctionCall( void );\r
 \r
 /*\r
- * The function that is pended by prvDemonstratePendingFunctionCall().\r
- */\r
+* The function that is pended by prvDemonstratePendingFunctionCall().\r
+*/\r
 static void prvPendedFunction( void *pvParameter1, uint32_t ulParameter2 );\r
 \r
+/*\r
+ * prvDemonstrateTimerQueryFunctions() is called from the idle task hook\r
+ * function to demonstrate the use of functions that query information about a\r
+ * software timer.  prvTestTimerCallback() is the callback function for the\r
+ * timer being queried.\r
+ */\r
+static void prvDemonstrateTimerQueryFunctions( void );\r
+static void prvTestTimerCallback( TimerHandle_t xTimer );\r
+\r
 /*\r
  * A task to demonstrate the use of the xQueueSpacesAvailable() function.\r
  */\r
 static void prvDemoQueueSpaceFunctions( void *pvParameters );\r
 \r
+/*\r
+ * Tasks that ensure indefinite delays are truly indefinite.\r
+ */\r
+static void prvPermanentlyBlockingSemaphoreTask( void *pvParameters );\r
+static void prvPermanentlyBlockingNotificationTask( void *pvParameters );\r
+\r
 /*-----------------------------------------------------------*/\r
 \r
 /* The variable into which error messages are latched. */\r
-static char *pcStatusMessage = "OK";\r
+static char *pcStatusMessage = "No errors";\r
 \r
 /* This semaphore is created purely to test using the vSemaphoreDelete() and\r
 semaphore tracing API functions.  It has no other purpose. */\r
@@ -240,9 +228,20 @@ int main_full( void )
        vStartDynamicPriorityTasks();\r
        vStartQueueSetTasks();\r
        vStartQueueOverwriteTask( mainQUEUE_OVERWRITE_PRIORITY );\r
-       xTaskCreate( prvDemoQueueSpaceFunctions, "QSpace", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );\r
        vStartEventGroupTasks();\r
        vStartInterruptSemaphoreTasks();\r
+       vStartQueueSetPollingTask();\r
+       vCreateBlockTimeTasks();\r
+       vCreateAbortDelayTasks();\r
+       xTaskCreate( prvDemoQueueSpaceFunctions, "QSpace", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );\r
+       xTaskCreate( prvPermanentlyBlockingSemaphoreTask, "BlockSem", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );\r
+       xTaskCreate( prvPermanentlyBlockingNotificationTask, "BlockNoti", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );\r
+\r
+       #if( configSUPPORT_STATIC_ALLOCATION == 1 )\r
+       {\r
+               vStartStaticallyAllocatedTasks();\r
+       }\r
+       #endif\r
 \r
        #if( configUSE_PREEMPTION != 0  )\r
        {\r
@@ -264,16 +263,16 @@ int main_full( void )
        /* Start the scheduler itself. */\r
        vTaskStartScheduler();\r
 \r
-    /* Should never get here unless there was not enough heap space to create\r
+       /* Should never get here unless there was not enough heap space to create\r
        the idle and other system tasks. */\r
-    return 0;\r
+       return 0;\r
 }\r
 /*-----------------------------------------------------------*/\r
 \r
 static void prvCheckTask( void *pvParameters )\r
 {\r
 TickType_t xNextWakeTime;\r
-const TickType_t xCycleFrequency = 2500 / portTICK_PERIOD_MS;\r
+const TickType_t xCycleFrequency = pdMS_TO_TICKS( 2500UL );\r
 \r
        /* Just to remove compiler warning. */\r
        ( void ) pvParameters;\r
@@ -310,10 +309,10 @@ const TickType_t xCycleFrequency = 2500 / portTICK_PERIOD_MS;
                {\r
                        pcStatusMessage = "Error: EventGroup";\r
                }\r
-           else if( xAreIntegerMathsTaskStillRunning() != pdTRUE )\r
-           {\r
+               else if( xAreIntegerMathsTaskStillRunning() != pdTRUE )\r
+               {\r
                        pcStatusMessage = "Error: IntMath";\r
-           }\r
+               }\r
                else if( xAreGenericQueueTasksStillRunning() != pdTRUE )\r
                {\r
                        pcStatusMessage = "Error: GenQueue";\r
@@ -326,20 +325,20 @@ const TickType_t xCycleFrequency = 2500 / portTICK_PERIOD_MS;
                {\r
                        pcStatusMessage = "Error: BlockQueue";\r
                }\r
-           else if( xAreSemaphoreTasksStillRunning() != pdTRUE )\r
-           {\r
+               else if( xAreSemaphoreTasksStillRunning() != pdTRUE )\r
+               {\r
                        pcStatusMessage = "Error: SemTest";\r
-           }\r
-           else if( xArePollingQueuesStillRunning() != pdTRUE )\r
-           {\r
+               }\r
+               else if( xArePollingQueuesStillRunning() != pdTRUE )\r
+               {\r
                        pcStatusMessage = "Error: PollQueue";\r
-           }\r
+               }\r
                else if( xAreMathsTaskStillRunning() != pdPASS )\r
                {\r
                        pcStatusMessage = "Error: Flop";\r
                }\r
-           else if( xAreRecursiveMutexTasksStillRunning() != pdTRUE )\r
-           {\r
+               else if( xAreRecursiveMutexTasksStillRunning() != pdTRUE )\r
+               {\r
                        pcStatusMessage = "Error: RecMutex";\r
                }\r
                else if( xAreCountingSemaphoreTasksStillRunning() != pdTRUE )\r
@@ -362,10 +361,32 @@ const TickType_t xCycleFrequency = 2500 / portTICK_PERIOD_MS;
                {\r
                        pcStatusMessage = "Error: Queue overwrite";\r
                }\r
+               else if( xAreQueueSetPollTasksStillRunning() != pdPASS )\r
+               {\r
+                       pcStatusMessage = "Error: Queue set polling";\r
+               }\r
+               else if( xAreBlockTimeTestTasksStillRunning() != pdPASS )\r
+               {\r
+                       pcStatusMessage = "Error: Block time";\r
+               }\r
+               else if( xAreAbortDelayTestTasksStillRunning() != pdPASS )\r
+               {\r
+                       pcStatusMessage = "Error: Abort delay";\r
+               }\r
+\r
+               #if( configSUPPORT_STATIC_ALLOCATION == 1 )\r
+                       else if( xAreStaticAllocationTasksStillRunning() != pdPASS )\r
+                       {\r
+                               pcStatusMessage = "Error: Static allocation";\r
+                       }\r
+               #endif /* configSUPPORT_STATIC_ALLOCATION */\r
 \r
                /* This is the only task that uses stdout so its ok to call printf()\r
                directly. */\r
-               printf( "%s - %d\r\n", pcStatusMessage, xTaskGetTickCount() );\r
+               printf( "%s - tick count %d - free heap %d - min free heap %d\r\n", pcStatusMessage,\r
+                                                                                                                                                       xTaskGetTickCount(),\r
+                                                                                                                                                       xPortGetFreeHeapSize(),\r
+                                                                                                                                                       xPortGetMinimumEverFreeHeapSize() );\r
        }\r
 }\r
 /*-----------------------------------------------------------*/\r
@@ -406,19 +427,34 @@ void *pvAllocated;
        demonstrated by any of the standard demo tasks. */\r
        prvDemonstratePendingFunctionCall();\r
 \r
+       /* Demonstrate the use of functions that query information about a software\r
+       timer. */\r
+       prvDemonstrateTimerQueryFunctions();\r
+\r
+\r
        /* If xMutexToDelete has not already been deleted, then delete it now.\r
        This is done purely to demonstrate the use of, and test, the\r
        vSemaphoreDelete() macro.  Care must be taken not to delete a semaphore\r
        that has tasks blocked on it. */\r
        if( xMutexToDelete != NULL )\r
        {\r
+               /* For test purposes, add the mutex to the registry, then remove it\r
+               again, before it is deleted - checking its name is as expected before\r
+               and after the assertion into the registry and its removal from the\r
+               registry. */\r
+               configASSERT( pcQueueGetName( xMutexToDelete ) == NULL );\r
+               vQueueAddToRegistry( xMutexToDelete, "Test_Mutex" );\r
+               configASSERT( strcmp( pcQueueGetName( xMutexToDelete ), "Test_Mutex" ) == 0 );\r
+               vQueueUnregisterQueue( xMutexToDelete );\r
+               configASSERT( pcQueueGetName( xMutexToDelete ) == NULL );\r
+\r
                vSemaphoreDelete( xMutexToDelete );\r
                xMutexToDelete = NULL;\r
        }\r
 \r
        /* Exercise heap_5 a bit.  The malloc failed hook will trap failed\r
        allocations so there is no need to test here. */\r
-       pvAllocated = pvPortMalloc( ( rand() % 100 ) + 1 );\r
+       pvAllocated = pvPortMalloc( ( rand() % 500 ) + 1 );\r
        vPortFree( pvAllocated );\r
 }\r
 /*-----------------------------------------------------------*/\r
@@ -443,6 +479,7 @@ TaskHandle_t xTimerTask;
        /* Write to a queue that is in use as part of the queue set demo to\r
        demonstrate using queue sets from an ISR. */\r
        vQueueSetAccessQueueSetFromISR();\r
+       vQueueSetPollingInterruptAccess();\r
 \r
        /* Exercise event groups from interrupts. */\r
        vPeriodicEventGroupsProcessing();\r
@@ -476,6 +513,53 @@ uint32_t ulParameter1;
 }\r
 /*-----------------------------------------------------------*/\r
 \r
+static void prvTestTimerCallback( TimerHandle_t xTimer )\r
+{\r
+       /* This is the callback function for the timer accessed by\r
+       prvDemonstrateTimerQueryFunctions().  The callback does not do anything. */\r
+       ( void ) xTimer;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static void prvDemonstrateTimerQueryFunctions( void )\r
+{\r
+static TimerHandle_t xTimer = NULL;\r
+const char *pcTimerName = "TestTimer";\r
+volatile TickType_t xExpiryTime;\r
+const TickType_t xDontBlock = 0;\r
+\r
+       if( xTimer == NULL )\r
+       {\r
+               xTimer = xTimerCreate( pcTimerName, portMAX_DELAY, pdTRUE, NULL, prvTestTimerCallback );\r
+\r
+               if( xTimer != NULL )\r
+               {\r
+                       /* Called from the idle task so a block time must not be\r
+                       specified. */\r
+                       xTimerStart( xTimer, xDontBlock );\r
+               }\r
+       }\r
+\r
+       if( xTimer != NULL )\r
+       {\r
+               /* Demonstrate querying a timer's name. */\r
+               configASSERT( strcmp( pcTimerGetName( xTimer ), pcTimerName ) == 0 );\r
+\r
+               /* Demonstrate querying a timer's period. */\r
+               configASSERT( xTimerGetPeriod( xTimer ) == portMAX_DELAY );\r
+\r
+               /* Demonstrate querying a timer's next expiry time, although nothing is\r
+               done with the returned value.  Note if the expiry time is less than the\r
+               maximum tick count then the expiry time has overflowed from the current\r
+               time.  In this case the expiry time was set to portMAX_DELAY, so it is\r
+               expected to be less than the current time until the current time has\r
+               itself overflowed. */\r
+               xExpiryTime = xTimerGetExpiryTime( xTimer );\r
+               ( void ) xExpiryTime;\r
+       }\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
 static void prvDemonstratePendingFunctionCall( void )\r
 {\r
 static uint32_t ulParameter1 = 1000UL, ulParameter2 = 0UL;\r
@@ -497,6 +581,8 @@ TaskHandle_t xIdleTaskHandle, xTimerTaskHandle;
 char *pcTaskName;\r
 static portBASE_TYPE xPerformedOneShotTests = pdFALSE;\r
 TaskHandle_t xTestTask;\r
+TaskStatus_t xTaskInfo;\r
+extern StackType_t uxTimerTaskStack[];\r
 \r
        /* Demonstrate the use of the xTimerGetTimerDaemonTaskHandle() and\r
        xTaskGetIdleTaskHandle() functions.  Also try using the function that sets\r
@@ -511,13 +597,30 @@ TaskHandle_t xTestTask;
                pcStatusMessage = "Error:  Returned idle task handle was incorrect";\r
        }\r
 \r
+       /* Check the same handle is obtained using the idle task's name.  First try\r
+       with the wrong name, then the right name. */\r
+       if( xTaskGetHandle( "Idle" ) == xIdleTaskHandle )\r
+       {\r
+               pcStatusMessage = "Error:  Returned handle for name Idle was incorrect";\r
+       }\r
+\r
+       if( xTaskGetHandle( "IDLE" ) != xIdleTaskHandle )\r
+       {\r
+               pcStatusMessage = "Error:  Returned handle for name Idle was incorrect";\r
+       }\r
+\r
        /* Check the timer task handle was returned correctly. */\r
-       pcTaskName = pcTaskGetTaskName( xTimerTaskHandle );\r
+       pcTaskName = pcTaskGetName( xTimerTaskHandle );\r
        if( strcmp( pcTaskName, "Tmr Svc" ) != 0 )\r
        {\r
                pcStatusMessage = "Error:  Returned timer task handle was incorrect";\r
        }\r
 \r
+       if( xTaskGetHandle( "Tmr Svc" ) != xTimerTaskHandle )\r
+       {\r
+               pcStatusMessage = "Error:  Returned handle for name Tmr Svc was incorrect";\r
+       }\r
+\r
        /* This task is running, make sure it's state is returned as running. */\r
        if( eTaskStateGet( xIdleTaskHandle ) != eRunning )\r
        {\r
@@ -530,6 +633,22 @@ TaskHandle_t xTestTask;
                pcStatusMessage = "Error:  Returned timer task state was incorrect";\r
        }\r
 \r
+       /* Also with the vTaskGetInfo() function. */\r
+       vTaskGetInfo( xTimerTaskHandle, /* The task being queried. */\r
+                                         &xTaskInfo,           /* The structure into which information on the task will be written. */\r
+                                         pdTRUE,                       /* Include the task's high watermark in the structure. */\r
+                                         eInvalid );           /* Include the task state in the structure. */\r
+\r
+       /* Check the information returned by vTaskGetInfo() is as expected. */\r
+       if( ( xTaskInfo.eCurrentState != eBlocked )                                              ||\r
+               ( strcmp( xTaskInfo.pcTaskName, "Tmr Svc" ) != 0 )                       ||\r
+               ( xTaskInfo.uxCurrentPriority != configTIMER_TASK_PRIORITY ) ||\r
+               ( xTaskInfo.pxStackBase != uxTimerTaskStack )                            ||\r
+               ( xTaskInfo.xHandle != xTimerTaskHandle ) )\r
+       {\r
+               pcStatusMessage = "Error:  vTaskGetInfo() returned incorrect information about the timer task";\r
+       }\r
+\r
        /* Other tests that should only be performed once follow.  The test task\r
        is not created on each iteration because to do so would cause the death\r
        task to report an error (too many tasks running). */\r
@@ -633,5 +752,43 @@ unsigned portBASE_TYPE uxReturn, x;
                #endif\r
        }\r
 }\r
+/*-----------------------------------------------------------*/\r
+\r
+static void prvPermanentlyBlockingSemaphoreTask( void *pvParameters )\r
+{\r
+SemaphoreHandle_t xSemaphore;\r
+\r
+       /* Prevent compiler warning about unused parameter in the case that\r
+       configASSERT() is not defined. */\r
+       ( void ) pvParameters;\r
+\r
+       /* This task should block on a semaphore, and never return. */\r
+       xSemaphore = xSemaphoreCreateBinary();\r
+       configASSERT( xSemaphore );\r
+\r
+       xSemaphoreTake( xSemaphore, portMAX_DELAY );\r
+\r
+       /* The above xSemaphoreTake() call should never return, force an assert if\r
+       it does. */\r
+       configASSERT( pvParameters != NULL );\r
+       vTaskDelete( NULL );\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static void prvPermanentlyBlockingNotificationTask( void *pvParameters )\r
+{\r
+       /* Prevent compiler warning about unused parameter in the case that\r
+       configASSERT() is not defined. */\r
+       ( void ) pvParameters;\r
+\r
+       /* This task should block on a task notification, and never return. */\r
+       ulTaskNotifyTake( pdTRUE, portMAX_DELAY );\r
+\r
+       /* The above ulTaskNotifyTake() call should never return, force an assert\r
+       if it does. */\r
+       configASSERT( pvParameters != NULL );\r
+       vTaskDelete( NULL );\r
+}\r
+\r
 \r
 \r