summaryrefslogtreecommitdiff
path: root/compiler_and_linker/unsorted/uDump.c
blob: 77ac23876c8835f106f82fce0e26b61c0bba7257 (plain)
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
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
#include "compiler/uDump.h"
#include "compiler/CFunc.h"
#include "compiler/CInt64.h"
#include "compiler/CMachine.h"
#include "compiler/CMangler.h"
#include "compiler/CParser.h"
#include "compiler/Exceptions.h"
#include "compiler/Switch.h"
#include "compiler/enode.h"
#include "compiler/objects.h"
#include "compiler/types.h"

static FILE *outfile;

// forward decls
static void spell(Type *type, char *buf);

static void WritePString(FILE *file, char *str, int len) {
    while (len--) {
        switch (*str) {
            case 0:
                fputs("\\x00", file);
                break;
            case 7:
                fputs("\\a", file);
                break;
            case 8:
                fputs("\\b", file);
                break;
            case 12:
                fputs("\\f", file);
                break;
            case 10:
                fputs("\\n", file);
                break;
            case 13:
                fputs("\\r", file);
                break;
            case 9:
                fputs("\\t", file);
                break;
            case 11:
                fputs("\\v", file);
                break;
            case '"':
            case '\'':
            case '?':
            case '\\':
                fputc('\\', file);
            default:
                fputc(*str, file);
                break;
        }
        str++;
    }
}

static void WriteCString(FILE *file, char *str) {
    WritePString(file, str, strlen(str));
}

static void StaticSetupDumpIR(void) {
}

void SetupDumpIR(void) {
    // unknown args
    StaticSetupDumpIR();
}

void CleanupDumpIR(void) {
#ifdef CW_PATCH_DEBUG
    // this code is not based on the original as we don't have it
    if (outfile) {
        fclose(outfile);
        outfile = NULL;
    }
#endif
}

void DumpIR(Statement *statements, Object *func) {
#ifdef CW_PATCH_DEBUG
    // this code is not based on the original as we don't have it
    if (copts.debuglisting) {
        if (!outfile)
            outfile = fopen("irdump.txt", "a");

        fputs("--- BEGIN IR DUMP ---\r", outfile);
        while (statements) {
            switch (statements->type) {
                case ST_NOP:
                    fputs("ST_NOP\r", outfile);
                    break;
                case ST_LABEL:
                    fputs("ST_LABEL\r", outfile);
                    break;
                case ST_GOTO:
                    fputs("ST_GOTO\r", outfile);
                    break;
                case ST_EXPRESSION:
                    fputs("ST_EXPRESSION\r", outfile);
                    DumpExpression(statements->expr, 1);
                    break;
                case ST_SWITCH:
                    fputs("ST_SWITCH\r", outfile);
                    DumpExpression(statements->expr, 1);
                    break;
                case ST_IFGOTO:
                    fputs("ST_IFGOTO\r", outfile);
                    DumpExpression(statements->expr, 1);
                    break;
                case ST_IFNGOTO:
                    fputs("ST_IFNGOTO\r", outfile);
                    DumpExpression(statements->expr, 1);
                    break;
                case ST_RETURN:
                    fputs("ST_RETURN\r", outfile);
                    if (statements->expr)
                        DumpExpression(statements->expr, 1);
                    break;
                case ST_OVF:
                    fputs("ST_OVF\r", outfile);
                    break;
                case ST_EXIT:
                    fputs("ST_EXIT\r", outfile);
                    break;
                case ST_ENTRY:
                    fputs("ST_ENTRY\r", outfile);
                    break;
                case ST_BEGINCATCH:
                    fputs("ST_BEGINCATCH\r", outfile);
                    break;
                case ST_ENDCATCH:
                    fputs("ST_ENDCATCH\r", outfile);
                    break;
                case ST_ENDCATCHDTOR:
                    fputs("ST_ENDCATCHDTOR\r", outfile);
                    break;
                case ST_GOTOEXPR:
                    fputs("ST_GOTOEXPR\r", outfile);
                    break;
                case ST_ASM:
                    fputs("ST_ASM\r", outfile);
                    break;
                case ST_BEGINLOOP:
                    fputs("ST_BEGINLOOP\r", outfile);
                    break;
                case ST_ENDLOOP:
                    fputs("ST_ENDLOOP\r", outfile);
                    break;
            }
            statements = statements->next;
        }
        fputs("--- END IR DUMP ---\r", outfile);
        fflush(outfile);
    }
#endif
}

