gdiplus: Do not rely on an enumerated font size being equal to otmEMSquare.
[wine/multimedia.git] / tools / wrc / dumpres.c
blobf2efe30d658d123980e0f2965e579d04ff92ad29
1 /*
2 * Copyright 1998 Bertho A. Stultiens (BS)
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #include "config.h"
21 #include <assert.h>
22 #include <stdio.h>
23 #include <ctype.h>
25 #include "wrc.h"
26 #include "dumpres.h"
29 *****************************************************************************
30 * Function : get_typename
31 * Syntax : char *get_typename(resource_t* r)
32 * Input :
33 * r - Resource description
34 * Output : A pointer to a string representing the resource type
35 * Description :
36 * Remarks :
37 *****************************************************************************
39 const char *get_typename(const resource_t* r)
41 switch(r->type){
42 case res_acc: return "ACCELERATOR";
43 case res_bmp: return "BITMAP";
44 case res_cur: return "CURSOR";
45 case res_curg: return "GROUP_CURSOR";
46 case res_dlg: return "DIALOG";
47 case res_fnt: return "FONT";
48 case res_ico: return "ICON";
49 case res_icog: return "GROUP_ICON";
50 case res_men: return "MENU";
51 case res_rdt: return "RCDATA";
52 case res_stt: return "STRINGTABLE";
53 case res_usr: return "UserResource";
54 case res_msg: return "MESSAGETABLE";
55 case res_ver: return "VERSIONINFO";
56 case res_dlginit: return "DLGINIT";
57 case res_toolbar: return "TOOLBAR";
58 case res_anicur: return "CURSOR (animated)";
59 case res_aniico: return "ICON (animated)";
60 default: return "Unknown";
65 *****************************************************************************
66 * Function : strncpyWtoA
67 * Syntax : char *strncpyWtoA(char *cs, short *ws, int maxlen)
68 * Input :
69 * cs - Pointer to buffer to receive result
70 * ws - Source wide-string
71 * maxlen - Max chars to copy
72 * Output : 'cs'
73 * Description : Copy a unicode string to ascii. Copying stops after the
74 * first occurring '\0' or when maxlen-1 chars are copied. The
75 * String is always nul terminated.
76 * Remarks : No codepage translation is done.
77 *****************************************************************************
79 static char *strncpyWtoA(char *cs, const WCHAR *ws, int maxlen)
81 char *cptr = cs;
82 const WCHAR *wsMax = ws + maxlen - 1;
83 while(*ws && ws < wsMax)
85 if(*ws > 255)
86 fprintf(stderr, "***Warning: Unicode string contains non-printable chars***\n");
87 *cptr++ = (char)*ws++;
89 *cptr = '\0';
90 return cs;
94 *****************************************************************************
95 * Function : print_string
96 * Syntax : void print_string(string_t *str)
97 * Input :
98 * Output :
99 * Description :
100 * Remarks :
101 *****************************************************************************
103 static void print_string(const string_t *str)
105 char buffer[512];
106 if(!str)
107 printf("<none>");
108 else if(str->type == str_char)
109 printf("\"%s\"", str->str.cstr);
110 else
112 strncpyWtoA(buffer, str->str.wstr, sizeof(buffer));
113 printf("L\"%s\"", buffer);
118 *****************************************************************************
119 * Function : get_nameid_str
120 * Syntax : const char *get_nameid_str(const name_id_t *n)
121 * Input :
122 * n - nameid to convert to text
123 * Output : A pointer to the name.
124 * Description :
125 * Remarks : Not reentrant because of static buffer
126 *****************************************************************************
128 const char *get_nameid_str(const name_id_t *n)
130 static char buffer[256];
132 if(!n)
133 return "<none>";
135 if(n->type == name_ord)
137 sprintf(buffer, "%d", n->name.i_name);
138 return buffer;
140 else if(n->type == name_str)
142 if(n->name.s_name->type == str_char)
143 return n->name.s_name->str.cstr;
144 else
146 strncpyWtoA(buffer, n->name.s_name->str.wstr, sizeof(buffer));
147 return buffer;
150 else
151 return "Hoooo, report this: wrong type in nameid";
155 *****************************************************************************
156 * Function : dump_memopt
157 * Syntax : void dump_memopt(DWORD memopt)
158 * Input :
159 * memopt - flag bits of the options set
160 * Output :
161 * Description :
162 * Remarks :
163 *****************************************************************************
165 static void dump_memopt(DWORD memopt)
167 printf("Memory/load options: ");
168 if(memopt & 0x0040)
169 printf("PRELOAD ");
170 else
171 printf("LOADONCALL ");
172 if(memopt & 0x0010)
173 printf("MOVEABLE ");
174 else
175 printf("FIXED ");
176 if(memopt & 0x0020)
177 printf("PURE ");
178 else
179 printf("IMPURE ");
180 if(memopt & 0x1000)
181 printf("DISCARDABLE");
182 printf("\n");
186 *****************************************************************************
187 * Function : dump_lvc
188 * Syntax : void dump_lvc(const lvc_t *l)
189 * Input :
190 * l - pointer to lvc structure
191 * Output :
192 * Description : Dump language, version and characteristics
193 * Remarks :
194 *****************************************************************************
196 static void dump_lvc(const lvc_t *l)
198 if(l->language)
199 printf("LANGUAGE %04x, %04x\n", l->language->id, l->language->sub);
200 else
201 printf("LANGUAGE <not set>\n");
203 if(l->version)
204 printf("VERSION %08x\n", *(l->version));
205 else
206 printf("VERSION <not set>\n");
208 if(l->characts)
209 printf("CHARACTERISTICS %08x\n", *(l->characts));
210 else
211 printf("CHARACTERISTICS <not set>\n");
215 *****************************************************************************
216 * Function : dump_raw_data
217 * Syntax : void dump_raw_data(const raw_data_t *d)
218 * Input :
219 * d - Raw data descriptor
220 * Output :
221 * Description :
222 * Remarks :
223 *****************************************************************************
225 static void dump_raw_data(const raw_data_t *d)
227 unsigned int n;
228 int i;
229 int j;
231 if(!d)
233 printf("<none>");
234 return;
236 printf("Rawdata size: %d\n", d->size);
237 if(debuglevel < 2)
238 return;
240 for(n = 0; n < d->size; n++)
242 if((n % 16) == 0)
244 if(n)
246 printf("- ");
247 for(i = 0; i < 16; i++)
248 printf("%c", isprint(d->data[n-16+i] & 0xff) ? d->data[n-16+i] : '.');
249 printf("\n%08x: ", n);
251 else
252 printf("%08x: ", n);
254 printf("%02x ", d->data[n] & 0xff);
256 printf("- ");
257 j = d->size % 16;
258 if(!j)
259 j = 16;
260 for(i = 0; i < j; i++)
261 printf("%c", isprint(d->data[n-j+i] & 0xff) ? d->data[n-j+i] : '.');
262 printf("\n");
266 *****************************************************************************
267 * Function : dump_accelerator
268 * Syntax : void dump_accelerator(const accelerator_t *acc)
269 * Input :
270 * acc - Accelerator resource descriptor
271 * Output : nop
272 * Description :
273 * Remarks :
274 *****************************************************************************
276 static void dump_accelerator(const accelerator_t *acc)
278 event_t *ev = acc->events;
280 dump_memopt(acc->memopt);
281 dump_lvc(&(acc->lvc));
283 printf("Events: %s\n", ev ? "" : "<none>");
284 while(ev)
286 printf("Key=");
287 if(isprint(ev->key))
288 printf("\"%c\"", ev->key);
289 else if(iscntrl(ev->key))
290 printf("\"^%c\"", ev->key +'@');
291 else
292 printf("\\x%02x", ev->key & 0xff);
294 printf(" Id=%d flags=%04x\n", ev->id, ev->flags);
295 ev = ev->next;
300 *****************************************************************************
301 * Function : dump_cursor
302 * Syntax : void dump_cursor(const cursor_t *cur)
303 * Input :
304 * cur - Cursor resource descriptor
305 * Output : nop
306 * Description :
307 * Remarks :
308 *****************************************************************************
310 static void dump_cursor(const cursor_t *cur)
312 printf("Id: %d\n", cur->id);
313 printf("Width: %d\n", cur->width);
314 printf("Height: %d\n", cur->height);
315 printf("X Hotspot: %d\n", cur->xhot);
316 printf("Y Hotspot: %d\n", cur->yhot);
317 dump_raw_data(cur->data);
321 *****************************************************************************
322 * Function : dump_cursor_group
323 * Syntax : void dump_cursor_group(const cursor_group_t *cur)
324 * Input :
325 * cur - Cursor group resource descriptor
326 * Output : nop
327 * Description :
328 * Remarks :
329 *****************************************************************************
331 static void dump_cursor_group(const cursor_group_t *curg)
333 dump_memopt(curg->memopt);
334 printf("There are %d cursors in this group\n", curg->ncursor);
338 *****************************************************************************
339 * Function : dump_icon
340 * Syntax : void dump_icon(const icon_t *ico)
341 * Input :
342 * ico - Icon resource descriptor
343 * Output : nop
344 * Description :
345 * Remarks :
346 *****************************************************************************
348 static void dump_icon(const icon_t *ico)
350 printf("Id: %d\n", ico->id);
351 printf("Width: %d\n", ico->width);
352 printf("Height: %d\n", ico->height);
353 printf("NColor: %d\n", ico->nclr);
354 printf("NPlanes: %d\n", ico->planes);
355 printf("NBits: %d\n", ico->bits);
356 dump_raw_data(ico->data);
360 *****************************************************************************
361 * Function : dump_icon_group
362 * Syntax : void dump_icon_group(const icon_group_t *ico)
363 * Input :
364 * ico - Icon group resource descriptor
365 * Output : nop
366 * Description :
367 * Remarks :
368 *****************************************************************************
370 static void dump_icon_group(const icon_group_t *icog)
372 dump_memopt(icog->memopt);
373 printf("There are %d icons in this group\n", icog->nicon);
377 *****************************************************************************
378 * Function : dump_ani_curico
379 * Syntax : void dump_ani_curico(const ani_curico_t *ani)
380 * Input :
381 * ani - Animated object resource descriptor
382 * Output : nop
383 * Description :
384 * Remarks :
385 *****************************************************************************
387 static void dump_ani_curico(const ani_curico_t *ani)
389 dump_memopt(ani->memopt);
390 dump_lvc(&ani->data->lvc);
391 dump_raw_data(ani->data);
395 *****************************************************************************
396 * Function : dump_font
397 * Syntax : void dump_font(const font_t *fnt)
398 * Input :
399 * fnt - Font resource descriptor
400 * Output : nop
401 * Description :
402 * Remarks :
403 *****************************************************************************
405 static void dump_font(const font_t *fnt)
407 dump_memopt(fnt->memopt);
408 dump_lvc(&(fnt->data->lvc));
409 dump_raw_data(fnt->data);
413 *****************************************************************************
414 * Function : dump_bitmap
415 * Syntax : void dump_bitmap(const bitmap_t *bmp)
416 * Input :
417 * bmp - Bitmap resource descriptor
418 * Output : nop
419 * Description :
420 * Remarks :
421 *****************************************************************************
423 static void dump_bitmap(const bitmap_t *bmp)
425 dump_memopt(bmp->memopt);
426 dump_lvc(&(bmp->data->lvc));
427 dump_raw_data(bmp->data);
431 *****************************************************************************
432 * Function : dump_rcdata
433 * Syntax : void dump_rcdata(const rcdata_t *rdt)
434 * Input :
435 * rdt - RCData resource descriptor
436 * Output : nop
437 * Description :
438 * Remarks :
439 *****************************************************************************
441 static void dump_rcdata(const rcdata_t *rdt)
443 dump_memopt(rdt->memopt);
444 dump_lvc(&(rdt->data->lvc));
445 dump_raw_data(rdt->data);
449 *****************************************************************************
450 * Function : dump_user
451 * Syntax : void dump_user(const user_t *usr)
452 * Input :
453 * usr - User resource descriptor
454 * Output : nop
455 * Description :
456 * Remarks :
457 *****************************************************************************
459 static void dump_user(const user_t *usr)
461 dump_memopt(usr->memopt);
462 dump_lvc(&(usr->data->lvc));
463 printf("Class %s\n", get_nameid_str(usr->type));
464 dump_raw_data(usr->data);
468 *****************************************************************************
469 * Function : dump_messagetable
470 * Syntax : void dump_messagetable(const messagetable_t *msg)
471 * Input :
472 * msg - Messagetable resource descriptor
473 * Output : nop
474 * Description :
475 * Remarks :
476 *****************************************************************************
478 static void dump_messagetable(const messagetable_t *msg)
480 dump_memopt(msg->memopt);
481 dump_lvc(&(msg->data->lvc));
482 dump_raw_data(msg->data);
486 *****************************************************************************
487 * Function : dump_stringtable
488 * Syntax : void dump_stringtable(const stringtable_t *stt)
489 * Input :
490 * stt - Stringtable resource descriptor
491 * Output : nop
492 * Description :
493 * Remarks :
494 *****************************************************************************
496 static void dump_stringtable(const stringtable_t *stt)
498 int i;
499 for(; stt; stt = stt->next)
501 printf("{\n");
502 dump_memopt(stt->memopt);
503 dump_lvc(&(stt->lvc));
504 for(i = 0; i < stt->nentries; i++)
506 printf("Id=%-5d (%d) ", stt->idbase+i, stt->entries[i].id);
507 if(stt->entries[i].str)
508 print_string(stt->entries[i].str);
509 else
510 printf("<none>");
511 printf("\n");
513 printf("}\n");
518 *****************************************************************************
519 * Function : dump_control
520 * Syntax : void dump_control(const control_t *ctrl)
521 * Input :
522 * ctrl - Control resource descriptor
523 * Output :
524 * Description :
525 * Remarks :
526 *****************************************************************************
528 static void dump_control(const control_t *ctrl)
530 printf("Control {\n\tClass: %s\n", get_nameid_str(ctrl->ctlclass));
531 printf("\tText: "); get_nameid_str(ctrl->title); printf("\n");
532 printf("\tId: %d\n", ctrl->id);
533 printf("\tx, y, w, h: %d, %d, %d, %d\n", ctrl->x, ctrl->y, ctrl->width, ctrl->height);
534 if(ctrl->gotstyle)
536 assert(ctrl->style != NULL);
537 assert(ctrl->style->and_mask == 0);
538 printf("\tStyle: %08x\n", ctrl->style->or_mask);
540 if(ctrl->gotexstyle)
542 assert(ctrl->exstyle != NULL);
543 assert(ctrl->exstyle->and_mask == 0);
544 printf("\tExStyle: %08x\n", ctrl->exstyle->or_mask);
546 if(ctrl->gothelpid)
547 printf("\tHelpid: %d\n", ctrl->helpid);
548 if(ctrl->extra)
550 printf("\t");
551 dump_raw_data(ctrl->extra);
553 printf("}\n");
557 *****************************************************************************
558 * Function : dump_dialog
559 * Syntax : void dump_dialog(const dialog_t *dlg)
560 * Input :
561 * dlg - Dialog resource descriptor
562 * Output :
563 * Description :
564 * Remarks :
565 *****************************************************************************
567 static void dump_dialog(const dialog_t *dlg)
569 control_t *c = dlg->controls;
571 dump_memopt(dlg->memopt);
572 dump_lvc(&(dlg->lvc));
573 printf("x, y, w, h: %d, %d, %d, %d\n", dlg->x, dlg->y, dlg->width, dlg->height);
574 if(dlg->gotstyle)
576 assert(dlg->style != NULL);
577 assert(dlg->style->and_mask == 0);
578 printf("Style: %08x\n", dlg->style->or_mask);
581 if(dlg->gotexstyle)
583 assert(dlg->exstyle != NULL);
584 assert(dlg->exstyle->and_mask == 0);
585 printf("ExStyle: %08x\n", dlg->exstyle->or_mask);
587 printf("Menu: %s\n", get_nameid_str(dlg->menu));
588 printf("Class: %s\n", get_nameid_str(dlg->dlgclass));
589 printf("Title: "); print_string(dlg->title); printf("\n");
590 printf("Font: ");
591 if(!dlg->font)
592 printf("<none>\n");
593 else
595 printf("%d, ", dlg->font->size);
596 print_string(dlg->font->name);
597 printf("\n");
599 while(c)
601 dump_control(c);
602 c = c->next;
607 *****************************************************************************
608 * Function : dump_menu_item
609 * Syntax : void dump_menu_item(const menuex_item_t *item)
610 * Input :
611 * Output :
612 * Description :
613 * Remarks :
614 *****************************************************************************
616 static void dump_menu_item(const menu_item_t *item)
618 while(item)
620 if(item->popup)
622 printf("POPUP ");
623 print_string(item->name);
624 if(item->gotid)
625 printf(", Id=%d", item->id);
626 if(item->gottype)
627 printf(", Type=%d", item->type);
628 if(item->gotstate)
629 printf(", State=%08x", item->state);
630 if(item->gothelpid)
631 printf(", HelpId=%d", item->helpid);
632 printf("\n");
633 dump_menu_item(item->popup);
635 else
637 printf("MENUITEM ");
638 if(item->name)
640 print_string(item->name);
641 if(item->gotid)
642 printf(", Id=%d", item->id);
643 if(item->gottype)
644 printf(", Type=%d", item->type);
645 if(item->gotstate)
646 printf(", State=%08x", item->state);
647 if(item->gothelpid)
648 printf(", HelpId=%d", item->helpid);
650 else
651 printf("SEPARATOR");
652 printf("\n");
654 item = item->next;
659 *****************************************************************************
660 * Function : dump_menu
661 * Syntax : void dump_menu(const menu_t *men)
662 * Input :
663 * men - Menu resource descriptor
664 * Output :
665 * Description :
666 * Remarks :
667 *****************************************************************************
669 static void dump_menu(const menu_t *men)
671 dump_memopt(men->memopt);
672 dump_lvc(&(men->lvc));
673 dump_menu_item(men->items);
677 *****************************************************************************
678 * Function : dump_ver_value
679 * Syntax : void dump_ver_value(const ver_value_t *val)
680 * Input :
681 * Output :
682 * Description :
683 * Remarks :
684 *****************************************************************************
686 static void dump_ver_block(const ver_block_t *); /* Forward ref */
688 static void dump_ver_value(const ver_value_t *val)
690 if(val->type == val_str)
692 printf("VALUE ");
693 print_string(val->key);
694 printf(" ");
695 print_string(val->value.str);
696 printf("\n");
698 else if(val->type == val_words)
700 int i;
701 printf("VALUE");
702 print_string(val->key);
703 for(i = 0; i < val->value.words->nwords; i++)
704 printf(" %04x", val->value.words->words[i]);
705 printf("\n");
707 else if(val->type == val_block)
709 dump_ver_block(val->value.block);
714 *****************************************************************************
715 * Function : dump_ver_block
716 * Syntax : void dump_ver_block(const ver_block_t *blk)
717 * Input :
718 * Output :
719 * Description :
720 * Remarks :
721 *****************************************************************************
723 static void dump_ver_block(const ver_block_t *blk)
725 const ver_value_t *val = blk->values;
726 printf("BLOCK ");
727 print_string(blk->name);
728 printf("\n{\n");
729 while(val)
731 dump_ver_value(val);
732 val = val->next;
734 printf("}\n");
738 *****************************************************************************
739 * Function : dump_versioninfo
740 * Syntax : void dump_versioninfo(const versioninfo_t *ver)
741 * Input :
742 * ver - Versioninfo resource descriptor
743 * Output :
744 * Description :
745 * Remarks :
746 *****************************************************************************
748 static void dump_versioninfo(const versioninfo_t *ver)
750 const ver_block_t *blk = ver->blocks;
752 dump_lvc(&(ver->lvc));
754 if(ver->gotit.fv)
755 printf("FILEVERSION %04x, %04x, %04x, %04x\n",
756 ver->filever_maj1,
757 ver->filever_maj2,
758 ver->filever_min1,
759 ver->filever_min2);
760 if(ver->gotit.pv)
761 printf("PRODUCTVERSION %04x, %04x, %04x, %04x\n",
762 ver->prodver_maj1,
763 ver->prodver_maj2,
764 ver->prodver_min1,
765 ver->prodver_min2);
766 if(ver->gotit.fo)
767 printf("FILEOS %08x\n", ver->fileos);
768 if(ver->gotit.ff)
769 printf("FILEFLAGS %08x\n", ver->fileflags);
770 if(ver->gotit.ffm)
771 printf("FILEFLAGSMASK %08x\n", ver->fileflagsmask);
772 if(ver->gotit.ft)
773 printf("FILETYPE %08x\n", ver->filetype);
774 if(ver->gotit.fst)
775 printf("FILESUBTYPE %08x\n", ver->filesubtype);
776 while(blk)
778 dump_ver_block(blk);
779 blk = blk->next;
784 *****************************************************************************
785 * Function : dump_toolbar_item
786 * Syntax : void dump_toolbar_item(const toolbar_item_t *item)
787 * Input :
788 * Output :
789 * Description :
790 * Remarks :
791 *****************************************************************************
793 static void dump_toolbar_items(const toolbar_item_t *items)
795 while(items)
797 if(items->id)
798 printf(" BUTTON %d", items->id );
799 else
800 printf(" SEPARATOR");
802 printf("\n");
804 items = items->next;
809 *****************************************************************************
810 * Function : dump_toolbar
811 * Syntax : void dump_toolbar(const toolbar_t *toolbar)
812 * Input :
813 * toolbar - Toolbar resource descriptor
814 * Output :
815 * Description :
816 * Remarks :
817 *****************************************************************************
819 static void dump_toolbar(const toolbar_t *toolbar)
821 dump_memopt(toolbar->memopt);
822 dump_lvc(&(toolbar->lvc));
823 dump_toolbar_items(toolbar->items);
827 *****************************************************************************
828 * Function : dump_dlginit
829 * Syntax : void dump_dlginit(const dlginit_t *dit)
830 * Input :
831 * dit - DlgInit resource descriptor
832 * Output :
833 * Description :
834 * Remarks :
835 *****************************************************************************
837 static void dump_dlginit(const dlginit_t *dit)
839 dump_memopt(dit->memopt);
840 dump_lvc(&(dit->data->lvc));
841 dump_raw_data(dit->data);
845 *****************************************************************************
846 * Function : dump_resources
847 * Syntax : void dump_resources(const resource_t *top)
848 * Input :
849 * top - Top of the resource tree
850 * Output :
851 * nop
852 * Description : Dump the parsed resource-tree to stdout
853 * Remarks :
854 *****************************************************************************
856 void dump_resources(const resource_t *top)
858 printf("Internal resource-tree dump:\n");
859 while(top)
861 printf("Resource: %s\nId: %s\n",
862 get_typename(top),
863 get_nameid_str(top->name));
864 switch(top->type)
866 case res_acc:
867 dump_accelerator(top->res.acc);
868 break;
869 case res_bmp:
870 dump_bitmap(top->res.bmp);
871 break;
872 case res_cur:
873 dump_cursor(top->res.cur);
874 break;
875 case res_curg:
876 dump_cursor_group(top->res.curg);
877 break;
878 case res_dlg:
879 dump_dialog(top->res.dlg);
880 break;
881 case res_fnt:
882 dump_font(top->res.fnt);
883 break;
884 case res_icog:
885 dump_icon_group(top->res.icog);
886 break;
887 case res_ico:
888 dump_icon(top->res.ico);
889 break;
890 case res_men:
891 dump_menu(top->res.men);
892 break;
893 case res_rdt:
894 dump_rcdata(top->res.rdt);
895 break;
896 case res_stt:
897 dump_stringtable(top->res.stt);
898 break;
899 case res_usr:
900 dump_user(top->res.usr);
901 break;
902 case res_msg:
903 dump_messagetable(top->res.msg);
904 break;
905 case res_ver:
906 dump_versioninfo(top->res.ver);
907 break;
908 case res_dlginit:
909 dump_dlginit(top->res.dlgi);
910 break;
911 case res_toolbar:
912 dump_toolbar(top->res.tbt);
913 break;
914 case res_anicur:
915 case res_aniico:
916 dump_ani_curico(top->res.ani);
917 break;
918 default:
919 printf("Report this: Unknown resource type parsed %08x\n", top->type);
921 printf("\n");
922 top = top->next;