1 #ifndef DYNAMITEmatrixdebugHEADERFILE
2 #define DYNAMITEmatrixdebugHEADERFILE
3 #ifdef _cplusplus
4 extern "C" {
5 #endif
6 #include "basematrix.h"
7 #include "packaln.h"
8 
9 #define DebugStateLISTLENGTH    40
10 #define DebugMatrixLISTLENGTH  40
11 
12 typedef enum MatrixDebugBreakPoint {
13 	MDBP_Cursor = 321,
14 	MDBP_Overflow,
15 	MDBP_Underflow,
16 	MDBP_NoBreakPoint
17 } MatrixDebugBreakPoint_type;
18 
19 
20 struct Wise2_DebugTransition {
21     int dynamite_hard_link;
22 #ifdef PTHREAD
23     pthread_mutex_t dynamite_mutex;
24 #endif
25     char * fromstate;
26     int from_state_num;
27     void (*show_transition)(void * matrix,int i,int j,FILE * ofp);
28     } ;
29 /* DebugTransition defined */
30 #ifndef DYNAMITE_DEFINED_DebugTransition
31 typedef struct Wise2_DebugTransition Wise2_DebugTransition;
32 #define DebugTransition Wise2_DebugTransition
33 #define DYNAMITE_DEFINED_DebugTransition
34 #endif
35 
36 
37 struct Wise2_DebugState {
38     int dynamite_hard_link;
39 #ifdef PTHREAD
40     pthread_mutex_t dynamite_mutex;
41 #endif
42     char * statename;
43     int state_num;
44     DebugTransition ** trans;
45     int len;/* len for above trans  */
46     int maxlen; /* maxlen for above trans */
47     void (*show_state)(void * matrix,int i,int j,FILE *ofp);
48     } ;
49 /* DebugState defined */
50 #ifndef DYNAMITE_DEFINED_DebugState
51 typedef struct Wise2_DebugState Wise2_DebugState;
52 #define DebugState Wise2_DebugState
53 #define DYNAMITE_DEFINED_DebugState
54 #endif
55 
56 
57 struct Wise2_DebugBreakPoint {
58     int dynamite_hard_link;
59 #ifdef PTHREAD
60     pthread_mutex_t dynamite_mutex;
61 #endif
62     MatrixDebugBreakPoint_type type;
63     int posi;
64     int posj;
65     int overflow;
66     int underflow;
67     } ;
68 /* DebugBreakPoint defined */
69 #ifndef DYNAMITE_DEFINED_DebugBreakPoint
70 typedef struct Wise2_DebugBreakPoint Wise2_DebugBreakPoint;
71 #define DebugBreakPoint Wise2_DebugBreakPoint
72 #define DYNAMITE_DEFINED_DebugBreakPoint
73 #endif
74 
75 
76 struct Wise2_DebugMatrix {
77     int dynamite_hard_link;
78 #ifdef PTHREAD
79     pthread_mutex_t dynamite_mutex;
80 #endif
81     void * matrix;
82     int currenti;
83     int currentj;
84     int max_score;
85     int min_score;
86     int max_score_i;
87     int max_score_j;
88     int max_score_cell;
89     DebugState ** state;
90     int len;/* len for above state  */
91     int maxlen; /* maxlen for above state */
92     DebugBreakPoint ** point;
93     int bp_len; /* len for above point  */
94     int bp_maxlen;  /* maxlen for above point */
95     boolean reset;
96     FILE * in;
97     FILE * out;
98     void (*show_cell)(void * matrix,int i,int j,FILE *ofp);
99     } ;
100 /* DebugMatrix defined */
101 #ifndef DYNAMITE_DEFINED_DebugMatrix
102 typedef struct Wise2_DebugMatrix Wise2_DebugMatrix;
103 #define DebugMatrix Wise2_DebugMatrix
104 #define DYNAMITE_DEFINED_DebugMatrix
105 #endif
106 
107 
108 
109 
110     /***************************************************/
111     /* Callable functions                              */
112     /* These are the functions you are expected to use */
113     /***************************************************/
114 
115 
116 
117 /* Function:  show_PackAln_Debug(de,pal,ofp)
118  *
119  * Descrip:    Shows PackAln in debug context
120  *
121  *
122  * Arg:         de [UNKN ] Undocumented argument [DebugMatrix *]
123  * Arg:        pal [UNKN ] Undocumented argument [PackAln *]
124  * Arg:        ofp [UNKN ] Undocumented argument [FILE *]
125  *
126  */
127 void Wise2_show_PackAln_Debug(DebugMatrix * de,PackAln * pal,FILE * ofp);
128 #define show_PackAln_Debug Wise2_show_PackAln_Debug
129 
130 
131 /* Function:  show_DebugMatrix(de,buffer)
132  *
133  * Descrip:    Show function cell state transition
134  *
135  *
136  * Arg:            de [UNKN ] Undocumented argument [DebugMatrix *]
137  * Arg:        buffer [UNKN ] Undocumented argument [char *]
138  *
139  */
140 void Wise2_show_DebugMatrix(DebugMatrix * de,char * buffer);
141 #define show_DebugMatrix Wise2_show_DebugMatrix
142 
143 
144 /* Function:  find_DebugState(de,name)
145  *
146  * Descrip:    Finds a DebugState
147  *
148  *
149  * Arg:          de [UNKN ] Undocumented argument [DebugMatrix *]
150  * Arg:        name [UNKN ] Undocumented argument [char *]
151  *
152  * Return [UNKN ]  Undocumented return value [DebugState *]
153  *
154  */
155 DebugState * Wise2_find_DebugState(DebugMatrix * de,char * name);
156 #define find_DebugState Wise2_find_DebugState
157 
158 
159 /* Function:  find_DebugTransition(state,name)
160  *
161  * Descrip:    Finds a DebugTransition
162  *
163  *
164  * Arg:        state [UNKN ] Undocumented argument [DebugState *]
165  * Arg:         name [UNKN ] Undocumented argument [char *]
166  *
167  * Return [UNKN ]  Undocumented return value [DebugTransition *]
168  *
169  */
170 DebugTransition * Wise2_find_DebugTransition(DebugState * state,char * name);
171 #define find_DebugTransition Wise2_find_DebugTransition
172 
173 
174 /* Function:  user_DebugMatrix(de)
175  *
176  * Descrip:    Main function to talk to user
177  *
178  *
179  * Arg:        de [UNKN ] Undocumented argument [DebugMatrix *]
180  *
181  * Return [UNKN ]  Undocumented return value [boolean]
182  *
183  */
184 boolean Wise2_user_DebugMatrix(DebugMatrix * de);
185 #define user_DebugMatrix Wise2_user_DebugMatrix
186 
187 
188 /* Function:  should_break_DebugMatrix(de)
189  *
190  * Descrip:    Indicates whether we should break at this point. Assummes
191  *             the de datastructure has been updated correctly
192  *
193  *
194  * Arg:        de [UNKN ] Undocumented argument [DebugMatrix *]
195  *
196  * Return [UNKN ]  Undocumented return value [MatrixDebugBreakPoint_type]
197  *
198  */
199 MatrixDebugBreakPoint_type Wise2_should_break_DebugMatrix(DebugMatrix * de);
200 #define should_break_DebugMatrix Wise2_should_break_DebugMatrix
201 
202 
203 /* Function:  std_DebugMatrix(void)
204  *
205  * Descrip:    Builds a "standard" Debug matrix
206  *
207  *
208  *
209  * Return [UNKN ]  Undocumented return value [DebugMatrix *]
210  *
211  */
212 DebugMatrix * Wise2_std_DebugMatrix(void);
213 #define std_DebugMatrix Wise2_std_DebugMatrix
214 
215 
216 /* Function:  hard_link_DebugTransition(obj)
217  *
218  * Descrip:    Bumps up the reference count of the object
219  *             Meaning that multiple pointers can 'own' it
220  *
221  *
222  * Arg:        obj [UNKN ] Object to be hard linked [DebugTransition *]
223  *
224  * Return [UNKN ]  Undocumented return value [DebugTransition *]
225  *
226  */
227 DebugTransition * Wise2_hard_link_DebugTransition(DebugTransition * obj);
228 #define hard_link_DebugTransition Wise2_hard_link_DebugTransition
229 
230 
231 /* Function:  DebugTransition_alloc(void)
232  *
233  * Descrip:    Allocates structure: assigns defaults if given
234  *
235  *
236  *
237  * Return [UNKN ]  Undocumented return value [DebugTransition *]
238  *
239  */
240 DebugTransition * Wise2_DebugTransition_alloc(void);
241 #define DebugTransition_alloc Wise2_DebugTransition_alloc
242 
243 
244 /* Function:  free_DebugTransition(obj)
245  *
246  * Descrip:    Free Function: removes the memory held by obj
247  *             Will chain up to owned members and clear all lists
248  *
249  *
250  * Arg:        obj [UNKN ] Object that is free'd [DebugTransition *]
251  *
252  * Return [UNKN ]  Undocumented return value [DebugTransition *]
253  *
254  */
255 DebugTransition * Wise2_free_DebugTransition(DebugTransition * obj);
256 #define free_DebugTransition Wise2_free_DebugTransition
257 
258 
259 /* Function:  add_DebugState(obj,add)
260  *
261  * Descrip:    Adds another object to the list. It will expand the list if necessary
262  *
263  *
264  * Arg:        obj [UNKN ] Object which contains the list [DebugState *]
265  * Arg:        add [OWNER] Object to add to the list [DebugTransition *]
266  *
267  * Return [UNKN ]  Undocumented return value [boolean]
268  *
269  */
270 boolean Wise2_add_DebugState(DebugState * obj,DebugTransition * add);
271 #define add_DebugState Wise2_add_DebugState
272 
273 
274 /* Function:  flush_DebugState(obj)
275  *
276  * Descrip:    Frees the list elements, sets length to 0
277  *             If you want to save some elements, use hard_link_xxx
278  *             to protect them from being actually destroyed in the free
279  *
280  *
281  * Arg:        obj [UNKN ] Object which contains the list  [DebugState *]
282  *
283  * Return [UNKN ]  Undocumented return value [int]
284  *
285  */
286 int Wise2_flush_DebugState(DebugState * obj);
287 #define flush_DebugState Wise2_flush_DebugState
288 
289 
290 /* Function:  DebugState_alloc_std(void)
291  *
292  * Descrip:    Equivalent to DebugState_alloc_len(DebugStateLISTLENGTH)
293  *
294  *
295  *
296  * Return [UNKN ]  Undocumented return value [DebugState *]
297  *
298  */
299 DebugState * Wise2_DebugState_alloc_std(void);
300 #define DebugState_alloc_std Wise2_DebugState_alloc_std
301 
302 
303 /* Function:  DebugState_alloc_len(len)
304  *
305  * Descrip:    Allocates len length to all lists
306  *
307  *
308  * Arg:        len [UNKN ] Length of lists to allocate [int]
309  *
310  * Return [UNKN ]  Undocumented return value [DebugState *]
311  *
312  */
313 DebugState * Wise2_DebugState_alloc_len(int len);
314 #define DebugState_alloc_len Wise2_DebugState_alloc_len
315 
316 
317 /* Function:  hard_link_DebugState(obj)
318  *
319  * Descrip:    Bumps up the reference count of the object
320  *             Meaning that multiple pointers can 'own' it
321  *
322  *
323  * Arg:        obj [UNKN ] Object to be hard linked [DebugState *]
324  *
325  * Return [UNKN ]  Undocumented return value [DebugState *]
326  *
327  */
328 DebugState * Wise2_hard_link_DebugState(DebugState * obj);
329 #define hard_link_DebugState Wise2_hard_link_DebugState
330 
331 
332 /* Function:  DebugState_alloc(void)
333  *
334  * Descrip:    Allocates structure: assigns defaults if given
335  *
336  *
337  *
338  * Return [UNKN ]  Undocumented return value [DebugState *]
339  *
340  */
341 DebugState * Wise2_DebugState_alloc(void);
342 #define DebugState_alloc Wise2_DebugState_alloc
343 
344 
345 /* Function:  free_DebugState(obj)
346  *
347  * Descrip:    Free Function: removes the memory held by obj
348  *             Will chain up to owned members and clear all lists
349  *
350  *
351  * Arg:        obj [UNKN ] Object that is free'd [DebugState *]
352  *
353  * Return [UNKN ]  Undocumented return value [DebugState *]
354  *
355  */
356 DebugState * Wise2_free_DebugState(DebugState * obj);
357 #define free_DebugState Wise2_free_DebugState
358 
359 
360 /* Function:  hard_link_DebugBreakPoint(obj)
361  *
362  * Descrip:    Bumps up the reference count of the object
363  *             Meaning that multiple pointers can 'own' it
364  *
365  *
366  * Arg:        obj [UNKN ] Object to be hard linked [DebugBreakPoint *]
367  *
368  * Return [UNKN ]  Undocumented return value [DebugBreakPoint *]
369  *
370  */
371 DebugBreakPoint * Wise2_hard_link_DebugBreakPoint(DebugBreakPoint * obj);
372 #define hard_link_DebugBreakPoint Wise2_hard_link_DebugBreakPoint
373 
374 
375 /* Function:  DebugBreakPoint_alloc(void)
376  *
377  * Descrip:    Allocates structure: assigns defaults if given
378  *
379  *
380  *
381  * Return [UNKN ]  Undocumented return value [DebugBreakPoint *]
382  *
383  */
384 DebugBreakPoint * Wise2_DebugBreakPoint_alloc(void);
385 #define DebugBreakPoint_alloc Wise2_DebugBreakPoint_alloc
386 
387 
388 /* Function:  free_DebugBreakPoint(obj)
389  *
390  * Descrip:    Free Function: removes the memory held by obj
391  *             Will chain up to owned members and clear all lists
392  *
393  *
394  * Arg:        obj [UNKN ] Object that is free'd [DebugBreakPoint *]
395  *
396  * Return [UNKN ]  Undocumented return value [DebugBreakPoint *]
397  *
398  */
399 DebugBreakPoint * Wise2_free_DebugBreakPoint(DebugBreakPoint * obj);
400 #define free_DebugBreakPoint Wise2_free_DebugBreakPoint
401 
402 
403 /* Function:  add_DebugMatrix(obj,add)
404  *
405  * Descrip:    Adds another object to the list. It will expand the list if necessary
406  *
407  *
408  * Arg:        obj [UNKN ] Object which contains the list [DebugMatrix *]
409  * Arg:        add [OWNER] Object to add to the list [DebugState *]
410  *
411  * Return [UNKN ]  Undocumented return value [boolean]
412  *
413  */
414 boolean Wise2_add_DebugMatrix(DebugMatrix * obj,DebugState * add);
415 #define add_DebugMatrix Wise2_add_DebugMatrix
416 
417 
418 /* Function:  flush_DebugMatrix(obj)
419  *
420  * Descrip:    Frees the list elements, sets length to 0
421  *             If you want to save some elements, use hard_link_xxx
422  *             to protect them from being actually destroyed in the free
423  *
424  *
425  * Arg:        obj [UNKN ] Object which contains the list  [DebugMatrix *]
426  *
427  * Return [UNKN ]  Undocumented return value [int]
428  *
429  */
430 int Wise2_flush_DebugMatrix(DebugMatrix * obj);
431 #define flush_DebugMatrix Wise2_flush_DebugMatrix
432 
433 
434 /* Function:  add_bp_DebugMatrix(obj,add)
435  *
436  * Descrip:    Adds another object to the list. It will expand the list if necessary
437  *
438  *
439  * Arg:        obj [UNKN ] Object which contains the list [DebugMatrix *]
440  * Arg:        add [OWNER] Object to add to the list [DebugBreakPoint *]
441  *
442  * Return [UNKN ]  Undocumented return value [boolean]
443  *
444  */
445 boolean Wise2_add_bp_DebugMatrix(DebugMatrix * obj,DebugBreakPoint * add);
446 #define add_bp_DebugMatrix Wise2_add_bp_DebugMatrix
447 
448 
449 /* Function:  flush_bp_DebugMatrix(obj)
450  *
451  * Descrip:    Frees the list elements, sets length to 0
452  *             If you want to save some elements, use hard_link_xxx
453  *             to protect them from being actually destroyed in the free
454  *
455  *
456  * Arg:        obj [UNKN ] Object which contains the list  [DebugMatrix *]
457  *
458  * Return [UNKN ]  Undocumented return value [int]
459  *
460  */
461 int Wise2_flush_bp_DebugMatrix(DebugMatrix * obj);
462 #define flush_bp_DebugMatrix Wise2_flush_bp_DebugMatrix
463 
464 
465 /* Function:  DebugMatrix_alloc_std(void)
466  *
467  * Descrip:    Equivalent to DebugMatrix_alloc_len(DebugMatrixLISTLENGTH)
468  *
469  *
470  *
471  * Return [UNKN ]  Undocumented return value [DebugMatrix *]
472  *
473  */
474 DebugMatrix * Wise2_DebugMatrix_alloc_std(void);
475 #define DebugMatrix_alloc_std Wise2_DebugMatrix_alloc_std
476 
477 
478 /* Function:  DebugMatrix_alloc_len(len)
479  *
480  * Descrip:    Allocates len length to all lists
481  *
482  *
483  * Arg:        len [UNKN ] Length of lists to allocate [int]
484  *
485  * Return [UNKN ]  Undocumented return value [DebugMatrix *]
486  *
487  */
488 DebugMatrix * Wise2_DebugMatrix_alloc_len(int len);
489 #define DebugMatrix_alloc_len Wise2_DebugMatrix_alloc_len
490 
491 
492 /* Function:  hard_link_DebugMatrix(obj)
493  *
494  * Descrip:    Bumps up the reference count of the object
495  *             Meaning that multiple pointers can 'own' it
496  *
497  *
498  * Arg:        obj [UNKN ] Object to be hard linked [DebugMatrix *]
499  *
500  * Return [UNKN ]  Undocumented return value [DebugMatrix *]
501  *
502  */
503 DebugMatrix * Wise2_hard_link_DebugMatrix(DebugMatrix * obj);
504 #define hard_link_DebugMatrix Wise2_hard_link_DebugMatrix
505 
506 
507 /* Function:  DebugMatrix_alloc(void)
508  *
509  * Descrip:    Allocates structure: assigns defaults if given
510  *
511  *
512  *
513  * Return [UNKN ]  Undocumented return value [DebugMatrix *]
514  *
515  */
516 DebugMatrix * Wise2_DebugMatrix_alloc(void);
517 #define DebugMatrix_alloc Wise2_DebugMatrix_alloc
518 
519 
520 /* Function:  free_DebugMatrix(obj)
521  *
522  * Descrip:    Free Function: removes the memory held by obj
523  *             Will chain up to owned members and clear all lists
524  *
525  *
526  * Arg:        obj [UNKN ] Object that is free'd [DebugMatrix *]
527  *
528  * Return [UNKN ]  Undocumented return value [DebugMatrix *]
529  *
530  */
531 DebugMatrix * Wise2_free_DebugMatrix(DebugMatrix * obj);
532 #define free_DebugMatrix Wise2_free_DebugMatrix
533 
534 
535   /* Unplaced functions */
536   /* There has been no indication of the use of these functions */
537 
538 
539     /***************************************************/
540     /* Internal functions                              */
541     /* you are not expected to have to call these      */
542     /***************************************************/
543 void Wise2_swap_DebugState(DebugTransition ** list,int i,int j) ;
544 #define swap_DebugState Wise2_swap_DebugState
545 void Wise2_qsort_DebugState(DebugTransition ** list,int left,int right,int (*comp)(DebugTransition * ,DebugTransition * ));
546 #define qsort_DebugState Wise2_qsort_DebugState
547 void Wise2_sort_DebugState(DebugState * obj,int (*comp)(DebugTransition *, DebugTransition *));
548 #define sort_DebugState Wise2_sort_DebugState
549 boolean Wise2_expand_DebugState(DebugState * obj,int len);
550 #define expand_DebugState Wise2_expand_DebugState
551 void Wise2_swap_DebugMatrix(DebugState ** list,int i,int j) ;
552 #define swap_DebugMatrix Wise2_swap_DebugMatrix
553 void Wise2_qsort_DebugMatrix(DebugState ** list,int left,int right,int (*comp)(DebugState * ,DebugState * ));
554 #define qsort_DebugMatrix Wise2_qsort_DebugMatrix
555 void Wise2_sort_DebugMatrix(DebugMatrix * obj,int (*comp)(DebugState *, DebugState *));
556 #define sort_DebugMatrix Wise2_sort_DebugMatrix
557 boolean Wise2_expand_DebugMatrix(DebugMatrix * obj,int len);
558 #define expand_DebugMatrix Wise2_expand_DebugMatrix
559 void Wise2_swap_bp_DebugMatrix(DebugBreakPoint ** list,int i,int j) ;
560 #define swap_bp_DebugMatrix Wise2_swap_bp_DebugMatrix
561 void Wise2_qsort_bp_DebugMatrix(DebugBreakPoint ** list,int left,int right,int (*comp)(DebugBreakPoint * ,DebugBreakPoint * ));
562 #define qsort_bp_DebugMatrix Wise2_qsort_bp_DebugMatrix
563 void Wise2_sort_bp_DebugMatrix(DebugMatrix * obj,int (*comp)(DebugBreakPoint *, DebugBreakPoint *));
564 #define sort_bp_DebugMatrix Wise2_sort_bp_DebugMatrix
565 boolean Wise2_expand_bp_DebugMatrix(DebugMatrix * obj,int len);
566 #define expand_bp_DebugMatrix Wise2_expand_bp_DebugMatrix
567 
568 #ifdef _cplusplus
569 }
570 #endif
571 
572 #endif
573