source: BAORadio/libindi/libindi/drivers/telescope/exception.c @ 620

Last change on this file since 620 was 620, checked in by frichard, 13 years ago
File size: 660 bytes
Line 
1/* exception.c */
2/* fonctions de manipulation de la pile */
3
4#include "exception.h"
5
6except *_exceptions = NULL;
7
8/* empile */
9
10void push_exc(){
11  except* layer;
12  layer = (except*) malloc(sizeof(except));
13  if(layer == NULL){
14    fprintf(stderr,"[push_exc()]Erreur d'allocation memoire pour la pile");
15  }
16  layer->super = _exceptions;
17  _exceptions = layer;
18}
19
20/* depile */
21
22void pop_exc(int ex){
23  except* super;
24  super = _exceptions->super;
25  free(_exceptions);
26  _exceptions = super;
27  if(ex){
28    if(_exceptions){
29      longjmp(_exceptions->ctx, ex);
30    }
31    else{
32      fprintf(stderr, "Exception non geree : %d\n", ex);
33      exit(-1);
34    }
35  }
36}
Note: See TracBrowser for help on using the repository browser.