| Last change
 on this file since 1399 was             773, checked in by ansari, 26 years ago | 
        
          | 
Ajout de l'argument bool zero ds NDataBlock<T>::Alloc()Fonction pour construire un message d'exception avec num de ligne et
 nom de fichier ds pexceptions.h .cc
 
 
Reza 10/3/2000
 | 
        
          | File size:
            640 bytes | 
      
      
| Line |  | 
|---|
| 1 | #include "pexceptions.h" | 
|---|
| 2 | #include <iostream.h> | 
|---|
| 3 |  | 
|---|
| 4 | void PFailHandler(void); | 
|---|
| 5 |  | 
|---|
| 6 | // egcs ne semble pas connaitre set_new_handler (Reza 26/04/99) | 
|---|
| 7 | #ifdef __GNUG__ | 
|---|
| 8 | void PFailHandler(void) {} | 
|---|
| 9 | void InitFailNewHandler() {} | 
|---|
| 10 | #else | 
|---|
| 11 |  | 
|---|
| 12 | void PFailHandler(void) | 
|---|
| 13 | { | 
|---|
| 14 | set_new_handler(NULL); | 
|---|
| 15 | cerr << "Allocation exception -- out of memory" << endl; | 
|---|
| 16 | throw(AllocationError("new")); | 
|---|
| 17 | } | 
|---|
| 18 |  | 
|---|
| 19 | void InitFailNewHandler() | 
|---|
| 20 | { | 
|---|
| 21 | set_new_handler(PFailHandler); | 
|---|
| 22 | } | 
|---|
| 23 |  | 
|---|
| 24 | string BuildLongExceptionMessage(const char * s, const char *file, int line) | 
|---|
| 25 | { | 
|---|
| 26 | char buff[32]; | 
|---|
| 27 | sprintf(buff," Line=%d", line); | 
|---|
| 28 | string rs=s; | 
|---|
| 29 | rs += " File="; rs += file; rs += buff; | 
|---|
| 30 | return(rs); | 
|---|
| 31 | } | 
|---|
| 32 |  | 
|---|
| 33 | #endif | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.