void DumpExpression(ENode *expr, int indent) {
    static int bt;
    static int i;
    static char *nodenames[] = {
        "EPOSTINC",
        "EPOSTDEC",
        "EPREINC",
        "EPREDEC",
        "EINDIRECT",
        "EMONMIN",
        "EBINNOT",
        "ELOGNOT",
        "EFORCELOAD",
        "EMUL",
        "EMULV",
        "EDIV",
        "EMODULO",
        "EADDV",
        "ESUBV",
        "EADD",
        "ESUB",
        "ESHL",
        "ESHR",
        "ELESS",
        "EGREATER",
        "ELESSEQU",
        "EGREATEREQU",
        "EEQU",
        "ENOTEQU",
        "EAND",
        "EXOR",
        "EOR",
        "ELAND",
        "ELOR",
        "EASS",
        "EMULASS",
        "EDIVASS",
        "EMODASS",
        "EADDASS",
        "ESUBASS",
        "ESHLASS",
        "ESHRASS",
        "EANDASS",
        "EXORASS",
        "EORASS",
        "ECOMMA",
        "EPMODULO",
        "EROTL",
        "EROTR",
        "EBCLR",
        "EBTST",
        "EBSET",
        "ETYPCON",
        "EBITFIELD",
        "EINTCONST",
        "EFLOATCONST",
        "ESTRINGCONST",
        "ECOND",
        "EFUNCCALL",
        "EFUNCCALLP",
        "EOBJREF",
        "EMFPOINTER",
        "ENULLCHECK",
        "EPRECOMP",
        "ETEMP",
        "EARGOBJ",
        "ELOCOBJ",
        "ELABEL",
        "ESETCONST",
        "ENEWEXCEPTION",
        "ENEWEXCEPTIONARRAY",
        "EINITTRYCATCH",
        "EOBJLIST",
        "EMEMBER",
        "ETEMPLDEP",
        "EINSTRUCTION",
        "EDEFINE",
        "EREUSE",
        "EASSBLK",
        "EVECTOR128CONST",
        "ECONDASS",
        NULL
    };
    char buf[64];
    ENodeList *list;

    while (1) {
        for (i = 0; i < indent; i++)
            fputc('\t', outfile);

        if (expr->flags)
            fprintf(outfile, "%s {%02X}", nodenames[expr->type], expr->flags);
        else
            fprintf(outfile, "%s", nodenames[expr->type]);

        switch (expr->type) {
            case EINTCONST:
                if (expr->rtype->size > 4) {
                    fprintf(outfile,
                            "[0x%.8" PRIX32 "%.8" PRIX32 "]",
                            expr->data.intval.hi, expr->data.intval.lo);
                } else {
                    fprintf(outfile,
                            "[%" PRId32 "]",
                            expr->data.intval.lo);
                }
                DumpType(expr->rtype);
                fprintf(outfile, "\r");
                return;

            case EFLOATCONST:
                CMach_PrintFloat(buf, expr->data.floatval);
                fprintf(outfile, "[%s]", buf);
                DumpType(expr->rtype);
                fprintf(outfile, "\r");
                return;

            case ESTRINGCONST:
                if (expr->data.string.ispascal) {
                    fputs("[\"", outfile);
                    WritePString(outfile, expr->data.string.data, expr->data.string.size);
                    fputs("\"]", outfile);
                } else {
                    fputs("[\"", outfile);
                    WriteCString(outfile, expr->data.string.data);
                    fputs("\"]", outfile);
                }
                DumpType(expr->rtype);
                fprintf(outfile, "\r");
                return;

            case EVECTOR128CONST:
                fprintf(outfile,
                        "[0x%.8" PRIX32 "%.8" PRIX32 "%.8" PRIX32 "%.8" PRIX32 "]",
                        expr->data.vector128val.ul[0],
                        expr->data.vector128val.ul[1],
                        expr->data.vector128val.ul[2],
                        expr->data.vector128val.ul[3]);
                DumpType(expr->rtype);
                fprintf(outfile, "\r");
                return;

            case ECOND:
            case ECONDASS:
                DumpType(expr->rtype);
                fprintf(outfile, "\r");
                DumpExpression(expr->data.cond.cond, indent + 1);
                DumpExpression(expr->data.cond.expr1, indent + 1);
                expr = expr->data.cond.expr2;
                indent++;
                break;

            case EFUNCCALL:
            case EFUNCCALLP:
                DumpType(expr->rtype);
                fprintf(outfile, "\r");
                DumpExpression(expr->data.funccall.funcref, indent + 1);
                for (list = expr->data.funccall.args; list; list = list->next)
                    DumpExpression(list->node, indent + 1);
                return;

            case EOBJREF:
                switch (expr->data.objref->datatype) {
                    case DFUNC:
                        fprintf(outfile, "[%s{PR}]", CMangler_GetLinkName(expr->data.objref)->name);
                        break;
                    case DDATA:
                        fprintf(outfile, "[%s{RW}]", CMangler_GetLinkName(expr->data.objref)->name);
                        break;
                    case DNONLAZYPTR:
                        fprintf(outfile, "[%s{NL}]", CMangler_GetLinkName(expr->data.objref)->name);
                        break;
                    default:
                        fprintf(outfile, "[%s]", expr->data.objref->name->name);
                        break;
                }
                DumpType(expr->rtype);
                fprintf(outfile, "\r");
                return;

            ENODE_CASE_DIADIC_1:
            case ELAND:
            case ELOR:
            ENODE_CASE_ASSIGN:
            case ECOMMA:
            case EPMODULO:
            case EROTL:
            case EROTR:
            case EBTST:
                DumpType(expr->rtype);
                fprintf(outfile, "\r");
                DumpExpression(expr->data.diadic.left, indent + 1);
                expr = expr->data.diadic.right;
                indent++;
                break;

            ENODE_CASE_MONADIC:
                DumpType(expr->rtype);
                fprintf(outfile, "\r");
                expr = expr->data.monadic;
                indent++;
                break;

            case EMFPOINTER:
                DumpType(expr->rtype);
                fprintf(outfile, "\r");
                DumpExpression(expr->data.mfpointer.accessnode, indent + 1);
                expr = expr->data.mfpointer.mfpointer;
                indent++;
                break;

            case ENULLCHECK:
                fprintf(outfile, " unique [%" PRId32 "]", expr->data.nullcheck.precompid);
                DumpType(expr->rtype);
                fprintf(outfile, "\r");
                DumpExpression(expr->data.nullcheck.nullcheckexpr, indent + 1);
                expr = expr->data.nullcheck.condexpr;
                indent++;
                break;

            case EPRECOMP:
                fprintf(outfile, " unique [%" PRId32 "]", expr->data.precompid);
                DumpType(expr->rtype);
                fprintf(outfile, "\r");
                return;

            case ELABEL:
                fprintf(outfile, "[%s]", expr->data.label->uniquename->name);
                DumpType(expr->rtype);
                fprintf(outfile, "\r");
                return;

            case ETEMP:
                DumpType(expr->data.temp.type);
                fprintf(outfile, "\r");
                return;

            case EINITTRYCATCH:
                DumpType(expr->rtype);
                fprintf(outfile, "\r");
                if (expr->data.itc.initexpr)
                    DumpExpression(expr->data.itc.initexpr, indent + 1);
                if (expr->data.itc.tryexpr)
                    DumpExpression(expr->data.itc.tryexpr, indent + 1);
                if (expr->data.itc.catchexpr)
                    DumpExpression(expr->data.itc.catchexpr, indent + 1);
                if (expr->data.itc.result)
                    DumpExpression(expr->data.itc.result, indent + 1);
                return;

            case EDEFINE:
                fprintf(outfile, "[%.8" PRIX32 "]", expr);
                DumpType(expr->rtype);
                fputs("\r", outfile);
                expr = expr->data.monadic;
                indent++;
                break;

            case EREUSE:
                fprintf(outfile, "[%.8" PRIX32 "]", expr->data.monadic);
                DumpType(expr->rtype);
                fputs("\r", outfile);
                return;

            default:
                return;
        }
    }
}

