Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Changeset 3456

Show
Ignore:
Timestamp:
04/24/08 02:06:18 (7 months ago)
Author:
sean
Message:

Added wrappers for rt_init and rt_term to the Runtime object as the 'initialize' and 'terminate' methods. This is a bit inconsistent with the 'isHalting' method, and I'm wondering if it should be renamed to 'isTerminating'. Alternately, the methods could be 'init' and 'halt'. Just a thought.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/common/tango/core/Runtime.d

    r3145 r3456  
    1717    alias Exception.TraceInfo function( void* ptr = null ) TraceHandler; 
    1818 
    19     extern (C) void  rt_setCollectHandler( CollectHandler h ); 
    20     extern (C) void  rt_setTraceHandler( TraceHandler h ); 
     19    extern (C) void rt_setCollectHandler( CollectHandler h ); 
     20    extern (C) void rt_setTraceHandler( TraceHandler h ); 
     21 
     22    alias void delegate( Exception ) ExceptionHandler; 
     23    extern (C) bool rt_init( ExceptionHandler dg = null ); 
     24    extern (C) bool rt_term( ExceptionHandler dg = null ); 
    2125} 
    2226 
     
    3337struct Runtime 
    3438{ 
     39    /** 
     40     * Initializes the runtime.  This call is to be used in instances where the 
     41     * standard program initialization process is not executed.  This is most 
     42     * often in shared libraries or in libraries linked to a C program. 
     43     * 
     44     * Params: 
     45     *  dg = A delegate which will receive any exception thrown during the 
     46     *       initialization process or null if such exceptions should be 
     47     *       discarded. 
     48     * 
     49     * Returns: 
     50     *  true if initialization succeeds and false if initialization fails. 
     51     */ 
     52    static bool initialize( void delegate( Exception ) dg = null ) 
     53    { 
     54        return rt_init( dg ); 
     55    } 
     56 
     57 
     58    /** 
     59     * Terminates the runtime.  This call is to be used in instances where the 
     60     * standard program termination process will not be not executed.  This is 
     61     * most often in shared libraries or in libraries linked to a C program. 
     62     * 
     63     * Params: 
     64     *  dg = A delegate which will receive any exception thrown during the 
     65     *       termination process or null if such exceptions should be 
     66     *       discarded. 
     67     * 
     68     * Returns: 
     69     *  true if termination succeeds and false if termination fails. 
     70     */ 
     71    static bool terminate( void delegate( Exception ) dg = null ) 
     72    { 
     73        return rt_term( dg ); 
     74    } 
     75 
     76 
    3577    /** 
    3678     * Returns true if the runtime is halting.  Under normal circumstances, 
  • trunk/lib/compiler/dmd/dmain2.d

    r3145 r3456  
    9393} 
    9494 
    95 extern (C) bool rt_init( void delegate( Exception ) dg = null ) 
     95alias void delegate( Exception ) ExceptionHandler; 
     96 
     97extern (C) bool rt_init( ExceptionHandler dg = null ) 
    9698{ 
    9799    _d_criticalInit(); 
     
    127129} 
    128130 
    129 extern (C) bool rt_term( void delegate( Exception ) dg = null ) 
     131extern (C) bool rt_term( ExceptionHandler dg = null ) 
    130132{ 
    131133    try 
  • trunk/lib/compiler/gdc/dgccmain2.d

    r3145 r3456  
    107107} 
    108108 
    109 extern (C) bool rt_init( void delegate( Exception ) dg = null ) 
     109alias void delegate( Exception ) ExceptionHandler; 
     110 
     111extern (C) bool rt_init( ExceptionHandler dg = null ) 
    110112{ 
    111113    _d_criticalInit(); 
     
    139141} 
    140142 
    141 extern (C) bool rt_term( void delegate( Exception ) dg = null ) 
     143extern (C) bool rt_term( ExceptionHandler dg = null ) 
    142144{ 
    143145    try