File: matrixdebug.h

package info (click to toggle)
wise 2.4.1-21
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 27,140 kB
  • sloc: ansic: 276,365; makefile: 1,003; perl: 886; lex: 93; yacc: 81; sh: 24
file content (572 lines) | stat: -rw-r--r-- 16,434 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
#ifndef DYNAMITEmatrixdebugHEADERFILE
#define DYNAMITEmatrixdebugHEADERFILE
#ifdef _cplusplus
extern "C" {
#endif
#include "basematrix.h"
#include "packaln.h"

#define DebugStateLISTLENGTH    40
#define DebugMatrixLISTLENGTH  40

typedef enum MatrixDebugBreakPoint {
	MDBP_Cursor = 321,
	MDBP_Overflow,
	MDBP_Underflow,
	MDBP_NoBreakPoint
} MatrixDebugBreakPoint_type;


struct Wise2_DebugTransition {  
    int dynamite_hard_link;  
#ifdef PTHREAD   
    pthread_mutex_t dynamite_mutex;  
#endif   
    char * fromstate;    
    int from_state_num;  
    void (*show_transition)(void * matrix,int i,int j,FILE * ofp);   
    } ;  
/* DebugTransition defined */ 
#ifndef DYNAMITE_DEFINED_DebugTransition
typedef struct Wise2_DebugTransition Wise2_DebugTransition;
#define DebugTransition Wise2_DebugTransition
#define DYNAMITE_DEFINED_DebugTransition
#endif


struct Wise2_DebugState {  
    int dynamite_hard_link;  
#ifdef PTHREAD   
    pthread_mutex_t dynamite_mutex;  
#endif   
    char * statename;    
    int state_num;   
    DebugTransition ** trans;    
    int len;/* len for above trans  */ 
    int maxlen; /* maxlen for above trans */ 
    void (*show_state)(void * matrix,int i,int j,FILE *ofp); 
    } ;  
/* DebugState defined */ 
#ifndef DYNAMITE_DEFINED_DebugState
typedef struct Wise2_DebugState Wise2_DebugState;
#define DebugState Wise2_DebugState
#define DYNAMITE_DEFINED_DebugState
#endif


struct Wise2_DebugBreakPoint {  
    int dynamite_hard_link;  
#ifdef PTHREAD   
    pthread_mutex_t dynamite_mutex;  
#endif   
    MatrixDebugBreakPoint_type type;     
    int posi;    
    int posj;    
    int overflow;    
    int underflow;   
    } ;  
/* DebugBreakPoint defined */ 
#ifndef DYNAMITE_DEFINED_DebugBreakPoint
typedef struct Wise2_DebugBreakPoint Wise2_DebugBreakPoint;
#define DebugBreakPoint Wise2_DebugBreakPoint
#define DYNAMITE_DEFINED_DebugBreakPoint
#endif


struct Wise2_DebugMatrix {  
    int dynamite_hard_link;  
#ifdef PTHREAD   
    pthread_mutex_t dynamite_mutex;  
#endif   
    void * matrix;   
    int currenti;    
    int currentj;    
    int max_score;   
    int min_score;   
    int max_score_i;     
    int max_score_j;     
    int max_score_cell;  
    DebugState ** state;     
    int len;/* len for above state  */ 
    int maxlen; /* maxlen for above state */ 
    DebugBreakPoint ** point;    
    int bp_len; /* len for above point  */ 
    int bp_maxlen;  /* maxlen for above point */ 
    boolean reset;   
    FILE * in;   
    FILE * out;  
    void (*show_cell)(void * matrix,int i,int j,FILE *ofp);  
    } ;  
/* DebugMatrix defined */ 
#ifndef DYNAMITE_DEFINED_DebugMatrix
typedef struct Wise2_DebugMatrix Wise2_DebugMatrix;
#define DebugMatrix Wise2_DebugMatrix
#define DYNAMITE_DEFINED_DebugMatrix
#endif




    /***************************************************/
    /* Callable functions                              */
    /* These are the functions you are expected to use */
    /***************************************************/



/* Function:  show_PackAln_Debug(de,pal,ofp)
 *
 * Descrip:    Shows PackAln in debug context
 *
 *
 * Arg:         de [UNKN ] Undocumented argument [DebugMatrix *]
 * Arg:        pal [UNKN ] Undocumented argument [PackAln *]
 * Arg:        ofp [UNKN ] Undocumented argument [FILE *]
 *
 */
void Wise2_show_PackAln_Debug(DebugMatrix * de,PackAln * pal,FILE * ofp);
#define show_PackAln_Debug Wise2_show_PackAln_Debug


/* Function:  show_DebugMatrix(de,buffer)
 *
 * Descrip:    Show function cell state transition
 *
 *
 * Arg:            de [UNKN ] Undocumented argument [DebugMatrix *]
 * Arg:        buffer [UNKN ] Undocumented argument [char *]
 *
 */
void Wise2_show_DebugMatrix(DebugMatrix * de,char * buffer);
#define show_DebugMatrix Wise2_show_DebugMatrix


/* Function:  find_DebugState(de,name)
 *
 * Descrip:    Finds a DebugState 
 *
 *
 * Arg:          de [UNKN ] Undocumented argument [DebugMatrix *]
 * Arg:        name [UNKN ] Undocumented argument [char *]
 *
 * Return [UNKN ]  Undocumented return value [DebugState *]
 *
 */
DebugState * Wise2_find_DebugState(DebugMatrix * de,char * name);
#define find_DebugState Wise2_find_DebugState


/* Function:  find_DebugTransition(state,name)
 *
 * Descrip:    Finds a DebugTransition
 *
 *
 * Arg:        state [UNKN ] Undocumented argument [DebugState *]
 * Arg:         name [UNKN ] Undocumented argument [char *]
 *
 * Return [UNKN ]  Undocumented return value [DebugTransition *]
 *
 */
DebugTransition * Wise2_find_DebugTransition(DebugState * state,char * name);
#define find_DebugTransition Wise2_find_DebugTransition


/* Function:  user_DebugMatrix(de)
 *
 * Descrip:    Main function to talk to user
 *
 *
 * Arg:        de [UNKN ] Undocumented argument [DebugMatrix *]
 *
 * Return [UNKN ]  Undocumented return value [boolean]
 *
 */
boolean Wise2_user_DebugMatrix(DebugMatrix * de);
#define user_DebugMatrix Wise2_user_DebugMatrix


/* Function:  should_break_DebugMatrix(de)
 *
 * Descrip:    Indicates whether we should break at this point. Assummes
 *             the de datastructure has been updated correctly
 *
 *
 * Arg:        de [UNKN ] Undocumented argument [DebugMatrix *]
 *
 * Return [UNKN ]  Undocumented return value [MatrixDebugBreakPoint_type]
 *
 */
MatrixDebugBreakPoint_type Wise2_should_break_DebugMatrix(DebugMatrix * de);
#define should_break_DebugMatrix Wise2_should_break_DebugMatrix


/* Function:  std_DebugMatrix(void)
 *
 * Descrip:    Builds a "standard" Debug matrix
 *
 *
 *
 * Return [UNKN ]  Undocumented return value [DebugMatrix *]
 *
 */
DebugMatrix * Wise2_std_DebugMatrix(void);
#define std_DebugMatrix Wise2_std_DebugMatrix


/* Function:  hard_link_DebugTransition(obj)
 *
 * Descrip:    Bumps up the reference count of the object
 *             Meaning that multiple pointers can 'own' it
 *
 *
 * Arg:        obj [UNKN ] Object to be hard linked [DebugTransition *]
 *
 * Return [UNKN ]  Undocumented return value [DebugTransition *]
 *
 */
DebugTransition * Wise2_hard_link_DebugTransition(DebugTransition * obj);
#define hard_link_DebugTransition Wise2_hard_link_DebugTransition


/* Function:  DebugTransition_alloc(void)
 *
 * Descrip:    Allocates structure: assigns defaults if given 
 *
 *
 *
 * Return [UNKN ]  Undocumented return value [DebugTransition *]
 *
 */
DebugTransition * Wise2_DebugTransition_alloc(void);
#define DebugTransition_alloc Wise2_DebugTransition_alloc


/* Function:  free_DebugTransition(obj)
 *
 * Descrip:    Free Function: removes the memory held by obj
 *             Will chain up to owned members and clear all lists
 *
 *
 * Arg:        obj [UNKN ] Object that is free'd [DebugTransition *]
 *
 * Return [UNKN ]  Undocumented return value [DebugTransition *]
 *
 */
DebugTransition * Wise2_free_DebugTransition(DebugTransition * obj);
#define free_DebugTransition Wise2_free_DebugTransition


/* Function:  add_DebugState(obj,add)
 *
 * Descrip:    Adds another object to the list. It will expand the list if necessary
 *
 *
 * Arg:        obj [UNKN ] Object which contains the list [DebugState *]
 * Arg:        add [OWNER] Object to add to the list [DebugTransition *]
 *
 * Return [UNKN ]  Undocumented return value [boolean]
 *
 */
boolean Wise2_add_DebugState(DebugState * obj,DebugTransition * add);
#define add_DebugState Wise2_add_DebugState


/* Function:  flush_DebugState(obj)
 *
 * Descrip:    Frees the list elements, sets length to 0
 *             If you want to save some elements, use hard_link_xxx
 *             to protect them from being actually destroyed in the free
 *
 *
 * Arg:        obj [UNKN ] Object which contains the list  [DebugState *]
 *
 * Return [UNKN ]  Undocumented return value [int]
 *
 */
int Wise2_flush_DebugState(DebugState * obj);
#define flush_DebugState Wise2_flush_DebugState


/* Function:  DebugState_alloc_std(void)
 *
 * Descrip:    Equivalent to DebugState_alloc_len(DebugStateLISTLENGTH)
 *
 *
 *
 * Return [UNKN ]  Undocumented return value [DebugState *]
 *
 */
DebugState * Wise2_DebugState_alloc_std(void);
#define DebugState_alloc_std Wise2_DebugState_alloc_std


/* Function:  DebugState_alloc_len(len)
 *
 * Descrip:    Allocates len length to all lists
 *
 *
 * Arg:        len [UNKN ] Length of lists to allocate [int]
 *
 * Return [UNKN ]  Undocumented return value [DebugState *]
 *
 */
DebugState * Wise2_DebugState_alloc_len(int len);
#define DebugState_alloc_len Wise2_DebugState_alloc_len


/* Function:  hard_link_DebugState(obj)
 *
 * Descrip:    Bumps up the reference count of the object
 *             Meaning that multiple pointers can 'own' it
 *
 *
 * Arg:        obj [UNKN ] Object to be hard linked [DebugState *]
 *
 * Return [UNKN ]  Undocumented return value [DebugState *]
 *
 */
DebugState * Wise2_hard_link_DebugState(DebugState * obj);
#define hard_link_DebugState Wise2_hard_link_DebugState


/* Function:  DebugState_alloc(void)
 *
 * Descrip:    Allocates structure: assigns defaults if given 
 *
 *
 *
 * Return [UNKN ]  Undocumented return value [DebugState *]
 *
 */
DebugState * Wise2_DebugState_alloc(void);
#define DebugState_alloc Wise2_DebugState_alloc


/* Function:  free_DebugState(obj)
 *
 * Descrip:    Free Function: removes the memory held by obj
 *             Will chain up to owned members and clear all lists
 *
 *
 * Arg:        obj [UNKN ] Object that is free'd [DebugState *]
 *
 * Return [UNKN ]  Undocumented return value [DebugState *]
 *
 */
DebugState * Wise2_free_DebugState(DebugState * obj);
#define free_DebugState Wise2_free_DebugState


/* Function:  hard_link_DebugBreakPoint(obj)
 *
 * Descrip:    Bumps up the reference count of the object
 *             Meaning that multiple pointers can 'own' it
 *
 *
 * Arg:        obj [UNKN ] Object to be hard linked [DebugBreakPoint *]
 *
 * Return [UNKN ]  Undocumented return value [DebugBreakPoint *]
 *
 */
DebugBreakPoint * Wise2_hard_link_DebugBreakPoint(DebugBreakPoint * obj);
#define hard_link_DebugBreakPoint Wise2_hard_link_DebugBreakPoint


/* Function:  DebugBreakPoint_alloc(void)
 *
 * Descrip:    Allocates structure: assigns defaults if given 
 *
 *
 *
 * Return [UNKN ]  Undocumented return value [DebugBreakPoint *]
 *
 */
DebugBreakPoint * Wise2_DebugBreakPoint_alloc(void);
#define DebugBreakPoint_alloc Wise2_DebugBreakPoint_alloc


/* Function:  free_DebugBreakPoint(obj)
 *
 * Descrip:    Free Function: removes the memory held by obj
 *             Will chain up to owned members and clear all lists
 *
 *
 * Arg:        obj [UNKN ] Object that is free'd [DebugBreakPoint *]
 *
 * Return [UNKN ]  Undocumented return value [DebugBreakPoint *]
 *
 */
DebugBreakPoint * Wise2_free_DebugBreakPoint(DebugBreakPoint * obj);
#define free_DebugBreakPoint Wise2_free_DebugBreakPoint


/* Function:  add_DebugMatrix(obj,add)
 *
 * Descrip:    Adds another object to the list. It will expand the list if necessary
 *
 *
 * Arg:        obj [UNKN ] Object which contains the list [DebugMatrix *]
 * Arg:        add [OWNER] Object to add to the list [DebugState *]
 *
 * Return [UNKN ]  Undocumented return value [boolean]
 *
 */
boolean Wise2_add_DebugMatrix(DebugMatrix * obj,DebugState * add);
#define add_DebugMatrix Wise2_add_DebugMatrix


/* Function:  flush_DebugMatrix(obj)
 *
 * Descrip:    Frees the list elements, sets length to 0
 *             If you want to save some elements, use hard_link_xxx
 *             to protect them from being actually destroyed in the free
 *
 *
 * Arg:        obj [UNKN ] Object which contains the list  [DebugMatrix *]
 *
 * Return [UNKN ]  Undocumented return value [int]
 *
 */
int Wise2_flush_DebugMatrix(DebugMatrix * obj);
#define flush_DebugMatrix Wise2_flush_DebugMatrix


/* Function:  add_bp_DebugMatrix(obj,add)
 *
 * Descrip:    Adds another object to the list. It will expand the list if necessary
 *
 *
 * Arg:        obj [UNKN ] Object which contains the list [DebugMatrix *]
 * Arg:        add [OWNER] Object to add to the list [DebugBreakPoint *]
 *
 * Return [UNKN ]  Undocumented return value [boolean]
 *
 */
boolean Wise2_add_bp_DebugMatrix(DebugMatrix * obj,DebugBreakPoint * add);
#define add_bp_DebugMatrix Wise2_add_bp_DebugMatrix


/* Function:  flush_bp_DebugMatrix(obj)
 *
 * Descrip:    Frees the list elements, sets length to 0
 *             If you want to save some elements, use hard_link_xxx
 *             to protect them from being actually destroyed in the free
 *
 *
 * Arg:        obj [UNKN ] Object which contains the list  [DebugMatrix *]
 *
 * Return [UNKN ]  Undocumented return value [int]
 *
 */
int Wise2_flush_bp_DebugMatrix(DebugMatrix * obj);
#define flush_bp_DebugMatrix Wise2_flush_bp_DebugMatrix


/* Function:  DebugMatrix_alloc_std(void)
 *
 * Descrip:    Equivalent to DebugMatrix_alloc_len(DebugMatrixLISTLENGTH)
 *
 *
 *
 * Return [UNKN ]  Undocumented return value [DebugMatrix *]
 *
 */
DebugMatrix * Wise2_DebugMatrix_alloc_std(void);
#define DebugMatrix_alloc_std Wise2_DebugMatrix_alloc_std


/* Function:  DebugMatrix_alloc_len(len)
 *
 * Descrip:    Allocates len length to all lists
 *
 *
 * Arg:        len [UNKN ] Length of lists to allocate [int]
 *
 * Return [UNKN ]  Undocumented return value [DebugMatrix *]
 *
 */
DebugMatrix * Wise2_DebugMatrix_alloc_len(int len);
#define DebugMatrix_alloc_len Wise2_DebugMatrix_alloc_len


/* Function:  hard_link_DebugMatrix(obj)
 *
 * Descrip:    Bumps up the reference count of the object
 *             Meaning that multiple pointers can 'own' it
 *
 *
 * Arg:        obj [UNKN ] Object to be hard linked [DebugMatrix *]
 *
 * Return [UNKN ]  Undocumented return value [DebugMatrix *]
 *
 */
DebugMatrix * Wise2_hard_link_DebugMatrix(DebugMatrix * obj);
#define hard_link_DebugMatrix Wise2_hard_link_DebugMatrix


/* Function:  DebugMatrix_alloc(void)
 *
 * Descrip:    Allocates structure: assigns defaults if given 
 *
 *
 *
 * Return [UNKN ]  Undocumented return value [DebugMatrix *]
 *
 */
DebugMatrix * Wise2_DebugMatrix_alloc(void);
#define DebugMatrix_alloc Wise2_DebugMatrix_alloc


/* Function:  free_DebugMatrix(obj)
 *
 * Descrip:    Free Function: removes the memory held by obj
 *             Will chain up to owned members and clear all lists
 *
 *
 * Arg:        obj [UNKN ] Object that is free'd [DebugMatrix *]
 *
 * Return [UNKN ]  Undocumented return value [DebugMatrix *]
 *
 */
DebugMatrix * Wise2_free_DebugMatrix(DebugMatrix * obj);
#define free_DebugMatrix Wise2_free_DebugMatrix


  /* Unplaced functions */
  /* There has been no indication of the use of these functions */


    /***************************************************/
    /* Internal functions                              */
    /* you are not expected to have to call these      */
    /***************************************************/
void Wise2_swap_DebugState(DebugTransition ** list,int i,int j) ;
#define swap_DebugState Wise2_swap_DebugState
void Wise2_qsort_DebugState(DebugTransition ** list,int left,int right,int (*comp)(DebugTransition * ,DebugTransition * ));
#define qsort_DebugState Wise2_qsort_DebugState
void Wise2_sort_DebugState(DebugState * obj,int (*comp)(DebugTransition *, DebugTransition *));
#define sort_DebugState Wise2_sort_DebugState
boolean Wise2_expand_DebugState(DebugState * obj,int len);
#define expand_DebugState Wise2_expand_DebugState
void Wise2_swap_DebugMatrix(DebugState ** list,int i,int j) ;
#define swap_DebugMatrix Wise2_swap_DebugMatrix
void Wise2_qsort_DebugMatrix(DebugState ** list,int left,int right,int (*comp)(DebugState * ,DebugState * ));
#define qsort_DebugMatrix Wise2_qsort_DebugMatrix
void Wise2_sort_DebugMatrix(DebugMatrix * obj,int (*comp)(DebugState *, DebugState *));
#define sort_DebugMatrix Wise2_sort_DebugMatrix
boolean Wise2_expand_DebugMatrix(DebugMatrix * obj,int len);
#define expand_DebugMatrix Wise2_expand_DebugMatrix
void Wise2_swap_bp_DebugMatrix(DebugBreakPoint ** list,int i,int j) ;
#define swap_bp_DebugMatrix Wise2_swap_bp_DebugMatrix
void Wise2_qsort_bp_DebugMatrix(DebugBreakPoint ** list,int left,int right,int (*comp)(DebugBreakPoint * ,DebugBreakPoint * ));
#define qsort_bp_DebugMatrix Wise2_qsort_bp_DebugMatrix
void Wise2_sort_bp_DebugMatrix(DebugMatrix * obj,int (*comp)(DebugBreakPoint *, DebugBreakPoint *));
#define sort_bp_DebugMatrix Wise2_sort_bp_DebugMatrix
boolean Wise2_expand_bp_DebugMatrix(DebugMatrix * obj,int len);
#define expand_bp_DebugMatrix Wise2_expand_bp_DebugMatrix

#ifdef _cplusplus
}
#endif

#endif