void DumpSwitch(SwitchInfo *info) {
    char buf[32];
    SwitchCase *cs;

    for (cs = info->cases; cs; cs = cs->next) {
        CInt64_PrintDec(buf, cs->min);
        CInt64_PrintDec(buf, cs->min);
        fprintf(outfile, "\t\t%11s: %s\r", buf, cs->label->uniquename->name);
    }

    fprintf(outfile, "\t\t    default: %s\r", info->defaultlabel->uniquename->name);
}

void DumpType(Type *type) {
    char buf[256];

    spell(type, buf);
    fprintf(outfile, " (%s)", buf);
}

static void spell(Type *type, char *buf) {
    char mybuf[256];
    char mybuf2[256];

    switch (type->type) {
        case TYPEVOID:
            strcpy(buf, "void");
            break;
        case TYPEINT:
            switch (TYPE_INTEGRAL(type)->integral) {
                case IT_BOOL:
                    strcpy(buf, "bool");
                    break;
                case IT_CHAR:
                    strcpy(buf, "char");
                    break;
                case IT_WCHAR_T:
                    strcpy(buf, "wchar_t");
                    break;
                case IT_SCHAR:
                    strcpy(buf, "signed char");
                    break;
                case IT_UCHAR:
                    strcpy(buf, "unsigned char");
                    break;
                case IT_SHORT:
                    strcpy(buf, "short");
                    break;
                case IT_USHORT:
                    strcpy(buf, "unsigned short");
                    break;
                case IT_INT:
                    strcpy(buf, "int");
                    break;
                case IT_UINT:
                    strcpy(buf, "unsigned int");
                    break;
                case IT_LONG:
                    strcpy(buf, "long");
                    break;
                case IT_ULONG:
                    strcpy(buf, "unsigned long");
                    break;
                case IT_LONGLONG:
                    strcpy(buf, "long long");
                    break;
                case IT_ULONGLONG:
                    strcpy(buf, "unsigned long long");
                    break;
            }
            break;
        case TYPEFLOAT:
            switch (TYPE_INTEGRAL(type)->integral) {
                case IT_FLOAT:
                    strcpy(buf, "float");
                    break;
                case IT_SHORTDOUBLE:
                    strcpy(buf, "short double");
                    break;
                case IT_DOUBLE:
                    strcpy(buf, "double");
                    break;
                case IT_LONGDOUBLE:
                    strcpy(buf, "long double");
                    break;
            }
            break;
        case TYPEENUM:
            strcpy(buf, "enum ");
            if (TYPE_ENUM(type)->enumname)
                strcat(buf, TYPE_ENUM(type)->enumname->name);
            break;
        case TYPESTRUCT:
            if (IS_TYPESTRUCT_VECTOR(TYPE_STRUCT(type))) {
                switch (TYPE_STRUCT(type)->stype) {
                    case STRUCT_TYPE_4:
                        strcpy(buf, "vector unsigned char ");
                        break;
                    case STRUCT_TYPE_5:
                        strcpy(buf, "vector signed char ");
                        break;
                    case STRUCT_TYPE_6:
                        strcpy(buf, "vector bool char ");
                        break;
                    case STRUCT_TYPE_7:
                        strcpy(buf, "vector unsigned short ");
                        break;
                    case STRUCT_TYPE_8:
                        strcpy(buf, "vector signed short ");
                        break;
                    case STRUCT_TYPE_9:
                        strcpy(buf, "vector bool short ");
                        break;
                    case STRUCT_TYPE_A:
                        strcpy(buf, "vector unsigned int ");
                        break;
                    case STRUCT_TYPE_B:
                        strcpy(buf, "vector signed int ");
                        break;
                    case STRUCT_TYPE_C:
                        strcpy(buf, "vector bool int ");
                        break;
                    case STRUCT_TYPE_D:
                        strcpy(buf, "vector float ");
                        break;
                    case STRUCT_TYPE_E:
                        strcpy(buf, "vector pixel ");
                        break;
                }
            } else {
                strcpy(buf, "struct ");
                if (TYPE_STRUCT(type)->name)
                    strcat(buf, TYPE_STRUCT(type)->name->name);
            }
            break;
        case TYPECLASS:
            strcpy(buf, "class ");
            if (TYPE_CLASS(type)->classname)
                strcat(buf, TYPE_CLASS(type)->classname->name);
            break;
        case TYPEFUNC:
            spell(TYPE_FUNC(type)->functype, mybuf);
            strcpy(buf, "freturns(");
            strcat(buf, mybuf);
            strcat(buf, ")");
            break;
        case TYPEBITFIELD:
            spell(TYPE_BITFIELD(type)->bitfieldtype, mybuf);
            sprintf(buf,
                    "bitfield(%s){%d:%d}",
                    mybuf,
                    TYPE_BITFIELD(type)->unkA,
                    TYPE_BITFIELD(type)->unkB);
            break;
        case TYPELABEL:
            strcpy(buf, "label");
            break;
        case TYPEPOINTER:
            spell(TPTR_TARGET(type), mybuf);
            strcpy(buf, "pointer(");
            strcat(buf, mybuf);
            strcat(buf, ")");
            break;
        case TYPEARRAY:
            spell(TPTR_TARGET(type), mybuf);
            strcpy(buf, "array(");
            strcat(buf, mybuf);
            strcat(buf, ")");
            break;
        case TYPEMEMBERPOINTER:
            spell(TYPE_MEMBER_POINTER(type)->ty2, mybuf);
            spell(TYPE_MEMBER_POINTER(type)->ty1, mybuf2);
            strcpy(buf, "memberpointer(");
            strcat(buf, mybuf);
            strcat(buf, ",");
            strcat(buf, mybuf2);
            strcat(buf, ")");
            break;
    }
}

