/[gxemul]/trunk/src/interrupt.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/src/interrupt.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 41 by dpavlin, Mon Oct 8 16:21:17 2007 UTC revision 42 by dpavlin, Mon Oct 8 16:22:32 2007 UTC
# Line 25  Line 25 
25   *  SUCH DAMAGE.   *  SUCH DAMAGE.
26   *   *
27   *   *
28   *  $Id: interrupt.c,v 1.7 2007/02/03 16:41:42 debug Exp $   *  $Id: interrupt.c,v 1.12 2007/06/15 17:02:38 debug Exp $
29   *   *
30   *  The interrupt subsystem.   *  The interrupt subsystem.
31   *   *
# Line 49  Line 49 
49  #include "misc.h"  #include "misc.h"
50    
51    
52    /*  #define INTERRUPT_DEBUG  */
53    
54    
55  struct interrupt_handler {  struct interrupt_handler {
56          struct interrupt        template;          struct interrupt        template;
57          int                     nr_of_exclusive_users;          int                     nr_of_exclusive_users;
# Line 81  void interrupt_handler_register(struct i Line 84  void interrupt_handler_register(struct i
84  {  {
85          int i;          int i;
86    
87  #ifdef UNSTABLE_DEVEL  #ifdef INTERRUPT_DEBUG
88          printf("interrupt_handler_register(\"%s\")\n", template->name);          printf("interrupt_handler_register(\"%s\")\n", template->name);
89  #endif  #endif
90    
# Line 98  void interrupt_handler_register(struct i Line 101  void interrupt_handler_register(struct i
101          }          }
102    
103          nr_of_interrupt_handlers ++;          nr_of_interrupt_handlers ++;
104          interrupt_handlers = realloc(interrupt_handlers,          CHECK_ALLOCATION(interrupt_handlers = realloc(interrupt_handlers,
105              nr_of_interrupt_handlers * sizeof(struct interrupt_handler));              nr_of_interrupt_handlers * sizeof(struct interrupt_handler)));
         if (interrupt_handlers == NULL) {  
                 fprintf(stderr, "out of memory in "  
                     "ninterrupt_handler_register().\n");  
                 exit(1);  
         }  
106    
107          interrupt_handlers[nr_of_interrupt_handlers-1].template = *template;          interrupt_handlers[nr_of_interrupt_handlers-1].template = *template;
108          interrupt_handlers[nr_of_interrupt_handlers-1].template.name =          CHECK_ALLOCATION(interrupt_handlers[nr_of_interrupt_handlers-1].
109              strdup(template->name);              template.name = strdup(template->name));
110  }  }
111    
112    
# Line 123  void interrupt_handler_remove(char *name Line 121  void interrupt_handler_remove(char *name
121  {  {
122          int i;          int i;
123    
124  #ifdef UNSTABLE_DEVEL  #ifdef INTERRUPT_DEBUG
125          printf("interrupt_handler_remove(\"%s\")\n", name);          printf("interrupt_handler_remove(\"%s\")\n", name);
126  #endif  #endif
127    
# Line 170  int interrupt_handler_lookup(char *name, Line 168  int interrupt_handler_lookup(char *name,
168  {  {
169          int i;          int i;
170    
171  #ifdef UNSTABLE_DEVEL  #ifdef INTERRUPT_DEBUG
172          printf("interrupt_handler_lookup(\"%s\")\n", name);          printf("interrupt_handler_lookup(\"%s\")\n", name);
173  #endif  #endif
174    
# Line 189  int interrupt_handler_lookup(char *name, Line 187  int interrupt_handler_lookup(char *name,
187                  return 1;                  return 1;
188          }          }
189    
190          printf("interrupt_handler_lookup(\"%s\") failed. Aborting.\n", name);          /*  The 'if' is an ugly hack to prevent a Compaq CC warning.  */
191          abort();          if (i >= nr_of_interrupt_handlers) {
192                    printf("interrupt_handler_lookup(\"%s\") failed. "
193                        "Aborting.\n", name);
194                    abort();
195            }
196    
197          return 0;          return 0;
198  }  }
# Line 205  void interrupt_connect(struct interrupt Line 207  void interrupt_connect(struct interrupt
207  {  {
208          int i;          int i;
209    
210  #ifdef UNSTABLE_DEVEL  #ifdef INTERRUPT_DEBUG
211          printf("interrupt_connect(\"%s\")\n", in->name);          printf("interrupt_connect(\"%s\")\n", in->name);
212  #endif  #endif
213    

Legend:
Removed from v.41  
changed lines
  Added in v.42

  ViewVC Help
Powered by ViewVC 1.1.26