void DumpStack(ExceptionAction *act) {
    while (act) {
        fprintf(outfile, "\t\t:");
        switch (act->type) {
            case EAT_DESTROYLOCAL:
                fprintf(outfile,
                        "EAT_DESTROYLOCAL %s(&%s)%s",
                        CMangler_GetLinkName(act->data.destroy_local.dtor)->name,
                        act->data.destroy_local.local->name->name,
                        "\r");
                break;
            case EAT_DESTROYLOCALCOND:
                fprintf(outfile,
                        "EAT_DESTROYLOCALCOND%s",
                        "\r");
                break;
            case EAT_DESTROYLOCALOFFSET:
                fprintf(outfile,
                        "EAT_DESTROYLOCALOFFSET %s(&%s+%" PRId32 ")%s",
                        CMangler_GetLinkName(act->data.destroy_local_offset.dtor)->name,
                        act->data.destroy_local_offset.local->name->name,
                        act->data.destroy_local_offset.offset,
                        "\r");
                break;
            case EAT_DESTROYLOCALPOINTER:
                fprintf(outfile,
                        "EAT_DESTROYLOCALPOINTER%s",
                        "\r");
                break;
            case EAT_DESTROYLOCALARRAY:
                fprintf(outfile,
                        "EAT_DESTROYLOCALARRAY%s",
                        "\r");
                break;
            case EAT_DESTROYBASE:
                fprintf(outfile,
                        "EAT_DESTROYBASE %s(this+%" PRId32 ")%s",
                        CMangler_GetLinkName(act->data.destroy_base.dtor)->name,
                        act->data.destroy_base.offset,
                        "\r");
                break;
            case EAT_DESTROYMEMBER:
                fprintf(outfile,
                        "EAT_DESTROYMEMBER %s(%s+%" PRId32 ")%s",
                        CMangler_GetLinkName(act->data.destroy_member.dtor)->name,
                        act->data.destroy_member.objectptr->name->name,
                        act->data.destroy_member.offset,
                        "\r");
                break;
            case EAT_DESTROYMEMBERCOND:
                fprintf(outfile,
                        "EAT_DESTROYMEMBERCOND if(%s) %s(this+%" PRId32 ")%s",
                        act->data.destroy_member_cond.cond->name->name,
                        CMangler_GetLinkName(act->data.destroy_member_cond.dtor)->name,
                        act->data.destroy_member_cond.offset,
                        "\r");
                break;
            case EAT_DESTROYMEMBERARRAY:
                fprintf(outfile,
                        "EAT_DESTROYMEMBERARRAY %s(this+%" PRId32 ")[%" PRId32 "] size: %" PRId32 "%s",
                        CMangler_GetLinkName(act->data.destroy_member_array.dtor)->name,
                        act->data.destroy_member_array.offset,
                        act->data.destroy_member_array.elements,
                        act->data.destroy_member_array.element_size,
                        "\r");
                break;
            case EAT_DELETEPOINTER:
                fprintf(outfile,
                        "EAT_DELETEPOINTER(%s)%s",
                        act->data.delete_pointer.pointerobject->name->name,
                        "\r");
                break;
            case EAT_DELETELOCALPOINTER:
                fprintf(outfile,
                        "EAT_DELETELOCALPOINTER(%s)%s",
                        act->data.delete_pointer.pointerobject->name->name,
                        "\r");
                break;
            case EAT_DELETEPOINTERCOND:
                fprintf(outfile,
                        "EAT_DELETEPOINTERCOND if (%s)(%s)%s",
                        act->data.delete_pointer_cond.cond->name->name,
                        act->data.delete_pointer_cond.pointerobject->name->name,
                        "\r");
                break;
            case EAT_CATCHBLOCK:
                fprintf(outfile, "EAT_CATCHBLOCK ");
                if (act->data.catch_block.catch_type) {
                    if (act->data.catch_block.catch_object)
                        fprintf(outfile, "[%s]", act->data.catch_block.catch_object->name->name);
                    else
                        fprintf(outfile, "[]");
                    DumpType(act->data.catch_block.catch_type);
                } else {
                    fprintf(outfile, "[...] ");
                }
                fprintf(outfile,
                        " Label: %s%s",
                        act->data.catch_block.catch_label->uniquename->name,
                        "\r");
                break;
            case EAT_SPECIFICATION:
                fprintf(outfile,
                        "EAT_SPECIFICATION%s",
                        "\r");
                break;
            case EAT_ACTIVECATCHBLOCK:
                fprintf(outfile,
                        "EAT_ACTIVECATCHBLOCK%s",
                        "\r");
                break;
            case EAT_TERMINATE:
                fprintf(outfile,
                        "EAT_TERMINATE%s",
                        "\r");
                break;
        }
        act = act->prev;
    }
}